138#define ZYAN_LIST_INITIALIZER \
166#define ZYAN_LIST_GET(type, node) \
167 (*reinterpret_cast<const type*>(ZyanListGetNodeData(node)))
169#define ZYAN_LIST_GET(type, node) \
170 (*(const type*)ZyanListGetNodeData(node))
struct ZyanAllocator_ ZyanAllocator
Defines the ZyanAllocator struct.
#define ZYAN_REQUIRES_LIBC
Marks functions that require libc (cannot be used with ZYAN_NO_LIBC).
Definition Defines.h:468
#define ZYCORE_EXPORT
Symbol is exported in shared library builds.
Definition Defines.h:330
ZYCORE_EXPORT ZyanStatus ZyanListInitEx(ZyanList *list, ZyanUSize element_size, ZyanMemberProcedure destructor, ZyanAllocator *allocator)
Initializes the given ZyanList instance and sets a custom allocator.
ZYCORE_EXPORT ZyanStatus ZyanListPushFront(ZyanList *list, const void *item)
Adds a new item to the beginning of the list.
struct ZyanList_ ZyanList
Defines the ZyanList struct.
ZYCORE_EXPORT ZyanStatus ZyanListDestroy(ZyanList *list)
Destroys the given ZyanList instance.
ZYCORE_EXPORT ZyanStatus ZyanListGetNodeDataMutableEx(const ZyanListNode *node, void **value)
Returns a mutable pointer to the data of the given node.
ZYCORE_EXPORT ZyanStatus ZyanListPopBack(ZyanList *list)
Removes the last element of the list.
ZYCORE_EXPORT ZyanStatus ZyanListRemove(ZyanList *list, const ZyanListNode *node)
Removes the given node from the list.
ZYCORE_EXPORT ZyanStatus ZyanListPushBack(ZyanList *list, const void *item)
Adds a new item to the end of the list.
ZYCORE_EXPORT ZyanStatus ZyanListEmplaceBack(ZyanList *list, void **item, ZyanMemberFunction constructor)
Constructs an item in-place at the end of the list.
struct ZyanListNode_ ZyanListNode
Defines the ZyanListNode struct.
ZYCORE_EXPORT ZyanStatus ZyanListEmplaceFront(ZyanList *list, void **item, ZyanMemberFunction constructor)
Constructs an item in-place at the beginning of the list.
ZYCORE_EXPORT ZyanStatus ZyanListInitCustomBuffer(ZyanList *list, ZyanUSize element_size, ZyanMemberProcedure destructor, void *buffer, ZyanUSize capacity)
Initializes the given ZyanList instance and configures it to use a custom user defined buffer with a ...
ZYCORE_EXPORT ZyanStatus ZyanListPopFront(ZyanList *list)
Removes the firstelement of the list.
ZYCORE_EXPORT ZyanStatus ZyanListSetNodeData(const ZyanList *list, const ZyanListNode *node, const void *value)
Assigns a new data value to the given node.
ZYCORE_EXPORT ZyanStatus ZyanListGetTailNode(const ZyanList *list, const ZyanListNode **node)
Returns a pointer to the last ZyanListNode struct of the given list.
ZYCORE_EXPORT const void * ZyanListGetNodeData(const ZyanListNode *node)
Returns a constant pointer to the data of the given node.
ZYCORE_EXPORT ZyanStatus ZyanListGetNextNode(const ZyanListNode **node)
Receives a pointer to the next ZyanListNode struct linked to the passed one.
ZYCORE_EXPORT ZyanStatus ZyanListDuplicateEx(ZyanList *destination, const ZyanList *source, ZyanAllocator *allocator)
Initializes a new ZyanList instance by duplicating an existing list and sets a custom allocator.
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanListDuplicate(ZyanList *destination, const ZyanList *source)
Initializes a new ZyanList instance by duplicating an existing list.
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanListInit(ZyanList *list, ZyanUSize element_size, ZyanMemberProcedure destructor)
Initializes the given ZyanList instance.
ZYCORE_EXPORT ZyanStatus ZyanListGetHeadNode(const ZyanList *list, const ZyanListNode **node)
Returns a pointer to the first ZyanListNode struct of the given list.
ZYCORE_EXPORT ZyanStatus ZyanListRemoveRange(ZyanList *list, const ZyanListNode *first, const ZyanListNode *last)
Removes multiple nodes from the list.
ZYCORE_EXPORT ZyanStatus ZyanListResize(ZyanList *list, ZyanUSize size)
Resizes the given ZyanList instance.
ZYCORE_EXPORT ZyanStatus ZyanListDuplicateCustomBuffer(ZyanList *destination, const ZyanList *source, void *buffer, ZyanUSize capacity)
Initializes a new ZyanList instance by duplicating an existing list and configures it to use a custom...
ZYCORE_EXPORT ZyanStatus ZyanListGetPrevNode(const ZyanListNode **node)
Receives a pointer to the previous ZyanListNode struct linked to the passed one.
ZYCORE_EXPORT ZyanStatus ZyanListResizeEx(ZyanList *list, ZyanUSize size, const void *initializer)
Resizes the given ZyanList instance.
ZYCORE_EXPORT ZyanStatus ZyanListGetSize(const ZyanList *list, ZyanUSize *size)
Returns the current size of the list.
ZYCORE_EXPORT ZyanStatus ZyanListClear(ZyanList *list)
Erases all elements of the list.
ZYCORE_EXPORT ZyanStatus ZyanListGetNodeDataEx(const ZyanListNode *node, const void **value)
Returns a constant pointer to the data of the given node.
ZYCORE_EXPORT void * ZyanListGetNodeDataMutable(const ZyanListNode *node)
Returns a mutable pointer to the data of the given node.
Defines some generic object-related datatypes.
void(* ZyanMemberProcedure)(void *object)
Defines the ZyanMemberProcedure function prototype.
Definition Object.h:51
ZyanStatus(* ZyanMemberFunction)(void *object)
Defines the ZyanMemberFunction function prototype.
Definition Object.h:67
Status code definitions and check macros.
ZyanU32 ZyanStatus
Defines the ZyanStatus data type.
Definition Status.h:48
Includes and defines some default data types.
size_t ZyanUSize
Definition Types.h:224
Defines the ZyanListNode struct.
Definition List.h:55
struct ZyanListNode_ * prev
A pointer to the previous list node.
Definition List.h:59
struct ZyanListNode_ * next
A pointer to the next list node.
Definition List.h:63
Defines the ZyanList struct.
Definition List.h:73
ZyanAllocator * allocator
The memory allocator.
Definition List.h:77
ZyanUSize element_size
The size of a single element in bytes.
Definition List.h:85
ZyanListNode * head
The head node.
Definition List.h:93
ZyanListNode * tail
The tail node.
Definition List.h:97
void * buffer
The data buffer.
Definition List.h:103
ZyanUSize size
The current number of elements in the list.
Definition List.h:81
ZyanListNode * first_unused
The first unused node.
Definition List.h:124
ZyanUSize capacity
The data buffer capacity (number of bytes).
Definition List.h:109
ZyanMemberProcedure destructor
The element destructor callback.
Definition List.h:89