Functions | |
cx_list_iterator | cx_list_begin (const cx_list *list) |
Get an iterator for the first list element. | |
cx_list_iterator | cx_list_end (const cx_list *list) |
Get an iterator for the position after the last list element. | |
cx_list_iterator | cx_list_next (const cx_list *list, cx_list_const_iterator position) |
Get an iterator for the next list element. | |
cx_list_iterator | cx_list_previous (const cx_list *list, cx_list_const_iterator position) |
Get an iterator for the previous list element. | |
void | cx_list_clear (cx_list *list) |
Remove all elements from a list. | |
cxbool | cx_list_empty (const cx_list *list) |
Check whether a list is empty. | |
cx_list * | cx_list_new (void) |
Create a new list without any elements. | |
void | cx_list_delete (cx_list *list) |
Destroy a list. | |
void | cx_list_destroy (cx_list *list, cx_free_func deallocate) |
Destroy a list and all its elements. | |
cxsize | cx_list_size (const cx_list *list) |
Get the actual number of list elements. | |
cxsize | cx_list_max_size (const cx_list *list) |
Get the maximum number of list elements possible. | |
void | cx_list_swap (cx_list *list1, cx_list *list2) |
Swap the data of two lists. | |
cxptr | cx_list_assign (cx_list *list, cx_list_iterator position, cxcptr data) |
Assign data to a list element. | |
cxptr | cx_list_front (const cx_list *list) |
Get the first element of a list. | |
cxptr | cx_list_back (const cx_list *list) |
Get the last element of a list. | |
cxptr | cx_list_get (const cx_list *list, cx_list_const_iterator position) |
Get the data at a given iterator position. | |
cx_list_iterator | cx_list_insert (cx_list *list, cx_list_iterator position, cxcptr data) |
Insert data into a list at a given iterator position. | |
void | cx_list_push_front (cx_list *list, cxcptr data) |
Insert data at the beginning of a list. | |
void | cx_list_push_back (cx_list *list, cxcptr data) |
Append data at the end of a list. | |
cx_list_iterator | cx_list_erase (cx_list *list, cx_list_iterator position, cx_free_func deallocate) |
Erase a list element. | |
cxptr | cx_list_extract (cx_list *list, cx_list_iterator position) |
Extract a list element. | |
cxptr | cx_list_pop_front (cx_list *list) |
Remove the first list element. | |
cxptr | cx_list_pop_back (cx_list *list) |
Remove the last element of a list. | |
void | cx_list_remove (cx_list *list, cxcptr data) |
Remove all elements with a given value from a list. | |
void | cx_list_unique (cx_list *list, cx_compare_func compare) |
Remove duplicates of consecutive elements. | |
void | cx_list_splice (cx_list *tlist, cx_list_iterator position, cx_list *slist, cx_list_iterator first, cx_list_iterator last) |
Move a range of list elements in front of a given position. | |
void | cx_list_merge (cx_list *list1, cx_list *list2, cx_compare_func compare) |
Merge two sorted lists. | |
void | cx_list_sort (cx_list *list, cx_compare_func compare) |
Sort all elements of a list using the given comparison function. | |
void | cx_list_reverse (cx_list *list) |
Reverse the order of all list elements. |
#include <cxlist.h>
cxptr cx_list_assign | ( | cx_list * | list, | |
cx_list_iterator | position, | |||
cxcptr | data | |||
) |
Assign data to a list element.
list | A list. | |
position | List position where the data will be stored | |
data | Data to store. |
cxptr cx_list_back | ( | const cx_list * | list | ) |
Get the last element of a list.
list | The list to query. |
cx_list_iterator cx_list_begin | ( | const cx_list * | list | ) |
Get an iterator for the first list element.
list | A list. |
void cx_list_clear | ( | cx_list * | list | ) |
Remove all elements from a list.
list | List to be cleared. |
void cx_list_delete | ( | cx_list * | list | ) |
Destroy a list.
list | The list to delete. |
void cx_list_destroy | ( | cx_list * | list, | |
cx_free_func | deallocate | |||
) |
Destroy a list and all its elements.
list | List container to destroy. | |
deallocate | Data deallocator. |
cxbool cx_list_empty | ( | const cx_list * | list | ) |
Check whether a list is empty.
list | A list. |
TRUE
if the list is empty, and FALSE
otherwise.
return (cx_list_size(list) == 0);
cx_list_iterator cx_list_end | ( | const cx_list * | list | ) |
Get an iterator for the position after the last list element.
list | A list. |
cx_list_iterator cx_list_erase | ( | cx_list * | list, | |
cx_list_iterator | position, | |||
cx_free_func | deallocate | |||
) |
Erase a list element.
list | The list to update. | |
position | List iterator position. | |
deallocate | Data deallocator. |
cxptr cx_list_extract | ( | cx_list * | list, | |
cx_list_iterator | position | |||
) |
Extract a list element.
list | A list. | |
position | List iterator position. |
cxptr cx_list_front | ( | const cx_list * | list | ) |
Get the first element of a list.
list | The list to query. |
cxptr cx_list_get | ( | const cx_list * | list, | |
cx_list_const_iterator | position | |||
) |
Get the data at a given iterator position.
list | A list. | |
position | List position the data is retrieved from. |
cx_list_iterator cx_list_insert | ( | cx_list * | list, | |
cx_list_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_list_max_size | ( | const cx_list * | list | ) |
Get the maximum number of list elements possible.
list | A list. |
void cx_list_merge | ( | cx_list * | list1, | |
cx_list * | 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_list* cx_list_new | ( | void | ) |
Create a new list without any elements.
cx_list_iterator cx_list_next | ( | const cx_list * | list, | |
cx_list_const_iterator | position | |||
) |
Get an iterator for the next list element.
list | A list. | |
position | Current iterator position. |
cxptr cx_list_pop_back | ( | cx_list * | list | ) |
Remove the last element of a list.
list | The list to update. |
It is equivalent to the statement
cx_list_extract(list, cx_list_previous(list, cx_list_end(list)));
cxptr cx_list_pop_front | ( | cx_list * | list | ) |
Remove the first list element.
list | The list to update. |
It is equivalent to the statement
cx_list_extract(list, cx_list_begin(list));
cx_list_iterator cx_list_previous | ( | const cx_list * | list, | |
cx_list_const_iterator | position | |||
) |
Get an iterator for the previous list element.
list | A list. | |
position | Current iterator position. |
void cx_list_push_back | ( | cx_list * | 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_list_insert(list, cx_list_end(list), data);
void cx_list_push_front | ( | cx_list * | 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_list_insert(list, cx_list_begin(list), data);
void cx_list_remove | ( | cx_list * | list, | |
cxcptr | data | |||
) |
Remove all elements with a given value from a list.
list | A list object. | |
data | Data to remove. |
void cx_list_reverse | ( | cx_list * | list | ) |
Reverse the order of all list elements.
list | The list to reverse. |
cxsize cx_list_size | ( | const cx_list * | list | ) |
Get the actual number of list elements.
list | A list. |
void cx_list_sort | ( | cx_list * | 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_list_splice | ( | cx_list * | tlist, | |
cx_list_iterator | position, | |||
cx_list * | slist, | |||
cx_list_iterator | first, | |||
cx_list_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_list_swap | ( | cx_list * | list1, | |
cx_list * | list2 | |||
) |
Swap the data of two lists.
list1 | First list. | |
list2 | Second list. |
void cx_list_unique | ( | cx_list * | list, | |
cx_compare_func | compare | |||
) |
Remove duplicates of consecutive elements.
list | A list. | |
compare | Function comparing the list elements. |