mUPnP for C
|
#include <mupnp/typedef.h>
Data Structures | |
struct | _mUpnpList |
The generic list interface in mUPnP. More... | |
Macros | |
#define | MUPNP_LIST_STRUCT_MEMBERS |
#define | mupnp_list_gets(headList) |
Typedefs | |
typedef void(* | MUPNP_LIST_DESTRUCTORFUNC) (void *) |
typedef struct _mUpnpList | mUpnpList |
The generic list interface in mUPnP. | |
Functions | |
void | mupnp_list_header_init (mUpnpList *list) |
void | mupnp_list_node_init (mUpnpList *list) |
void | mupnp_list_insert (mUpnpList *prevList, mUpnpList *list) |
void | mupnp_list_add (mUpnpList *headList, mUpnpList *list) |
void | mupnp_list_remove (mUpnpList *list) |
int | mupnp_list_size (mUpnpList *headList) |
mUpnpList * | mupnp_list_get (mUpnpList *headList, int index) |
mUpnpList * | mupnp_list_prev_circular (mUpnpList *list) |
mUpnpList * | mupnp_list_prev (mUpnpList *list) |
mUpnpList * | mupnp_list_next_circular (mUpnpList *list) |
mUpnpList * | mupnp_list_next (mUpnpList *list) |
void | mupnp_list_clear (mUpnpList *headList, MUPNP_LIST_DESTRUCTORFUNC destructorFunc) |
#define mupnp_list_gets | ( | headList | ) |
Get the first actual item from a list for iteration
headList | List header |
#define MUPNP_LIST_STRUCT_MEMBERS |
Macro for list node members
typedef void(* MUPNP_LIST_DESTRUCTORFUNC) (void *) |
Prototype for individual list node destructor functions
typedef struct _mUpnpList mUpnpList |
The generic list interface in mUPnP.
Each struct in mUPnP, that is designed to be a part of a list, must have these elements in their definition before the actual struct definition. The struct pointers are then cast to mUpnpList* and operated with mupnp_list_* functions.
This works essentially like insert, although it is more error-prone?!
There might be a bug in this function.
void mupnp_list_clear | ( | mUpnpList * | headList, |
MUPNP_LIST_DESTRUCTORFUNC | destructorFunc ) |
Clear the list and delete all of its contents with MUPNP_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 |
void mupnp_list_header_init | ( | mUpnpList * | 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 |
void mupnp_list_node_init | ( | mUpnpList * | 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 |
void mupnp_list_remove | ( | mUpnpList * | 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 |
int mupnp_list_size | ( | mUpnpList * | 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 |