Simple C Expat Wrapper (SCEW)  1.1.7
Files | Functions
Search

Search for list items. More...

Files

file  list.h
 SCEW general list implementation.
 

Functions

SCEW_API scew_listscew_list_index (scew_list *list, unsigned int index)
 Gets the list item at the given index. More...
 
SCEW_API scew_listscew_list_find (scew_list *list, void *data)
 Finds the first list item that contains data. More...
 
SCEW_API scew_listscew_list_find_custom (scew_list *list, void const *data, scew_cmp_hook hook)
 Finds the first list item that matches the given predicate, hook. More...
 

Detailed Description

Search for list items.

Function Documentation

SCEW_API scew_list* scew_list_index ( scew_list list,
unsigned int  index 
)

Gets the list item at the given index.

Precondition
list != NULL
Returns
the list item at index, or NULL if list does not contain sufficient items.
SCEW_API scew_list* scew_list_find ( scew_list list,
void *  data 
)

Finds the first list item that contains data.

Precondition
list != NULL
data != NULL
Returns
the first list item that cointains data, or NULL if data is not found.
SCEW_API scew_list* scew_list_find_custom ( scew_list list,
void const *  data,
scew_cmp_hook  hook 
)

Finds the first list item that matches the given predicate, hook.

That is, all the list will be traversed calling the comparison hook for every list item. The comparison hook takes two parameters, the first one is the data of current traversed item, the second is data.

Precondition
list != NULL
data != NULL
func != NULL
Parameters
listthe list to traverse.
datathe user data to be used as one of the arguments for the comparison.
hookthe comparison function.
Returns
the first list item that matches the predicate func, or NULL if the predicate is never true.