client-c
0.6.3
|
Go to the source code of this file.
Typedefs | |
typedef struct kaa_list_t | kaa_list_t |
typedef bool(* | match_predicate )(void *data, void *context) |
typedef void(* | deallocate_list_data )(void *) |
typedef void(* deallocate_list_data)(void *) |
Use to deallocate list node data.
Definition at line 38 of file kaa_list.h.
typedef struct kaa_list_t kaa_list_t |
Definition at line 28 of file kaa_list.h.
typedef bool(* match_predicate)(void *data, void *context) |
Return 0 if data doesn't match search criteria.
Definition at line 33 of file kaa_list.h.
kaa_list_t* kaa_list_create | ( | void * | data | ) |
Creates list with 1 element having given data. Returns iterator to the head of created list.
void kaa_list_destroy | ( | kaa_list_t * | head, |
deallocate_list_data | deallocator | ||
) |
Frees data occupied by list, deallocates data from the list using given deallocator.
void kaa_list_destroy_no_data_cleanup | ( | void * | head | ) |
Frees data occupied by list, data will not be deallocated.
kaa_list_t* kaa_list_find_last | ( | kaa_list_t * | from, |
match_predicate | pred, | ||
void * | context | ||
) |
Returns last element in list from given position where ((*pred)(data, context) != 0). If nothing matched given criteria or list is empty NULL is returned.
kaa_list_t* kaa_list_find_next | ( | kaa_list_t * | from, |
match_predicate | pred, | ||
void * | context | ||
) |
Returns first element in list from given position where ((*pred)(data, context) != 0). If nothing matched given criteria or list is empty NULL is returned.
void* kaa_list_get_data | ( | kaa_list_t * | position | ) |
Returns data on current list position.
ssize_t kaa_list_get_size | ( | kaa_list_t * | position | ) |
Returns size of the list.
bool kaa_list_has_next | ( | kaa_list_t * | position | ) |
Checks if there is an element after current position.
kaa_list_t* kaa_list_insert_after | ( | kaa_list_t * | position, |
void * | data | ||
) |
Insert data after a given iterator. Returns iterator to an inserted item in list.
kaa_list_t* kaa_list_next | ( | kaa_list_t * | position | ) |
Returns next element.
kaa_list_t* kaa_list_push_back | ( | kaa_list_t * | head, |
void * | data | ||
) |
Adds new element to the end of the list.
kaa_list_t* kaa_list_push_front | ( | kaa_list_t * | head, |
void * | data | ||
) |
Adds new element to the begin of the list, returns new list head.
kaa_list_t* kaa_list_remove_at | ( | kaa_list_t ** | head, |
kaa_list_t * | position, | ||
deallocate_list_data | deallocator | ||
) |
Removes element from list at given position. Position must be valid iterator to the element in the given list. Deallocates released data using given deallocator. Returns iterator pointing to the position before removed element, pointer to the head of the list if (*head == position) or NULL if the position was not found.
kaa_error_t kaa_list_remove_first | ( | kaa_list_t ** | head, |
match_predicate | pred, | ||
void * | context, | ||
deallocate_list_data | deallocator | ||
) |
Removes first element that is matched by predicate. Returns KAA_ERR_NONE if element was found.
void kaa_list_set_data_at | ( | kaa_list_t * | position, |
void * | data, | ||
deallocate_list_data | deallocator | ||
) |
Inserts data into the given position. Deallocates memory occupied by previous data using given deallocator.
kaa_list_t* kaa_list_split_after | ( | kaa_list_t * | head, |
kaa_list_t * | after, | ||
kaa_list_t ** | tail | ||
) |
kaa_list_t* kaa_lists_merge | ( | kaa_list_t * | list1, |
kaa_list_t * | list2 | ||
) |
Adds all elements of list2 to the end of list1. Returns iterator to the beginning of the inserted elements