28 #include "../shared/ufotypes.h"
41 #define LIST_Foreach(list, type, var) \
42 for (bool var##__break = false, var##__once = true; var##__once; var##__once = false) \
43 for (linkedList_t const* var##__iter = (list); !var##__break && var##__iter;) \
44 for (type* const var = (var##__break = var##__once = true, static_cast<type*>(var##__iter->data)); var##__once; var##__break = var##__once = false) \
45 if (var##__iter = var##__iter->next, false) {} else
50 #define LIST_ForeachSorted(list, type, var, sorter, userdata, sortedlist) \
51 sortedlist = LIST_CopyStructure(list); \
52 LIST_Sort(&sortedlist, sorter, userdata); \
53 LIST_Foreach(sortedlist, type, var)
77 return *
static_cast<T*
>(
LIST_Add(list, &data,
sizeof(data))->
data);
bool LIST_Remove(linkedList_t **list, const void *data)
const linkedList_t * LIST_ContainsString(const linkedList_t *list, const char *string)
Searches for the first occurrence of a given string.
void * LIST_GetRandom(linkedList_t *list)
int(* linkedListSort_t)(linkedList_t *entry1, linkedList_t *entry2, const void *userData)
bool LIST_IsEmpty(const linkedList_t *list)
Checks whether the given list is empty.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
int LIST_Count(const linkedList_t *list)
QGL_EXTERN GLuint GLsizei GLsizei * length
linkedList_t * LIST_CopyStructure(linkedList_t *src)
Copies the list structure data - but not the content from the original list. We are only using pointe...
void LIST_Delete(linkedList_t **list)
void LIST_PrependString(linkedList_t **listDest, const char *data)
Adds a string as first entry to a linked list.
void * LIST_GetByIdx(linkedList_t *list, int index)
Get an entry of a linked list by its index in the list.
linkedList_t * LIST_Add(linkedList_t **list, void const *data, size_t length)
Adds an entry to a new or to an already existing linked list.
bool LIST_RemoveEntry(linkedList_t **list, linkedList_t *entry)
Removes one entry from the linked list.
void LIST_Sort(linkedList_t **list, linkedListSort_t sorter, const void *userData)
GLsizei const GLvoid * data
linkedList_t * LIST_GetPointer(linkedList_t *list, const void *data)
Searches for the first occurrence of a given pointer.
void LIST_AddString(linkedList_t **list, const char *data)
Adds an string to a new or to an already existing linked list. The string is copied here...
void LIST_AddStringSorted(linkedList_t **listDest, const char *data)
void LIST_AddPointer(linkedList_t **listDest, void *data)
Adds just a pointer to a new or to an already existing linked list.