libcstl
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
slist.h File Reference

Go to the source code of this file.

Data Structures

struct  cstl_slist_node
 Node to anchor an element within a list. More...
 
struct  cstl_slist
 List object. More...
 

Macros

#define CSTL_SLIST_INITIALIZER(NAME, TYPE, MEMB)
 Constant initialization of a slist object.
 
#define DECLARE_CSTL_SLIST(NAME, TYPE, MEMB)    struct cstl_slist NAME = CSTL_SLIST_INITIALIZER(NAME, TYPE, MEMB)
 (Statically) declare and initialize a list
 

Functions

static void cstl_slist_init (struct cstl_slist *const sl, const size_t off)
 Initialize a slist object.
 
static size_t cstl_slist_size (const struct cstl_slist *sl)
 Get the number of objects in the list.
 
void cstl_slist_insert_after (struct cstl_slist *sl, void *before, void *obj)
 Insert a new object into the list.
 
void * cstl_slist_erase_after (struct cstl_slist *sl, void *bef)
 Remove an object from the list.
 
void cstl_slist_push_front (struct cstl_slist *sl, void *obj)
 Insert a new object at the front of the list.
 
void cstl_slist_push_back (struct cstl_slist *sl, void *obj)
 Insert a new object at the back of the list.
 
void * cstl_slist_pop_front (struct cstl_slist *sl)
 Remove the first item in the list and return it.
 
void * cstl_slist_front (const struct cstl_slist *sl)
 Get a pointer to the first object in the list.
 
void * cstl_slist_back (const struct cstl_slist *sl)
 Get a pointer to the last object in the list.
 
void cstl_slist_reverse (struct cstl_slist *sl)
 Reverse the order of items in the list.
 
void cstl_slist_sort (struct cstl_slist *sl, cstl_compare_func_t *cmp, void *priv)
 Sort the items in a list.
 
void cstl_slist_concat (struct cstl_slist *list, struct cstl_slist *more)
 Append one list to the end of another.
 
int cstl_slist_foreach (struct cstl_slist *sl, cstl_visit_func_t *visit, void *priv)
 Call a user-supplied function for each object in a list.
 
void cstl_slist_clear (struct cstl_slist *sl, cstl_xtor_func_t *clr)
 Remove objects from and reinitialize a list.
 
void cstl_slist_swap (struct cstl_slist *const a, struct cstl_slist *const b)
 Swap the list objects at the two given locations.