libcmutils 0.6.5
Multi-platform C99 utility library
Loading...
Searching...
No Matches
CMUTIL_List Struct Reference

A doubly linked list type. More...

Data Fields

void(* AddFront )(CMUTIL_List *list, void *data)
 Add an item to the front of the list.
 
void(* AddTail )(CMUTIL_List *list, void *data)
 Add an item to the tail of the list.
 
void *(* GetFront )(const CMUTIL_List *list)
 Get the item at the front of the list.
 
void *(* GetTail )(const CMUTIL_List *list)
 Get the item at the tail of the list.
 
void *(* RemoveFront )(CMUTIL_List *list)
 Remove and return the item at the front of the list.
 
void *(* RemoveTail )(CMUTIL_List *list)
 Remove and return the item at the tail of the list.
 
void *(* Remove )(CMUTIL_List *list, void *data)
 Remove a specific item from the list.
 
size_t(* GetSize )(const CMUTIL_List *list)
 Get the size of the list.
 
CMUTIL_Iterator *(* Iterator )(const CMUTIL_List *list)
 Get an iterator for the list.
 
void(* Destroy )(CMUTIL_List *list)
 Destroy the list and free its resources.
 
void(* MoveAll )(CMUTIL_List *dst, CMUTIL_List *src)
 Move all items from one list to another.
 

Detailed Description

A doubly linked list type.

Field Documentation

◆ AddFront

void(* CMUTIL_List::AddFront) (CMUTIL_List *list, void *data)

Add an item to the front of the list.

This function inserts a new item at the beginning of the list. Ownership of the data is transferred to the list.

Parameters
listThe list to which the item will be added.
dataThe data to be added to the front of the list.

◆ AddTail

void(* CMUTIL_List::AddTail) (CMUTIL_List *list, void *data)

Add an item to the tail of the list.

This function appends a new item at the end of the list. Ownership of the data is transferred to the list.

Parameters
listThe list to which the item will be added.
dataThe data to be added to the tail of the list.

◆ GetFront

void *(* CMUTIL_List::GetFront) (const CMUTIL_List *list)

Get the item at the front of the list.

This function retrieves the data at the front of the list without removing it. Ownership of the data remains with the list.

Parameters
listThe list from which the item will be retrieved.
Returns
The data at the front of the list, or NULL if the list is empty.

◆ GetTail

void *(* CMUTIL_List::GetTail) (const CMUTIL_List *list)

Get the item at the tail of the list.

This function retrieves the data at the end of the list without removing it. Ownership of the data remains with the list.

Parameters
listThe list from which the item will be retrieved.
Returns
The data at the tail of the list, or NULL if the list is empty.

◆ RemoveFront

void *(* CMUTIL_List::RemoveFront) (CMUTIL_List *list)

Remove and return the item at the front of the list.

This function removes the item at the beginning of the list and returns its data. Ownership of the data is transferred to the caller.

Parameters
listThe list from which the item will be removed.
Returns
The data of the removed item, or NULL if the list is empty.

◆ RemoveTail

void *(* CMUTIL_List::RemoveTail) (CMUTIL_List *list)

Remove and return the item at the tail of the list.

This function removes the item at the end of the list and returns its data. Ownership of the data is transferred to the caller.

Parameters
listThe list from which the item will be removed.
Returns
The data of the removed item, or NULL if the list is empty.

◆ Remove

void *(* CMUTIL_List::Remove) (CMUTIL_List *list, void *data)

Remove a specific item from the list.

This function searches for the specified data in the list, removes it if found, and returns the data. Ownership of the data is transferred to the caller.

Parameters
listThe list from which the item will be removed.
dataThe data to be removed from the list.
Returns
The data of the removed item, or NULL if the item was not found

◆ GetSize

size_t(* CMUTIL_List::GetSize) (const CMUTIL_List *list)

Get the size of the list.

This function returns the number of items currently in the list.

Parameters
listThe list whose size will be retrieved.
Returns
The number of items in the list.

◆ Iterator

CMUTIL_Iterator *(* CMUTIL_List::Iterator) (const CMUTIL_List *list)

Get an iterator for the list.

This function returns an iterator that can be used to traverse the items in the list. The caller is responsible for destroying the iterator after use.

Parameters
listThe list for which the iterator will be created.
Returns
An iterator for the list.

◆ Destroy

void(* CMUTIL_List::Destroy) (CMUTIL_List *list)

Destroy the list and free its resources.

This function frees all resources associated with the list. If the list was created with a freecb function, it will be called for each item in the list to free any additional memory.

Parameters
listThe list to be destroyed.

◆ MoveAll

void(* CMUTIL_List::MoveAll) (CMUTIL_List *dst, CMUTIL_List *src)

Move all items from one list to another.

This function moves all items from the source list to the destination list. The source list will be empty after the operation.

Parameters
dstThe destination list to which items will be moved.
srcThe source list from which items will be moved.

The documentation for this struct was generated from the following file: