logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

include/Zycore/List.h

Author

       Generated automatically by Doxygen for Zycore from the source code.

Zycore                                           Version 1.5.2.0                        include/Zycore/List.h(3)

Detailed Description

       Implements a doubly linked list.

Function Documentation

ZYCORE_EXPORTZyanStatusZyanListClear(ZyanList*list)
       Erases all elements of the list.

       Parameterslist A pointer to the ZyanList instance.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListDestroy(ZyanList*list)
       Destroys the given ZyanList instance.

       Parameterslist A pointer to the ZyanList instance.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZYAN_REQUIRES_LIBCZyanStatusZyanListDuplicate(ZyanList*destination,constZyanList*source)
       Initializes a new ZyanList instance by duplicating an existing list.

       Parametersdestination A pointer to the (uninitialized) destination ZyanList instance.
           source A pointer to the source list.

       Returns
           A zyan status code.

       The memory for the list is dynamically allocated by the default allocator.

       Finalization with ZyanListDestroy is required for all instances created by this function.

   ZYCORE_EXPORTZyanStatusZyanListDuplicateCustomBuffer(ZyanList*destination,constZyanList*source,void*buffer,ZyanUSizecapacity)
       Initializes a new ZyanList instance by duplicating an existing list and configures it to use a custom
       user defined buffer with a fixed size.

       Parametersdestination A pointer to the (uninitialized) destination ZyanList instance.
           source A pointer to the source list.
           buffer A pointer to the buffer that is used as storage for the elements.
           capacity The maximum capacity (number of bytes) of the buffer including the space required for the
           list-nodes.

       This function will fail, if the capacity of the buffer is not sufficient to store all elements of the
       source list.

       Returns
           A zyan status code.

       The buffer capacity required to store n elements of type T is be calculated by: size = n *
       sizeof(ZyanListNode) + n * sizeof(T)

       Finalization is not required for instances created by this function.

   ZYCORE_EXPORTZyanStatusZyanListDuplicateEx(ZyanList*destination,constZyanList*source,ZyanAllocator*allocator)
       Initializes a new ZyanList instance by duplicating an existing list and sets a custom allocator.

       Parametersdestination A pointer to the (uninitialized) destination ZyanList instance.
           source A pointer to the source list.
           allocator A pointer to a ZyanAllocator instance.

       Returns
           A zyan status code.

       Finalization with ZyanListDestroy is required for all instances created by this function.

   ZYCORE_EXPORTZyanStatusZyanListEmplaceBack(ZyanList*list,void**item,ZyanMemberFunctionconstructor)
       Constructs an item in-place at the end of the list.

       Parameterslist A pointer to the ZyanList instance.
           item Receives a pointer to the new item.
           constructor The constructor callback or ZYAN_NULL. The new item will be in undefined state, if no
           constructor was passed.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListEmplaceFront(ZyanList*list,void**item,ZyanMemberFunctionconstructor)

       Constructs an item in-place at the beginning of the list.

       Parameterslist A pointer to the ZyanList instance.
           item Receives a pointer to the new item.
           constructor The constructor callback or ZYAN_NULL. The new item will be in undefined state, if no
           constructor was passed.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListGetHeadNode(constZyanList*list,constZyanListNode**node)
       Returns a pointer to the first ZyanListNode struct of the given list.

       Parameterslist A pointer to the ZyanList instance.
           node Receives a pointer to the first ZyanListNode struct of the list.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListGetNextNode(constZyanListNode**node)
       Receives a pointer to the next ZyanListNode struct linked to the passed one.

       Parametersnode Receives a pointer to the next ZyanListNode struct linked to the passed one.

       Returns
           A zyan status code.

   ZYCORE_EXPORTconstvoid*ZyanListGetNodeData(constZyanListNode*node)
       Returns a constant pointer to the data of the given node.

       Parametersnode A pointer to the ZyanListNode struct.

       Returns
           A constant pointer to the the data of the given node or ZYAN_NULL, if an error occured.

       Take a look at ZyanListGetNodeDataEx, if you need a function that returns a zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListGetNodeDataEx(constZyanListNode*node,constvoid**value)
       Returns a constant pointer to the data of the given node..

       Parametersnode A pointer to the ZyanListNode struct.
           value Receives a constant pointer to the data of the given node.

       Take a look at ZyanListGetNodeData, if you need a function that directly returns a pointer.

       Returns
           A zyan status code.

   ZYCORE_EXPORTvoid*ZyanListGetNodeDataMutable(constZyanListNode*node)
       Returns a mutable pointer to the data of the given node.

       Parametersnode A pointer to the ZyanListNode struct.

       Returns
           A mutable pointer to the the data of the given node or ZYAN_NULL, if an error occured.

       Take a look at ZyanListGetPointerMutableEx instead, if you need a function that returns a zyan status
       code.

   ZYCORE_EXPORTZyanStatusZyanListGetNodeDataMutableEx(constZyanListNode*node,void**value)
       Returns a mutable pointer to the data of the given node..

       Parametersnode A pointer to the ZyanListNode struct.
           value Receives a mutable pointer to the data of the given node.

       Take a look at ZyanListGetNodeDataMutable, if you need a function that directly returns a pointer.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListGetPrevNode(constZyanListNode**node)
       Receives a pointer to the previous ZyanListNode struct linked to the passed one.

       Parametersnode Receives a pointer to the previous ZyanListNode struct linked to the passed one.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListGetSize(constZyanList*list,ZyanUSize*size)
       Returns the current size of the list.

       Parameterslist A pointer to the ZyanList instance.
           size Receives the size of the list.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListGetTailNode(constZyanList*list,constZyanListNode**node)
       Returns a pointer to the last ZyanListNode struct of the given list.

       Parameterslist A pointer to the ZyanList instance.
           node Receives a pointer to the last ZyanListNode struct of the list.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZYAN_REQUIRES_LIBCZyanStatusZyanListInit(ZyanList*list,ZyanUSizeelement_size,ZyanMemberProceduredestructor)
       Initializes the given ZyanList instance.

       Parameterslist A pointer to the ZyanList instance.
           element_size The size of a single element in bytes.
           destructor A destructor callback that is invoked every time an item is deleted, or ZYAN_NULL if not
           needed.

       Returns
           A zyan status code.

       The memory for the list elements is dynamically allocated by the default allocator.

       Finalization with ZyanListDestroy is required for all instances created by this function.

   ZYCORE_EXPORTZyanStatusZyanListInitCustomBuffer(ZyanList*list,ZyanUSizeelement_size,ZyanMemberProceduredestructor,void*buffer,ZyanUSizecapacity)
       Initializes the given ZyanList instance and configures it to use a custom user defined buffer with a
       fixed size.

       Parameterslist A pointer to the ZyanList instance.
           element_size The size of a single element in bytes.
           destructor A destructor callback that is invoked every time an item is deleted, or ZYAN_NULL if not
           needed.
           buffer A pointer to the buffer that is used as storage for the elements.
           capacity The maximum capacity (number of bytes) of the buffer including the space required for the
           list-nodes.

       Returns
           A zyan status code.

       The buffer capacity required to store n elements of type T is be calculated by: size = n *
       sizeof(ZyanListNode) + n * sizeof(T)

       Finalization is not required for instances created by this function.

   ZYCORE_EXPORTZyanStatusZyanListInitEx(ZyanList*list,ZyanUSizeelement_size,ZyanMemberProceduredestructor,ZyanAllocator*allocator)
       Initializes the given ZyanList instance and sets a custom allocator.

       Parameterslist A pointer to the ZyanList instance.
           element_size The size of a single element in bytes.
           destructor A destructor callback that is invoked every time an item is deleted, or ZYAN_NULL if not
           needed.
           allocator A pointer to a ZyanAllocator instance.

       Returns
           A zyan status code.

       Finalization with ZyanListDestroy is required for all instances created by this function.

   ZYCORE_EXPORTZyanStatusZyanListPopBack(ZyanList*list)
       Removes the last element of the list.

       Parameterslist A pointer to the ZyanList instance.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListPopFront(ZyanList*list)
       Removes the firstelement of the list.

       Parameterslist A pointer to the ZyanList instance.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListPushBack(ZyanList*list,constvoid*item)
       Adds a new item to the end of the list.

       Parameterslist A pointer to the ZyanList instance.
           item A pointer to the item to add.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListPushFront(ZyanList*list,constvoid*item)
       Adds a new item to the beginning of the list.

       Parameterslist A pointer to the ZyanList instance.
           item A pointer to the item to add.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListRemove(ZyanList*list,constZyanListNode*node)
       Removes the given node from the list.

       Parameterslist A pointer to the ZyanList instance.
           node A pointer to the ZyanListNode struct.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListRemoveRange(ZyanList*list,constZyanListNode*first,constZyanListNode*last)
       Removes multiple nodes from the list.

       Parameterslist A pointer to the ZyanList instance.
           first A pointer to the first node.
           last A pointer to the last node.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListResize(ZyanList*list,ZyanUSizesize)
       Resizes the given ZyanList instance.

       Parameterslist A pointer to the ZyanList instance.
           size The new size of the list.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListResizeEx(ZyanList*list,ZyanUSizesize,constvoid*initializer)
       Resizes the given ZyanList instance.

       Parameterslist A pointer to the ZyanList instance.
           size The new size of the list.
           initializer A pointer to a value to be used as initializer for new items.

       Returns
           A zyan status code.

   ZYCORE_EXPORTZyanStatusZyanListSetNodeData(constZyanList*list,constZyanListNode*node,constvoid*value)
       Assigns a new data value to the given node.

       Parameterslist A pointer to the ZyanList instance.
           node A pointer to the ZyanListNode struct.
           value The value to assign.

       Returns
           A zyan status code.

