|
Cyber Garage Portable Runtime (CGPR) for C
|
#include <cgpr/util/list.h>Functions | |
| bool | cg_list_header_init (CGList *list) |
| bool | cg_list_node_init (CGList *list) |
| size_t | cg_list_size (CGList *headList) |
| CGList * | cg_list_get (CGList *headList, int index) |
| bool | cg_list_insert (CGList *prevList, CGList *list) |
| bool | cg_list_add (CGList *headList, CGList *list) |
| bool | cg_list_remove (CGList *list) |
| CGList * | cg_list_prev_circular (CGList *list) |
| CGList * | cg_list_prev (CGList *list) |
| CGList * | cg_list_next_circular (CGList *list) |
| CGList * | cg_list_gets (CGList *headList) |
| CGList * | cg_list_next (CGList *list) |
| bool | cg_list_clear (CGList *headList, CG_LIST_DESTRUCTORFUNC dstructorFunc) |
This works essentially like insert, although it is more error-prone?!
There might be a bug in this function.
| bool cg_list_clear | ( | CGList * | headList, |
| CG_LIST_DESTRUCTORFUNC | destructorFunc ) |
Clear the list and delete all of its contents with CG_LIST_DESTRUCTORFUNC
| headList | List header |
| destructorFunc | Function pointer that clears the contents of individual nodes |
Get an item from the list by the item's index
| headList | List header |
| index | The index of the item to get |
Get the first actual item from a list for iteration
| headList | List header |
| bool cg_list_header_init | ( | CGList * | list | ) |
Initialize a list node to act as the first node
| list | List node |
Insert a list node or a complete list structure after the given node
| prevList | Insert after this node |
| list | List node or list structure to insert |
Get the next node. Returns NULL if end has been reached.
| list | Current node |
Get the next node. Wrap around if the end has been reached.
| list | Current node |
| bool cg_list_node_init | ( | CGList * | list | ) |
Initialize a list node to act as a regular node, part of a list.
| list | List node |
Get the previous node. Returns NULL if beginning has been reached
| list | Current node |
Get the previous node. Wrap around if the beginning has been reached.
| list | Current node |
| bool cg_list_remove | ( | CGList * | list | ) |
Remove a node from a list. Does not free any memory, but only removes the next and previous link associations regarding the given node.
| list | List node to remove |
| size_t cg_list_size | ( | CGList * | headList | ) |
Get the number of nodes in the current list structure. Counts forwards from the given node, so if you want to get the complete size, give a header node as the parameter.
| headList | List header |