ObjFW
|
A class for storing arbitrary data in an array. More...
#include <OFDataArray.h>
Public Member Functions | |
id | initWithItemSize: (size_t is) |
id | initWithContentsOfFile: (OFString *path) |
id | initWithBase64EncodedString: (OFString *str) |
size_t | count () |
size_t | itemSize () |
void * | cArray () |
void * | itemAtIndex: (size_t index) |
void * | firstItem () |
void * | lastItem () |
void | addItem: (const void *item) |
void | addItem:atIndex: (const void *item,[atIndex] size_t index) |
void | addNItems:fromCArray: (size_t nitems,[fromCArray] const void *carray) |
void | addNItems:fromCArray:atIndex: (size_t nitems,[fromCArray] const void *carray,[atIndex] size_t index) |
void | removeItemAtIndex: (size_t index) |
void | removeNItems: (size_t nitems) |
void | removeNItems:atIndex: (size_t nitems,[atIndex] size_t index) |
OFString * | stringByBase64Encoding () |
OFString * | MD5Hash () |
OFString * | SHA1Hash () |
Static Public Member Functions | |
id | dataArrayWithItemSize: (size_t is) |
id | dataArrayWithContentsOfFile: (OFString *path) |
id | dataArrayWithBase64EncodedString: (OFString *str) |
Protected Attributes | |
char * | data |
Properties | |
size_t | count |
size_t | itemSize |
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.
void OFDataArray::addItem: | ( | const void* | item | ) | [virtual] |
Adds an item to the OFDataArray.
item | A pointer to an arbitrary item |
void OFDataArray::addItem:atIndex: | ( | const void* | item, |
[atIndex] size_t | index | ||
) | [virtual] |
Adds an item to the OFDataArray at the specified index.
item | A pointer to an arbitrary item |
index | The index where the item should be added |
void OFDataArray::addNItems:fromCArray: | ( | size_t | nitems, |
[fromCArray] const void* | carray | ||
) | [virtual] |
Adds items from a C array to the OFDataArray.
nitems | The number of items to add |
carray | A C array containing the items to add |
void OFDataArray::addNItems:fromCArray:atIndex: | ( | size_t | nitems, |
[fromCArray] const void* | carray, | ||
[atIndex] size_t | index | ||
) | [virtual] |
Adds items from a C array to the OFDataArray at the specified index.
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 * OFDataArray::cArray | ( | ) | [virtual] |
size_t OFDataArray::count | ( | ) | [virtual] |
id OFDataArray::dataArrayWithBase64EncodedString: | ( | OFString* | str | ) | [static, virtual] |
Creates a new OFDataArray with an item size of 1, containing the data of the Base64-encoded string.
str | The string with the Base64-encoded data |
id OFDataArray::dataArrayWithContentsOfFile: | ( | OFString* | path | ) | [static, virtual] |
Creates a new OFDataArary with an item size of 1, containing the data of the specified file.
path | The path of the file |
id OFDataArray::dataArrayWithItemSize: | ( | size_t | is | ) | [static, virtual] |
Creates a new OFDataArray whose items all have the same size.
is | The size of each element in the OFDataArray |
void * OFDataArray::firstItem | ( | ) | [virtual] |
id OFDataArray::initWithBase64EncodedString: | ( | OFString* | str | ) | [virtual] |
Initializes an already allocated OFDataArray with an item size of 1, containing the data of the Base64-encoded string.
str | The string with the Base64-encoded data |
id OFDataArray::initWithContentsOfFile: | ( | OFString* | path | ) | [virtual] |
Initializes an already allocated OFDataArray with an item size of 1, containing the data of the specified file.
path | The path of the file |
id OFDataArray::initWithItemSize: | ( | size_t | is | ) | [virtual] |
Initializes an already allocated OFDataArray whose items all have the same size.
is | The size of each element in the OFDataArray |
void * OFDataArray::itemAtIndex: | ( | size_t | index | ) | [virtual] |
Returns a specific item of the OFDataArray.
index | The number of the item to return |
size_t OFDataArray::itemSize | ( | ) | [virtual] |
void * OFDataArray::lastItem | ( | ) | [virtual] |
OFString* OFDataArray(Hashing)::MD5Hash | ( | ) | [virtual] |
void OFDataArray::removeItemAtIndex: | ( | size_t | index | ) | [virtual] |
Removes the item at the specified index.
index | The index of the item to remove |
void OFDataArray::removeNItems: | ( | size_t | nitems | ) | [virtual] |
Removes the specified amount of items from the end of the OFDataArray.
nitems | The number of items to remove |
void OFDataArray::removeNItems:atIndex: | ( | size_t | nitems, |
[atIndex] size_t | index | ||
) | [virtual] |
Removes the specified amount of items at the specified index.
nitems | The number of items to remove |
index | The index at which the items are removed |
OFString* OFDataArray(Hashing)::SHA1Hash | ( | ) | [virtual] |
OFString * OFDataArray::stringByBase64Encoding | ( | ) | [virtual] |