Functions | |
cx_slist_iterator | cx_slist_begin (const cx_slist *list) |
Get list iterator to the beginning of a list. | |
cx_slist_iterator | cx_slist_end (const cx_slist *list) |
Get a list iterator to the end of a list. | |
cx_slist_iterator | cx_slist_next (const cx_slist *list, cx_slist_const_iterator position) |
Get a list iterator to the next list element. | |
void | cx_slist_clear (cx_slist *list) |
Remove all elements from a list. | |
cxbool | cx_slist_empty (const cx_slist *list) |
Check whether a list is empty. | |
cx_slist * | cx_slist_new (void) |
Create a new list without any elements. | |
void | cx_slist_delete (cx_slist *list) |
Destroy a list. | |
void | cx_slist_destroy (cx_slist *list, cx_free_func deallocate) |
Destroy a list and all its elements. | |
cxsize | cx_slist_size (const cx_slist *list) |
Get the actual number of list elements. | |
cxsize | cx_slist_max_size (const cx_slist *list) |
Get the maximum number of list elements possible. | |
void | cx_slist_swap (cx_slist *list1, cx_slist *list2) |
Swap the data of two lists. | |
cxptr | cx_slist_assign (cx_slist *list, cx_slist_iterator position, cxcptr data) |
Assign data to a list position. | |
cxptr | cx_slist_front (const cx_slist *list) |
Get the first element of a list. | |
cxptr | cx_slist_back (const cx_slist *list) |
Get the last element of a list. | |
cxptr | cx_slist_get (const cx_slist *list, cx_slist_const_iterator position) |
Get the data at a given iterator position. | |
cx_slist_iterator | cx_slist_insert (cx_slist *list, cx_slist_iterator position, cxcptr data) |
Insert data into a list at a given iterator position. | |
void | cx_slist_push_front (cx_slist *list, cxcptr data) |
Insert data at the beginning of a list. | |
void | cx_slist_push_back (cx_slist *list, cxcptr data) |
Append data at the end of a list. | |
cx_slist_iterator | cx_slist_erase (cx_slist *list, cx_slist_iterator position, cx_free_func deallocate) |
Erase a list list element. | |
cxptr | cx_slist_extract (cx_slist *list, cx_slist_iterator position) |
Extract a list element. | |
cxptr | cx_slist_pop_front (cx_slist *list) |
Remove the first list element. | |
cxptr | cx_slist_pop_back (cx_slist *list) |
Remove the last element of a list. | |
void | cx_slist_remove (cx_slist *list, cxcptr data) |
Remove all elements with a given value from a list. | |
void | cx_slist_unique (cx_slist *list, cx_compare_func compare) |
Remove duplicates of consecutive elements. | |
void | cx_slist_splice (cx_slist *tlist, cx_slist_iterator position, cx_slist *slist, cx_slist_iterator first, cx_slist_iterator last) |
Move a range of list elements in front of a given position. | |
void | cx_slist_merge (cx_slist *list1, cx_slist *list2, cx_compare_func compare) |
Merge two sorted lists. | |
void | cx_slist_sort (cx_slist *list, cx_compare_func compare) |
Sort all elements of a list using the given comparison function. | |
void | cx_slist_reverse (cx_slist *list) |
Reverse the order of all list elements. |
#include <cxslist.h>
cxptr cx_slist_assign | ( | cx_slist * | list, | |
cx_slist_iterator | position, | |||
cxcptr | data | |||
) |
Assign data to a list position.
list | A list. | |
position | List position where the data will be stored | |
data | Data to store. |
cxptr cx_slist_back | ( | const cx_slist * | list | ) |
Get the last element of a list.
list | The list to query. |
cx_slist_iterator cx_slist_begin | ( | const cx_slist * | list | ) |
Get list iterator to the beginning of a list.
list | A list. |
void cx_slist_clear | ( | cx_slist * | list | ) |
Remove all elements from a list.
list | List to be cleared. |
void cx_slist_delete | ( | cx_slist * | list | ) |
Destroy a list.
list | The list to delete. |
void cx_slist_destroy | ( | cx_slist * | list, | |
cx_free_func | deallocate | |||
) |
Destroy a list and all its elements.
list | List container to destroy. | |
deallocate | Data deallocator. |
cxbool cx_slist_empty | ( | const cx_slist * | list | ) |
Check whether a list is empty.
list | A list. |
TRUE
if the list is empty, and FALSE
otherwise.
return (cx_slist_size(list) == 0);
cx_slist_iterator cx_slist_end | ( | const cx_slist * | list | ) |
Get a list iterator to the end of a list.
list | A list. |
cx_slist_iterator cx_slist_erase | ( | cx_slist * | list, | |
cx_slist_iterator | position, | |||
cx_free_func | deallocate | |||
) |
Erase a list list element.
list | The list to update. | |
position | List iterator position. | |
deallocate | Data deallocator. |
cxptr cx_slist_extract | ( | cx_slist * | list, | |
cx_slist_iterator | position | |||
) |
Extract a list element.
list | A list. | |
position | List iterator position. |
cxptr cx_slist_front | ( | const cx_slist * | list | ) |
Get the first element of a list.
list | The list to query. |
cxptr cx_slist_get | ( | const cx_slist * | list, | |
cx_slist_const_iterator | position | |||
) |
Get the data at a given iterator position.
list | A list. | |
position | List position the data is retrieved from. |
cx_slist_iterator cx_slist_insert | ( | cx_slist * | list, | |
cx_slist_iterator | position, | |||
cxcptr | data | |||
) |
Insert data into a list at a given iterator position.
list | The list to update. | |
position | List iterator position. | |
data | Data item to insert. |
cxsize cx_slist_max_size | ( | const cx_slist * | list | ) |
Get the maximum number of list elements possible.
list | A list. |
void cx_slist_merge | ( | cx_slist * | list1, | |
cx_slist * | list2, | |||
cx_compare_func | compare | |||
) |
Merge two sorted lists.
list1 | First list to merge. | |
list2 | Second list to merge. | |
compare | Function comparing the list elements. |
The list list2 is consumed by this process, i.e. after the successful merging of the two lists, list list2 will be empty.
cx_slist* cx_slist_new | ( | void | ) |
Create a new list without any elements.
cx_slist_iterator cx_slist_next | ( | const cx_slist * | list, | |
cx_slist_const_iterator | position | |||
) |
Get a list iterator to the next list element.
list | A list. | |
position | Current iterator position. |
cxptr cx_slist_pop_back | ( | cx_slist * | list | ) |
Remove the last element of a list.
list | The list to update. |
cxptr cx_slist_pop_front | ( | cx_slist * | list | ) |
Remove the first list element.
list | The list to update. |
void cx_slist_push_back | ( | cx_slist * | list, | |
cxcptr | data | |||
) |
Append data at the end of a list.
list | The list to update. | |
data | Data to append. |
It is equivalent to the statement
cx_slist_insert(list, cx_slist_end(list), data);
void cx_slist_push_front | ( | cx_slist * | list, | |
cxcptr | data | |||
) |
Insert data at the beginning of a list.
list | The list to update. | |
data | Data to add to the list. |
It is equivalent to the statement
cx_slist_insert(list, cx_slist_begin(list), data);
void cx_slist_remove | ( | cx_slist * | list, | |
cxcptr | data | |||
) |
Remove all elements with a given value from a list.
list | A list object. | |
data | Data to remove. |
void cx_slist_reverse | ( | cx_slist * | list | ) |
Reverse the order of all list elements.
list | The list to reverse. |
cxsize cx_slist_size | ( | const cx_slist * | list | ) |
Get the actual number of list elements.
list | A list. |
void cx_slist_sort | ( | cx_slist * | list, | |
cx_compare_func | compare | |||
) |
Sort all elements of a list using the given comparison function.
list | The list to sort. | |
compare | Function comparing the list elements. |
void cx_slist_splice | ( | cx_slist * | tlist, | |
cx_slist_iterator | position, | |||
cx_slist * | slist, | |||
cx_slist_iterator | first, | |||
cx_slist_iterator | last | |||
) |
Move a range of list elements in front of a given position.
tlist | Target list. | |
position | Target iterator position. | |
slist | Source list. | |
first | Position of the first element to move. | |
last | Position of the last element to move. |
void cx_slist_swap | ( | cx_slist * | list1, | |
cx_slist * | list2 | |||
) |
Swap the data of two lists.
list1 | First list. | |
list2 | Second list. |
void cx_slist_unique | ( | cx_slist * | list, | |
cx_compare_func | compare | |||
) |
Remove duplicates of consecutive elements.
list | A list. | |
compare | Function comparing the list elements. |