CObject
|
Interface for list data structures. More...
#include <CIList.h>
Public Member Functions | |
CIListError | CIList_Add (struct CIList *self, void *element) |
CIListError | CIList_AddAt (struct CIList *self, void *element, size_t index) |
CIListError | CIList_Get (struct CIList *self, void *element, size_t index) |
CIListError | CIList_Remove (struct CIList *self, void *element, size_t index) |
void | CIList_Clear (struct CIList *self) |
size_t | CIList_Size (struct CIList *self) |
size_t | CIList_MaxSize (struct CIList *self) |
Data Fields | |
struct CInterface | interface |
Provides an interface for adding/removing data from a list. This is a copy by value list, meaning all insert/get/remove functions will copy at the location pointed to by inputs. See function descriptions for more details.
CIListError CIList_Add | ( | struct CIList * | self, |
void * | element | ||
) |
Add parameter element, by copy, to the first empty spot in the list. If there are no empty spots, the list will be resized or an error returned.
self | The list. |
element | A pointer to the data which will be copied into the list. |
CIListError CIList_AddAt | ( | struct CIList * | self, |
void * | element, | ||
size_t | index | ||
) |
Insert the element into the specefied index of the list. If there is already something at that index in the list, it gets overwritten.
self | The list. |
element | Pointer to the data that is copied into the list. |
index | The index in the list to copy the data. |
void CIList_Clear | ( | struct CIList * | self | ) |
Reset the list to a completely empty state. All data within the list is lost.
self | The list. |
CIListError CIList_Get | ( | struct CIList * | self, |
void * | element, | ||
size_t | index | ||
) |
Get an element from the list at the specified index. The element is not removed from the list.
self | The list. |
element | Data will be copied from the list into the location pointed to by this. If a NULL pointer is provided, no data is copied. |
index | The location in the list to get an item from. |
size_t CIList_MaxSize | ( | struct CIList * | self | ) |
Poll the currently maximum available space in the list.
self | The list. |
CIListError CIList_Remove | ( | struct CIList * | self, |
void * | element, | ||
size_t | index | ||
) |
Remove an element from the list at the specified index.
self | The list. |
element | Pointer to location where data removed from the list will be copied into. If this is a NULL pointer, no data is copied. |
index | Index in the list to remove data. |
size_t CIList_Size | ( | struct CIList * | self | ) |
Poll the current size of the list.
self | The list. |