ucx
UAP Common Extensions
Loading...
Searching...
No Matches
Data Fields
cx_list_class_s Struct Reference

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.
 

Detailed Description

The class definition for arbitrary lists.

Field Documentation

◆ compare

int(* cx_list_class_s::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.

If set to NULL, comparison won't be optimized.

◆ deallocate

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.

◆ insert_array

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.

See also
cx_list_default_insert_array()

◆ insert_sorted

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.

See also
cx_list_default_insert_sorted()

◆ remove

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.

◆ sort

void(* cx_list_class_s::sort) (struct cx_list_s *list)

Member function for sorting the list.

See also
cx_list_default_sort()

◆ swap

int(* cx_list_class_s::swap) (struct cx_list_s *list, size_t i, size_t j)

Member function for swapping two elements.

See also
cx_list_default_swap()

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