Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
|
#include <Data.h>
Properties | |
uint8_t * | bytes |
The bytes. More... | |
DataDestructor | destroy |
An optional destructor that, if set, is called on dealloc . More... | |
size_t | length |
The length of bytes . More... | |
Object | object |
The superclass. More... | |
![]() | |
Class * | clazz |
Every instance of Object begins with a pointer to its Class. More... | |
Methods | |
Class * | _Data (void) |
The Data archetype. More... | |
Data * | dataWithBytes (const uint8_t *bytes, size_t length) |
Returns a new Data by copying length of bytes . More... | |
Data * | dataWithConstMemory (const ident mem, size_t length) |
Returns a new Data, backed by the given const memory. More... | |
Data * | dataWithContentsOfFile (const char *path) |
Returns a new Data with the contents of the file at path . More... | |
Data * | dataWithMemory (ident mem, size_t length) |
Returns a new Data, taking ownership of the specified memory. More... | |
Data * | initWithBytes (Data *self, const uint8_t *bytes, size_t length) |
Initializes this Data by copying length of bytes . More... | |
Data * | initWithConstMemory (Data *self, const ident mem, size_t length) |
Initializes this Data with the given const memory. More... | |
Data * | initWithContentsOfFile (Data *self, const char *path) |
Initializes this Data with the contents of the file at path . More... | |
Data * | initWithMemory (Data *self, ident mem, size_t length) |
Initializes this Data, taking ownership of the specified memory. More... | |
MutableData * | mutableCopy (const Data *self) |
_Bool | writeToFile (const Data *self, const char *path) |
Writes this Data to path . More... | |
![]() | |
Class * | _Object (void) |
The Object archetype. More... | |
Object * | copy (const Object *self) |
Creates a shallow copy of this Object. More... | |
void | dealloc (Object *self) |
Frees all resources held by this Object. More... | |
String * | description (const Object *self) |
int | hash (const Object *self) |
Object * | init (Object *self) |
Initializes this Object. More... | |
_Bool | isEqual (const Object *self, const Object *other) |
Tests equality of the other Object. More... | |
_Bool | isKindOfClass (const Object *self, const Class *clazz) |
Tests for Class hierarchy membership. More... | |
Protected Attributes | |
DataInterface * | interface |
The interface. More... | |
![]() | |
ObjectInterface * | interface |
The interface. More... | |
DataDestructor Data::destroy |
Class * _Data | ( | void | ) |
The Data archetype.
Definition at line 283 of file Data.c.
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 109 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 118 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 127 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 136 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 174 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. MutableData * mutableCopy | ( | const Data * | self | ) |
self | The Data. |
Definition at line 223 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 232 of file Data.c.