A list of objects.
More...
#include <poser/core/list.h>
◆ PSC_List_append()
void PSC_List_append |
( |
PSC_List * |
self, |
|
|
void * |
obj, |
|
|
void(*)(void *) |
deleter |
|
) |
| |
Append an object to the list.
- Parameters
-
self | the PSC_List |
obj | the new object |
deleter | optional function to destroy the object |
◆ PSC_List_at()
void * PSC_List_at |
( |
const PSC_List * |
self, |
|
|
size_t |
idx |
|
) |
| |
Gets an object by position.
- Parameters
-
self | the PSC_List |
idx | position of the object |
- Returns
- the object stored at that position, or NULL
◆ PSC_List_clear()
Clear the list.
All stored objects are removed from the list, and those having a deleter attached are also destroyed.
- Parameters
-
◆ PSC_List_create()
◆ PSC_List_destroy()
void PSC_List_destroy |
( |
PSC_List * |
self | ) |
|
PSC_List destructor.
All stored objects that have a deleter attached are destroyed as well.
- Parameters
-
◆ PSC_List_fromString()
PSC_List * PSC_List_fromString |
( |
const char * |
str, |
|
|
const char * |
delim |
|
) |
| |
Create a List of strings by splitting a given string.
The string is split at any of the characters given in delim. Empty fields are ignored.
- Parameters
-
str | the string to split |
delim | characters that are considered delimiting fields |
- Returns
- a list of strings, or NULL if no non-empty fields were found
◆ PSC_List_iterator()
Creates an iterator for all entries.
The iterator contains a snapshot of all objects currently stored, modifications to the PSC_List will not be reflected in the iterator. In its initial state, the iterator points to an invalid position.
- Parameters
-
- Returns
- an iterator
◆ PSC_List_remove()
void PSC_List_remove |
( |
PSC_List * |
self, |
|
|
void * |
obj |
|
) |
| |
Remove a given object from the list.
The object will not be automatically destroyed.
- Parameters
-
self | the PSC_List |
obj | the object to remove |
◆ PSC_List_removeAll()
void PSC_List_removeAll |
( |
PSC_List * |
self, |
|
|
int(*)(void *, const void *) |
matcher, |
|
|
const void * |
arg |
|
) |
| |
Remove matching objects from the list.
Objects that are removed will be destroyed if they have a deleter attached.
- Parameters
-
self | the PSC_List |
matcher | function to compare each object to some specified value, must return 1 to have that object removed, 0 otherwise |
arg | some value for the matcher function to compare the objects against. |
◆ PSC_List_size()
size_t PSC_List_size |
( |
const PSC_List * |
self | ) |
|
Number of entries.
- Parameters
-
- Returns
- the number of entries
The documentation for this class was generated from the following file: