OFDataArray Class Reference

#import <OFDataArray.h>

Inheritance diagram for OFDataArray:
OFObject <OFCopying> OFBigDataArray

List of all members.

Public Member Functions

(id) - initWithItemSize:
(size_t) - count
(size_t) - itemsize
(void *) - cArray
(of_comparison_result_t) - compare:
(void *) - itemAtIndex:
(void *) - firstItem
(void *) - lastItem
(id) - addItem:
(id) - addItem:atIndex:
(id) - addNItems:fromCArray:
(id) - addNItems:fromCArray:atIndex:
(id) - removeItemAtIndex:
(id) - removeNItems:
(id) - removeNItems:atIndex:

Static Public Member Functions

(id) + dataArrayWithItemSize:

Protected Attributes

char * data
size_t itemsize
size_t count

Detailed Description

The OFDataArray class is a class for storing arbitrary data in an array.

If you plan to store large hunks of data, you should consider using OFBigDataArray, which allocates the memory in pages rather than in bytes.


Member Function Documentation

- (id) addItem: (void*)  item  

Adds an item to the OFDataArray.

Parameters:
item A pointer to an arbitrary item
- (id) addItem: (void*)  item
atIndex: (size_t)  index 

Adds an item to the OFDataArray at the specified index.

Parameters:
item A pointer to an arbitrary item
index The index where the item should be added
- (id) addNItems: (size_t)  nitems
fromCArray: (void*)  carray 

Adds items from a C array to the OFDataArray.

Parameters:
nitems The number of items to add
carray A C array containing the items to add
- (id) addNItems: (size_t)  nitems
fromCArray: (void*)  carray
atIndex: (size_t)  index 

Adds items from a C array to the OFDataArray at the specified index.

Parameters:
nitems The number of items to add
carray A C array containing the items to add
index The index where the items should be added
- (void *) cArray  
Returns:
All elements of the OFDataArray as a C array
- (of_comparison_result_t) compare: (OFDataArray*)  ary  

Compares the OFDataArray to another object.

Parameters:
ary A data array to compare with
Returns:
An of_comparsion_result_t
- (size_t) count  
Returns:
The number of items in the OFDataArray
+ (id) dataArrayWithItemSize: (size_t)  is  

Creates a new OFDataArray whose items all have the same size.

Parameters:
is The size of each element in the OFDataArray
Returns:
A new autoreleased OFDataArray
- (void *) firstItem  
Returns:
The first item of the OFDataArray or NULL
- (id) initWithItemSize: (size_t)  is  

Initializes an already allocated OFDataArray whose items all have the same size.

Parameters:
is The size of each element in the OFDataArray
Returns:
An initialized OFDataArray
- (void *) itemAtIndex: (size_t)  index  

Returns a specific item of the OFDataArray.

Parameters:
index The number of the item to return
Returns:
The specified item of the OFDataArray
- (size_t) itemsize  
Returns:
The size of each item in the OFDataArray in bytes
- (void *) lastItem  
Returns:
The last item of the OFDataArray or NULL
- (id) removeItemAtIndex: (size_t)  index  

Removes the item at the specified index.

Parameters:
index The index of the item to remove
- (id) removeNItems: (size_t)  nitems  

Removes the specified amount of items from the end of the OFDataArray.

Parameters:
nitems The number of items to remove
- (id) removeNItems: (size_t)  nitems
atIndex: (size_t)  index 

Removes the specified amount of items at the specified index.

Parameters:
nitems The number of items to remove
index The index at which the items are removed

The documentation for this class was generated from the following files:
 All Classes Functions Variables

Generated on Thu Dec 24 11:10:00 2009 for ObjFW by  doxygen 1.6.1