Macro Definition Documentation

#defineZYAN_LIST_GET(type,node)(*(consttype*)ZyanListGetNodeData(node))
       Returns the data value of the given node.

       Parameterstype The desired value type.
           node A pointer to the ZyanListNode struct.

       Returns
           The data value of the given node.

       Note that this function is unsafe and might dereference a null-pointer.

   #defineZYAN_LIST_INITIALIZERValue:.PP
           { \
               /* allocator        */ ZYAN_NULL, \
               /* size             */ 0, \
               /* element_size     */ 0, \
               /* head             */ ZYAN_NULL, \
               /* destructor       */ ZYAN_NULL, \
               /* tail             */ ZYAN_NULL, \
               /* buffer           */ ZYAN_NULL, \
               /* capacity         */ 0, \
               /* first_unused     */ ZYAN_NULL \
           }
       Defines an uninitialized ZyanList instance.

Name

       include/Zycore/List.h

Synopsis

       #include <Zycore/Allocator.h>
       #include <Zycore/Object.h>
       #include <Zycore/Status.h>
       #include <Zycore/Types.h>

   Classes
       struct ZyanListNode_
       struct ZyanList_Macros
       #define ZYAN_LIST_INITIALIZER
       #define ZYAN_LIST_GET(type,  node)       (*(const type*)ZyanListGetNodeData(node))

   Typedefs
       typedef struct ZyanListNode_ZyanListNode
       typedef struct ZyanList_ZyanListFunctionsZYCORE_EXPORTZYAN_REQUIRES_LIBCZyanStatusZyanListInit (ZyanList *list, ZyanUSize element_size,
           ZyanMemberProcedure destructor)
       ZYCORE_EXPORTZyanStatusZyanListInitEx (ZyanList *list, ZyanUSize element_size, ZyanMemberProcedure
           destructor, ZyanAllocator *allocator)
       ZYCORE_EXPORTZyanStatusZyanListInitCustomBuffer (ZyanList *list, ZyanUSize element_size,
           ZyanMemberProcedure destructor, void *buffer, ZyanUSize capacity)
       ZYCORE_EXPORTZyanStatusZyanListDestroy (ZyanList *list)
       ZYCORE_EXPORTZYAN_REQUIRES_LIBCZyanStatusZyanListDuplicate (ZyanList *destination, const ZyanList
           *source)
       ZYCORE_EXPORTZyanStatusZyanListDuplicateEx (ZyanList *destination, const ZyanList *source,
           ZyanAllocator *allocator)
       ZYCORE_EXPORTZyanStatusZyanListDuplicateCustomBuffer (ZyanList *destination, const ZyanList *source,
           void *buffer, ZyanUSize capacity)
       ZYCORE_EXPORTZyanStatusZyanListGetHeadNode (const ZyanList *list, const ZyanListNode **node)
       ZYCORE_EXPORTZyanStatusZyanListGetTailNode (const ZyanList *list, const ZyanListNode **node)
       ZYCORE_EXPORTZyanStatusZyanListGetPrevNode (const ZyanListNode **node)
       ZYCORE_EXPORTZyanStatusZyanListGetNextNode (const ZyanListNode **node)
       ZYCORE_EXPORT const void * ZyanListGetNodeData (const ZyanListNode *node)
       ZYCORE_EXPORTZyanStatusZyanListGetNodeDataEx (const ZyanListNode *node, const void **value)
       ZYCORE_EXPORT void * ZyanListGetNodeDataMutable (const ZyanListNode *node)
       ZYCORE_EXPORTZyanStatusZyanListGetNodeDataMutableEx (const ZyanListNode *node, void **value)
       ZYCORE_EXPORTZyanStatusZyanListSetNodeData (const ZyanList *list, const ZyanListNode *node, const void
           *value)
       ZYCORE_EXPORTZyanStatusZyanListPushBack (ZyanList *list, const void *item)
       ZYCORE_EXPORTZyanStatusZyanListPushFront (ZyanList *list, const void *item)
       ZYCORE_EXPORTZyanStatusZyanListEmplaceBack (ZyanList *list, void **item, ZyanMemberFunction
           constructor)
       ZYCORE_EXPORTZyanStatusZyanListEmplaceFront (ZyanList *list, void **item, ZyanMemberFunction
           constructor)
       ZYCORE_EXPORTZyanStatusZyanListPopBack (ZyanList *list)
       ZYCORE_EXPORTZyanStatusZyanListPopFront (ZyanList *list)
       ZYCORE_EXPORTZyanStatusZyanListRemove (ZyanList *list, const ZyanListNode *node)
       ZYCORE_EXPORTZyanStatusZyanListRemoveRange (ZyanList *list, const ZyanListNode *first, const
           ZyanListNode *last)
       ZYCORE_EXPORTZyanStatusZyanListClear (ZyanList *list)
       ZYCORE_EXPORTZyanStatusZyanListResize (ZyanList *list, ZyanUSize size)
       ZYCORE_EXPORTZyanStatusZyanListResizeEx (ZyanList *list, ZyanUSize size, const void *initializer)
       ZYCORE_EXPORTZyanStatusZyanListGetSize (const ZyanList *list, ZyanUSize *size)

Typedef Documentation

typedefstructZyanList_ZyanList
       Defines the ZyanList struct.

       All fields in this struct should be considered as 'private'. Any changes may lead to unexpected behavior.

   typedefstructZyanListNode_ZyanListNode
       Defines the ZyanListNode struct.

       All fields in this struct should be considered as 'private'. Any changes may lead to unexpected behavior.

See Also