1234567891011121314151617181920212223242526272829303132 |
- #ifndef CORE_LIST_H
- #define CORE_LIST_H
- #include "core/Types.h"
- struct ListT {
- size_t length;
- size_t capacity;
- size_t dataSize;
- void* data;
- };
- typedef struct ListT List;
- void initList(List* l, size_t dataSize);
- void destroyList(List* l);
- void reserveListEntries(List* l, size_t n);
- void addListData(List* l, const void* data);
- #define addListType(l, type, ...) addListData(l, &(type){__VA_ARGS__})
- void addLastListData(List* l);
- void* addEmptyListData(List* l);
- void* getListIndex(const List* l, size_t index);
- #define getTypedListIndex(l, index, type) (*(type*)getListIndex(l, index))
- void* getListLast(const List* l);
- #define getTypedListLast(l, type) (*(type*)getListLast(l))
- void clearList(List* l);
- void removeListIndexBySwap(List* l, size_t index);
- void removeListIndex(List* l, size_t index);
- void removeListLast(List* l);
- void* getListStart(const List* l);
- void* getListEnd(const List* l);
- #endif
|