anx_list.h File Reference

A doubly linked list. More...

#include <annodex/anx_core.h>

Go to the source code of this file.

Data Structures

struct  _AnxList

Typedefs

typedef struct _AnxList AnxList
 A doubly linked list.

Functions

AnxListanx_list_new (void)
 Create a new list.
AnxListanx_list_clone (AnxList *list)
 Clone a list using the default clone function.
AnxListanx_list_clone_with (AnxList *list, AnxCloneFunc clone)
 Clone a list using a custom clone function.
AnxListanx_list_tail (AnxList *list)
 Return the tail element of a list.
AnxListanx_list_prepend (AnxList *list, void *data)
 Prepend a new node to a list containing given data.
AnxListanx_list_append (AnxList *list, void *data)
 Append a new node to a list containing given data.
AnxListanx_list_add_before (AnxList *list, void *data, AnxList *node)
 Add a new node containing given data before a given node.
AnxListanx_list_add_after (AnxList *list, void *data, AnxList *node)
 Add a new node containing given data after a given node.
AnxListanx_list_find (AnxList *list, void *data)
 Find the first node containing given data in a list.
AnxListanx_list_remove (AnxList *list, AnxList *node)
 Remove a node from a list.
int anx_list_length (AnxList *list)
 Query the number of items in a list.
int anx_list_is_empty (AnxList *list)
 Query if a list is empty, ie.
int anx_list_is_singleton (AnxList *list)
 Query if the list is singleton, ie.
AnxListanx_list_free_with (AnxList *list, AnxFreeFunc free_func)
 Free a list, using a given function to free each data element.
AnxListanx_list_free (AnxList *list)
 Free a list, using anx_free() to free each data element.


Detailed Description

A doubly linked list.


Function Documentation

AnxList* anx_list_add_after ( AnxList list,
void *  data,
AnxList 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

AnxList* anx_list_add_before ( AnxList list,
void *  data,
AnxList 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)

AnxList* anx_list_append ( AnxList 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

AnxList* anx_list_clone ( AnxList list  ) 

Clone a list using the default clone function.

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

AnxList* anx_list_clone_with ( AnxList list,
AnxCloneFunc  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

AnxList* anx_list_find ( AnxList 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

AnxList* anx_list_free ( AnxList list  ) 

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

Parameters:
list the list
Returns:
NULL on success

AnxList* anx_list_free_with ( AnxList list,
AnxFreeFunc  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

int anx_list_is_empty ( AnxList 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 anx_list_is_singleton ( AnxList 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

int anx_list_length ( AnxList list  ) 

Query the number of items in a list.

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

AnxList* anx_list_new ( void   ) 

Create a new list.

Returns:
a new list

AnxList* anx_list_prepend ( AnxList 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

AnxList* anx_list_remove ( AnxList list,
AnxList 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)

AnxList* anx_list_tail ( AnxList list  ) 

Return the tail element of a list.

Parameters:
list the list
Returns:
the tail element


Generated on Wed Feb 25 08:43:22 2009 for libannodex by  doxygen 1.5.8