xlist.h File Reference

Go to the source code of this file.

Data Structures

struct  _XList

Typedefs

typedef struct _XList XList
 A doubly linked list.
typedef void *(* XCloneFunc )(void *data)
 Signature of a cloning function.
typedef void *(* XFreeFunc )(void *data)
 Signature of a freeing function.

Functions

XListxlist_new (void)
 Create a new list.
XListxlist_clone (XList *list)
 Clone a list using the default clone function.
XListxlist_clone_with (XList *list, XCloneFunc clone)
 Clone a list using a custom clone function.
XListxlist_tail (XList *list)
 Return the tail element of a list.
XListxlist_prepend (XList *list, void *data)
 Prepend a new node to a list containing given data.
XListxlist_append (XList *list, void *data)
 Append a new node to a list containing given data.
XListxlist_add_before (XList *list, void *data, XList *node)
 Add a new node containing given data before a given node.
XListxlist_add_after (XList *list, void *data, XList *node)
 Add a new node containing given data after a given node.
XListxlist_find (XList *list, void *data)
 Find the first node containing given data in a list.
XListxlist_remove (XList *list, XList *node)
 Remove a node from a list.
int xlist_length (XList *list)
 Query the number of items in a list.
int xlist_is_empty (XList *list)
 Query if a list is empty, ie.
int xlist_is_singleton (XList *list)
 Query if the list is singleton, ie.
XListxlist_free_with (XList *list, XFreeFunc free_func)
 Free a list, using a given function to free each data element.
XListxlist_free (XList *list)
 Free a list, using anx_free() to free each data element.


Typedef Documentation

typedef void*(* XCloneFunc)(void *data)

Signature of a cloning function.

typedef void*(* XFreeFunc)(void *data)

Signature of a freeing function.

typedef struct _XList XList

A doubly linked list.


Function Documentation

XList* xlist_add_after ( XList list,
void *  data,
XList node 
)

Add a new node containing given data after a given node.

Parameters:
list the list
data the data element of the newly created node
node the node after which to add the newly created node
Returns:
the head of the list

References _XList::next, _XList::prev, xlist_node_new(), and xlist_prepend().

XList* xlist_add_before ( XList list,
void *  data,
XList node 
)

Add a new node containing given data before a given node.

Parameters:
list the list
data the data element of the newly created node
node the node before which to add the newly created node
Returns:
the head of the list (which may have changed)

References _XList::next, _XList::prev, xlist_append(), xlist_node_new(), and xlist_prepend().

XList* xlist_append ( XList list,
void *  data 
)

Append a new node to a list containing given data.

Parameters:
list the list
data the data element of the newly created node
Returns:
the head of the list

References _XList::next, _XList::prev, xlist_node_new(), and xlist_tail().

Referenced by xlist_add_before(), xlist_clone(), xlist_clone_with(), xtag_new_parse(), and xtag_parse_tag().

XList* xlist_clone ( XList list  ) 

Clone a list using the default clone function.

Parameters:
list the list to clone
Returns:
a newly cloned list

References _XList::data, _XList::next, xlist_append(), and xlist_new().

Referenced by xlist_clone_with().

XList* xlist_clone_with ( XList list,
XCloneFunc  clone 
)

Clone a list using a custom clone function.

Parameters:
list the list to clone
clone the function to use to clone a list item
Returns:
a newly cloned list

References _XList::data, _XList::next, xlist_append(), xlist_clone(), and xlist_new().

XList* xlist_find ( XList list,
void *  data 
)

Find the first node containing given data in a list.

Parameters:
list the list
data the data element to find
Returns:
the first node containing given data, or NULL if it is not found

References _XList::data, and _XList::next.

XList* xlist_free ( XList list  ) 

Free a list, using anx_free() to free each data element.

Parameters:
list the list
Returns:
NULL on success

References _XList::next.

Referenced by xtag_free().

XList* xlist_free_with ( XList list,
XFreeFunc  free_func 
)

Free a list, using a given function to free each data element.

Parameters:
list the list
free_func a function to free each data element
Returns:
NULL on success

References _XList::data, and _XList::next.

int xlist_is_empty ( XList list  ) 

Query if a list is empty, ie.

contains no items

Parameters:
list the list
Returns:
1 if the list is empty, 0 otherwise

int xlist_is_singleton ( XList list  ) 

Query if the list is singleton, ie.

contains exactly one item

Parameters:
list the list
Returns:
1 if the list is singleton, 0 otherwise

References _XList::next.

int xlist_length ( XList list  ) 

Query the number of items in a list.

Parameters:
list the list
Returns:
the number of nodes in the list

References c, and _XList::next.

XList* xlist_new ( void   ) 

Create a new list.

Returns:
a new list

Referenced by xlist_clone(), and xlist_clone_with().

XList* xlist_prepend ( XList list,
void *  data 
)

Prepend a new node to a list containing given data.

Parameters:
list the list
data the data element of the newly created node
Returns:
the new list head

References _XList::next, _XList::prev, and xlist_node_new().

Referenced by xlist_add_after(), and xlist_add_before().

XList* xlist_remove ( XList list,
XList node 
)

Remove a node from a list.

Parameters:
list the list
node the node to remove
Returns:
the head of the list (which may have changed)

References _XList::next, and _XList::prev.

XList* xlist_tail ( XList list  ) 

Return the tail element of a list.

Parameters:
list the list
Returns:
the tail element

References _XList::next.

Referenced by xlist_append().


Generated on Wed Mar 31 08:05:39 2010 for VLC by  doxygen 1.5.6