216 return list->store_pointer;
243 return list->cl->insert_element(list, list->size, elem);
268 return list->cl->insert_array(list, list->size, array, n);
290 return list->cl->insert_element(list, index, elem);
319 return list->cl->insert_array(list, index, array, n);
342 return ((
struct cx_list_s *) iter->src_handle)->cl->insert_iter(iter, elem, 0);
365 return ((
struct cx_list_s *) iter->src_handle)->cl->insert_iter(iter, elem, 1);
383 return list->cl->remove(list, index);
396 list->cl->clear(list);
416 return list->cl->swap(list, i, j);
431 return list->cl->at(list, index);
450 return list->cl->iterator(list, index,
false);
469 return list->cl->iterator(list, index,
true);
519 return list->cl->iterator(list, 0,
false);
550 return list->cl->iterator(list, list->size - 1,
true);
583 return list->cl->find(list, elem);
595 list->cl->sort(list);
605 list->cl->reverse(list);
Common definitions for various collection implementations.
#define CX_COLLECTION_MEMBERS
Use this macro to declare common members for a collection structure.
Definition: collection.h:63
Common definitions and feature checks.
#define __attribute__(x)
Removes GNU C attributes where they are not supported.
Definition: common.h:127
CxList *const cxEmptyList
A shared instance of an empty list.
static CxMutIterator cxListMutIterator(CxList *list)
Returns a mutating iterator pointing to the first item of the list.
Definition: list.h:533
static CxIterator cxListIterator(CxList const *list)
Returns an iterator pointing to the first item of the list.
Definition: list.h:518
static bool cxListIsStoringPointers(CxList const *list)
Returns true, if this list is storing pointers instead of the actual data.
Definition: list.h:215
static int cxListInsert(CxList *list, size_t index, void const *elem)
Inserts an item at the specified index.
Definition: list.h:285
static void cxListReverse(CxList *list)
Reverses the order of the items.
Definition: list.h:604
static size_t cxListInsertArray(CxList *list, size_t index, void const *array, size_t n)
Inserts multiple items to the list at the specified index.
Definition: list.h:313
void cxListStorePointers(CxList *list)
Advises the list to only store pointers to the objects.
static int cxListAdd(CxList *list, void const *elem)
Adds an item to the end of the list.
Definition: list.h:239
int cxListCompare(CxList const *list, CxList const *other)
Compares a list to another list of the same type.
static CxMutIterator cxListMutBackwardsIterator(CxList *list)
Returns a mutating backwards iterator pointing to the last item of the list.
Definition: list.h:564
static void * cxListAt(CxList *list, size_t index)
Returns a pointer to the element at the specified index.
Definition: list.h:427
void cxListStoreObjects(CxList *list)
Advises the list to store copies of the objects (default mode of operation).
static int cxListSwap(CxList *list, size_t i, size_t j)
Swaps two items in the list.
Definition: list.h:411
static size_t cxListSize(CxList const *list)
Returns the number of elements currently stored in the list.
Definition: list.h:226
static void cxListSort(CxList *list)
Sorts the list in-place.
Definition: list.h:594
static CxIterator cxListBackwardsIteratorAt(CxList const *list, size_t index)
Returns a backwards iterator pointing to the item at the specified index.
Definition: list.h:465
static ssize_t cxListFind(CxList const *list, void const *elem)
Returns the index of the first element that equals elem.
Definition: list.h:579
CxMutIterator cxListMutBackwardsIteratorAt(CxList *list, size_t index)
Returns a mutating backwards iterator pointing to the item at the specified index.
static CxIterator cxListBackwardsIterator(CxList const *list)
Returns a backwards iterator pointing to the last item of the list.
Definition: list.h:549
CxMutIterator cxListMutIteratorAt(CxList *list, size_t index)
Returns a mutating iterator pointing to the item at the specified index.
static int cxListRemove(CxList *list, size_t index)
Removes the element at the specified index.
Definition: list.h:379
static size_t cxListAddArray(CxList *list, void const *array, size_t n)
Adds multiple items to the end of the list.
Definition: list.h:263
static int cxListInsertAfter(CxMutIterator *iter, void const *elem)
Inserts an element after the current location of the specified iterator.
Definition: list.h:338
static CxIterator cxListIteratorAt(CxList const *list, size_t index)
Returns an iterator pointing to the item at the specified index.
Definition: list.h:446
void cxListDestroy(CxList *list)
Deallocates the memory of the specified list structure.
static int cxListInsertBefore(CxMutIterator *iter, void const *elem)
Inserts an element before the current location of the specified iterator.
Definition: list.h:361
static void cxListClear(CxList *list)
Removes all elements from this list.
Definition: list.h:395
Internal iterator struct - use CxIterator.
Definition: iterator.h:160
The class definition for arbitrary lists.
Definition: list.h:70
void(* sort)(struct cx_list_s *list)
Member function for sorting the list in-place.
Definition: list.h:150
ssize_t(* find)(struct cx_list_s const *list, void const *elem)
Member function for finding an element.
Definition: list.h:142
int(* swap)(struct cx_list_s *list, size_t i, size_t j)
Member function for swapping two elements.
Definition: list.h:125
void(* destructor)(struct cx_list_s *list)
Destructor function.
Definition: list.h:77
void(* clear)(struct cx_list_s *list)
Member function for removing all elements.
Definition: list.h:120
int(* remove)(struct cx_list_s *list, size_t index)
Member function for removing an element.
Definition: list.h:112
int(* compare)(struct cx_list_s const *list, struct cx_list_s const *other)
Member function for comparing this list to another list of the same type.
Definition: list.h:155
int(* insert_element)(struct cx_list_s *list, size_t index, void const *data)
Member function for inserting a single element.
Definition: list.h:83
struct cx_iterator_s(* iterator)(struct cx_list_s const *list, size_t index, bool backward)
Member function for returning an iterator pointing to the specified index.
Definition: list.h:168
void(* reverse)(struct cx_list_s *list)
Member function for reversing the order of the items.
Definition: list.h:163
size_t(* insert_array)(struct cx_list_s *list, size_t index, void const *data, size_t n)
Member function for inserting multiple elements.
Definition: list.h:93
int(* insert_iter)(struct cx_mut_iterator_s *iter, void const *elem, int prepend)
Member function for inserting an element relative to an iterator position.
Definition: list.h:103
Structure for holding the base data of a list.
Definition: list.h:55
CX_COLLECTION_MEMBERS cx_list_class const * cl
The list class definition.
Definition: list.h:60
cx_list_class const * climpl
The actual implementation in case the list class is delegating.
Definition: list.h:64
Internal iterator struct - use CxMutIterator.
Definition: iterator.h:96