Desktop Apps Training -
Policy Kit
|
Doubly-linked lists — Doubly-linked lists | | Synopsis
KitList; kit_bool_t (*KitListForeachFunc) (KitList *list, void *data, void *user_data); KitList* kit_list_append (KitList *list, void *data); KitList* kit_list_prepend (KitList *list, void *data); void kit_list_free (KitList *list); KitList* kit_list_delete_link (KitList *list, KitList *link); size_t kit_list_length (KitList *list); kit_bool_t kit_list_foreach (KitList *list, KitListForeachFunc func, void *user_data);
Description This class provides support for doubly-linked lists. Details KitList typedef struct { void *data; KitList *next; KitList *prev; } KitList;
Public members of the KitList data structure void *data; | the value passed in kit_list_append() and kit_list_prepend() | KitList *next; | the next element in the list or NULL if this is the last element | KitList *prev; | the previous element in the list or NULL if this is the last element | KitListForeachFunc () kit_bool_t (*KitListForeachFunc) (KitList *list, void *data, void *user_data); Type signature for callback function used in kit_list_foreach(). list : | the list | data : | data of link entry | user_data : | user data passed to kit_list_foreach() | Returns : | Return TRUE to short-circuit, e.g. stop the iteration. | kit_list_append () KitList* kit_list_append (KitList *list, void *data); Append an entry to a list. list : | existing list or NULL to create a new list | data : | data to append to the list | Returns : | the head of the new list or NULL on OOM | kit_list_prepend () KitList* kit_list_prepend (KitList *list, void *data); Prepend an entry to a list. list : | existing list or NULL to create a new list | data : | data to prepend to the list | Returns : | the head of the new list or NULL on OOM | kit_list_free () void kit_list_free (KitList *list); Frees all links in a list kit_list_delete_link () KitList* kit_list_delete_link (KitList *list, KitList *link); Delete a link from a list. list : | existing list, cannot be NULL | link : | link to delete, cannot be NULL | Returns : | the new head of the list or NULL if the list is empty after deletion. | kit_list_length () size_t kit_list_length (KitList *list); Compute the length of a list. list : | the list | Returns : | Number of entries in list | kit_list_foreach () kit_bool_t kit_list_foreach (KitList *list, KitListForeachFunc func, void *user_data); Iterate over all entries in a list. list : | the list | func : | callback function | user_data : | user data to pass to callback | Returns : | TRUE only if the callback short-circuited the iteration |
|