A Documented file. Details. More...
#include <string.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | COMPS_ListItem |
struct | COMPS_List |
Typedefs | |
typedef void(* | COMPS_ListWalkFunc )(COMPS_ListItem *, unsigned int, void *user_data) |
A Documented file. Details.
typedef void(* COMPS_ListWalkFunc)(COMPS_ListItem *, unsigned int, void *user_data) |
comps_list_walk callback function
COMPS_ListItem | curently processed list item |
unsigned int | curently processed item position in list |
user_data | passed user data from comps_list_walk |
char comps_list_append | ( | COMPS_List * | dl, |
COMPS_ListItem * | di | ||
) |
Append item to the end of list
dl | COMPS_List object |
di | COMPS_ListItem object |
COMPS_ListItem* comps_list_at | ( | COMPS_List * | dl, |
unsigned int | pos | ||
) |
Return list item at specified position
dl | COMPS_List object |
pos | specified position |
void comps_list_clear | ( | COMPS_List * | dl | ) |
Clear the list (destroy items) and reinit list
dl | COMPS_List object |
COMPS_List* comps_list_create | ( | ) |
COMPS_List constructor
void comps_list_destroy | ( | COMPS_List ** | dl | ) |
COMPS_List destructor destroy the list and set it's reference to NULL
dl | reference to COMPS_List object |
unsigned comps_list_init | ( | COMPS_List * | dl | ) |
Init the list. Set first and last item to NULL and zero list len
@dl | COMPS_List object |
void comps_list_insert | ( | COMPS_List * | dl, |
COMPS_ListItem * | di, | ||
unsigned int | pos | ||
) |
Insert list item to specified position to list. If position doesn't exists (list has'nt enough items) do nothing
dl | COMPS_List object |
di | COMPS_ListItem object |
pos | position to insert in |
COMPS_ListItem* comps_list_item_create | ( | void * | data, |
void *(*)(void *data) | data_constructor, | ||
void(*)(void *data) | data_destructor | ||
) |
COMPS_ListItem constructor
data | useful data in item |
data_constructor | pointer to function creating data from existing data object |
data_destructor | pointer to function called when destroying/clearing list item/list |
void comps_list_item_destroy | ( | COMPS_ListItem * | item | ) |
COMPS_ListItem destructor (destroy item and its data)
item | COMPS_ListItem object |
COMPS_ListItem* comps_list_pop | ( | COMPS_List * | dl | ) |
Remove and return last item of list(do not destroying it)
dl | COMPS_List object |
char comps_list_remove_data | ( | COMPS_List * | dl, |
void * | data | ||
) |
Remove first occurence of data in list
dl | COMPS_List object |
data | removed data |
void comps_list_remove_item | ( | COMPS_List * | dl, |
COMPS_ListItem * | it | ||
) |
Remove specified list item form list(Do not destroying it)
dl | COMPS_List object |
it | COMPS_ListItem object |
void comps_list_remove_pos | ( | COMPS_List * | dl, |
unsigned int | pos | ||
) |
Remove and destroy item at specified pos
dl | COMPS_List object |
pos | item position in list |
COMPS_ListItem* comps_list_shift | ( | COMPS_List * | dl | ) |
Remove and return first item of list(do not destroing it)
dl | COMPS_List object |
void comps_list_walk | ( | COMPS_List * | dl, |
COMPS_ListWalkFunc | func, | ||
void * | user_data | ||
) |
Apply func to all items in list
dl | COMPS_List object |
func | pointer to user specified function |
user_data | user data passed to func function |