c-icap-doc
0.1
|
Structure which can store lists of objects
More...
Modules | |
Vectors of strings | |
Vectors of pointers | |
Macros | |
#define | ci_vector_get(vector, i) (i < vector->count ? (const void *)vector->items[i]: (const void *)NULL) |
Return a pointer to the i item of the vector | |
Typedefs | |
typedef struct ci_vector | ci_vector_t |
The ci_vector_t objects can store a list of objects. More... | |
Functions | |
ci_vector_t * | ci_vector_create (size_t max_size) |
Allocate the required memory and initialize a ci_vector_t object More... | |
void | ci_vector_destroy (ci_vector_t *vector) |
Destroy an ci_vector_t object More... | |
void * | ci_vector_add (ci_vector_t *vector, const void *obj, size_t size) |
Add an item to the vector. More... | |
void | ci_vector_iterate (const ci_vector_t *vector, void *data, int(*fn)(void *data, const void *)) |
Run the given function for each vector item More... | |
void * | ci_vector_pop (ci_vector_t *vector) |
Delete the last element of a vector. More... | |
Structure which can store lists of objects
The ci_vector_t objects can store a list of objects.
Currently can grow up to a fixed size.
void* ci_vector_add | ( | ci_vector_t * | vector, |
const void * | obj, | ||
size_t | size | ||
) |
Add an item to the vector.
vector | a pointer to the ci_vector_t object |
obj | pointer to the object to add in vector |
size | the size of the new item. |
ci_vector_t* ci_vector_create | ( | size_t | max_size | ) |
Allocate the required memory and initialize a ci_vector_t object
max_size | the maximum memory to use |
void ci_vector_destroy | ( | ci_vector_t * | vector | ) |
Destroy an ci_vector_t object
vector | a pointer to ci_vector_t object to be destroyed |
void ci_vector_iterate | ( | const ci_vector_t * | vector, |
void * | data, | ||
int(*)(void *data, const void *) | fn | ||
) |
Run the given function for each vector item
vector | a pointer to the ci_vector_t object |
data | a pointer to data which will be passed to the fn function |
fn | a pointer to the function which will be run for each vector item. The iteration will stop if the fn function return non zero value. |
void* ci_vector_pop | ( | ci_vector_t * | vector | ) |
Delete the last element of a vector.
vector | a pointer to the ci_vector_t object |