|
Objectively
Ultra-lightweight object oriented framework for GNU C.
|
#include <Data.h>
Properties | |
| uint8_t * | bytes |
| The bytes. | |
| DataDestructor | destroy |
An optional destructor that, if set, is called on dealloc. | |
| size_t | length |
The length of bytes. | |
| Object | object |
| The superclass. | |
Properties inherited from Object | |
| Class * | clazz |
| Every instance of Object begins with a pointer to its Class. | |
| unsigned int | magic |
| A header to allow introspection of Object types. | |
Methods | |
| Class * | _Data (void) |
| The Data archetype. | |
| void | appendBytes (Data *self, const uint8_t *bytes, size_t length) |
Appends the given bytes to this Data. | |
| void | appendData (Data *self, const Data *data) |
Appends the given data to this Data. | |
| Data * | data (void) |
| Returns a new Data. | |
| Data * | dataWithBytes (const uint8_t *bytes, size_t length) |
Returns a new Data by copying length of bytes. | |
| Data * | dataWithCapacity (size_t capacity) |
Returns a new Data with the given capacity. | |
| Data * | dataWithConstMemory (const ident mem, size_t length) |
| Returns a new Data, backed by the given const memory. | |
| Data * | dataWithContentsOfFile (const char *path) |
Returns a new Data with the contents of the file at path. | |
| Data * | dataWithMemory (ident mem, size_t length) |
| Returns a new Data, taking ownership of the specified memory. | |
| Data * | init (Data *self) |
Initializes this Data with length 0. | |
| Data * | initWithBytes (Data *self, const uint8_t *bytes, size_t length) |
Initializes this Data by copying length of bytes. | |
| Data * | initWithCapacity (Data *self, size_t capacity) |
| Initializes this Data with the given capacity. | |
| Data * | initWithConstMemory (Data *self, const ident mem, size_t length) |
| Initializes this Data with the given const memory. | |
| Data * | initWithContentsOfFile (Data *self, const char *path) |
Initializes this Data with the contents of the file at path. | |
| Data * | initWithData (Data *self, const Data *data) |
Initializes this Data with the contents of data. | |
| Data * | initWithMemory (Data *self, ident mem, size_t length) |
| Initializes this Data, taking ownership of the specified memory. | |
| void | setLength (Data *self, size_t length) |
| Sets the length of this Data, truncating or expanding it. | |
| bool | writeToFile (const Data *self, const char *path) |
Writes this Data to path. | |
Methods inherited from Object | |
| Class * | _Object (void) |
| The Object archetype. | |
| Object * | copy (const Object *self) |
| Creates a shallow copy of this Object. | |
| void | dealloc (Object *self) |
| Frees all resources held by this Object. | |
| String * | description (const Object *self) |
| int | hash (const Object *self) |
| Object * | init (Object *self) |
| Initializes this Object. | |
| bool | isEqual (const Object *self, const Object *other) |
| Tests equality of the other Object. | |
| bool | isKindOfClass (const Object *self, const Class *clazz) |
| Tests for Class hierarchy membership. | |
Protected Attributes | |
| DataInterface * | interface |
| The interface. | |
Protected Attributes inherited from Object | |
| ObjectInterface * | interface |
| The interface. | |
| DataDestructor Data::destroy |
| Class * _Data | ( | void | ) |
The Data archetype.
Definition at line 419 of file Data.c.
| void appendBytes | ( | Data * | self, |
| const uint8_t * | bytes, | ||
| size_t | length | ||
| ) |
Appends the given bytes to this Data.
| self | The Data. |
| bytes | The bytes to append. |
| length | The length of bytes to append. |
Definition at line 262 of file Data.c.
Appends the given data to this Data.
Definition at line 277 of file Data.c.
| Data * data | ( | void | ) |
| Data * dataWithBytes | ( | const uint8_t * | bytes, |
| size_t | length | ||
| ) |
Returns a new Data by copying length of bytes.
| bytes | The bytes. |
| length | The length of bytes to copy. |
NULL on error. Definition at line 115 of file Data.c.
| Data * dataWithCapacity | ( | size_t | capacity | ) |
Returns a new Data with the given capacity.
| capacity | The desired capacity in bytes. |
NULL on error. Definition at line 295 of file Data.c.
Returns a new Data, backed by the given const memory.
| mem | The constant memory to back this Data. |
| length | The length of mem in bytes. |
NULL on error. Definition at line 124 of file Data.c.
| Data * dataWithContentsOfFile | ( | const char * | path | ) |
Returns a new Data with the contents of the file at path.
| path | The path of the file to read into memory. |
NULL on error. Definition at line 133 of file Data.c.
Returns a new Data, taking ownership of the specified memory.
| mem | The dynamically allocated memory to back this Data. |
| length | The length of mem in bytes. |
NULL on error. Definition at line 142 of file Data.c.
Initializes this Data by copying length of bytes.
| self | The Data. |
| bytes | The bytes. |
| length | The length of bytes to copy. |
NULL on error. Initializes this Data with the given capacity.
| self | The Data. |
| capacity | The capacity in bytes. |
NULL on error. Definition at line 313 of file Data.c.
Initializes this Data with the contents of the file at path.
| self | The Data. |
| path | The path of the file to read into memory. |
NULL on error. Definition at line 184 of file Data.c.
Initializes this Data with the contents of data.
NULL on error. Definition at line 335 of file Data.c.
Initializes this Data, taking ownership of the specified memory.
| self | The Data. |
| mem | The dynamically allocated memory to back this Data. |
| length | The length of mem in bytes. |
NULL on error. | void setLength | ( | Data * | self, |
| size_t | length | ||
| ) |
Sets the length of this Data, truncating or expanding it.
| self | The Data. |
| length | The new desired length. |
Definition at line 349 of file Data.c.
| bool writeToFile | ( | const Data * | self, |
| const char * | path | ||
| ) |
Writes this Data to path.
| self | The Data. |
| path | The path of the file to write. |
true on success, false on error. Definition at line 233 of file Data.c.