![]() |
ucx
UAP Common Extensions
|
The class definition for arbitrary lists. More...
#include <list.h>
Data Fields | |
void(* | deallocate )(struct cx_list_s *list) |
Destructor function. | |
int(* | insert_element )(struct cx_list_s *list, size_t index, const void *data) |
Member function for inserting a single element. | |
size_t(* | insert_array )(struct cx_list_s *list, size_t index, const void *data, size_t n) |
Member function for inserting multiple elements. | |
size_t(* | insert_sorted )(struct cx_list_s *list, const void *sorted_data, size_t n) |
Member function for inserting sorted elements into a sorted list. | |
int(* | insert_iter )(struct cx_iterator_s *iter, const void *elem, int prepend) |
Member function for inserting an element relative to an iterator position. | |
size_t(* | remove )(struct cx_list_s *list, size_t index, size_t num, void *targetbuf) |
Member function for removing elements. | |
void(* | clear )(struct cx_list_s *list) |
Member function for removing all elements. | |
int(* | swap )(struct cx_list_s *list, size_t i, size_t j) |
Member function for swapping two elements. | |
void *(* | at )(const struct cx_list_s *list, size_t index) |
Member function for element lookup. | |
size_t(* | find_remove )(struct cx_list_s *list, const void *elem, bool remove) |
Member function for finding and optionally removing an element. | |
void(* | sort )(struct cx_list_s *list) |
Member function for sorting the list. | |
int(* | compare )(const struct cx_list_s *list, const struct cx_list_s *other) |
Optional member function for comparing this list to another list of the same type. | |
void(* | reverse )(struct cx_list_s *list) |
Member function for reversing the order of the items. | |
struct cx_iterator_s(* | iterator )(const struct cx_list_s *list, size_t index, bool backward) |
Member function for returning an iterator pointing to the specified index. | |
The class definition for arbitrary lists.
Optional member function for comparing this list to another list of the same type.
If set to NULL
, comparison won't be optimized.
void(* cx_list_class_s::deallocate) (struct cx_list_s *list) |
Destructor function.
Implementations SHALL invoke the content destructor functions if provided and SHALL deallocate the entire list memory.
size_t(* cx_list_class_s::insert_array) (struct cx_list_s *list, size_t index, const void *data, size_t n) |
Member function for inserting multiple elements.
size_t(* cx_list_class_s::insert_sorted) (struct cx_list_s *list, const void *sorted_data, size_t n) |
Member function for inserting sorted elements into a sorted list.
size_t(* cx_list_class_s::remove) (struct cx_list_s *list, size_t index, size_t num, void *targetbuf) |
Member function for removing elements.
Implementations SHALL check if targetbuf
is set and copy the elements to the buffer without invoking any destructor. When targetbuf
is not set, the destructors SHALL be invoked.
The function SHALL return the actual number of elements removed, which might be lower than num
when going out of bounds.
void(* cx_list_class_s::sort) (struct cx_list_s *list) |
Member function for sorting the list.
int(* cx_list_class_s::swap) (struct cx_list_s *list, size_t i, size_t j) |
Member function for swapping two elements.