55 typedef struct _qList_Node_s {
57 struct _qList_Node_s *next, *prev;
79 #define qNode_MinimalFields void *next, *prev, *container
85 typedef struct _qList_s {
97 #define QLIST_INITIALIZER { NULL, NULL, NULL, NULL, NULL, 0U }
115 typedef struct _qList_ForEachHandle_s {
123 _qList_ForEachHandle_t;
133 typedef struct _qList_CompareHandle_s {
140 _qList_CompareHandle_t;
181 #define QLIST_AT_FRONT ( (qList_Position_t)( -1 ) )
187 #define QLIST_AT_BACK ( (qList_Position_t)( 2147483647 ) )
260 const void *
const node );
346 #define QLIST_FORWARD ( _qNode_Forward )
352 #define QLIST_BACKWARD ( _qNode_Backward )
357 typedef struct _qList_Iterator_s {
440 const void *
const node );
qBool_t qList_Move(qList_t *const dst, qList_t *const src, const qList_Position_t p)
Moves(or merge) the entire list pointed by src to the list pointed by dst at location specified by p....
Definition qlists.c:236
qINT32_t qList_Position_t
Typedef to hold the target position of a node in a list.
Definition qlists.h:175
qBool_t qList_RemoveItself(void *const node)
If the node is member of a list, the node will be removed from it.
Definition qlists.c:160
qBool_t qList_Sort(qList_t *const l, qList_CompareFcn_t f)
Sort the double linked list using the f function to determine the order. The sorting algorithm used b...
Definition qlists.c:361
qBool_t qListIterator_Until(const qList_Iterator_t *const i, const void *const node)
Check until current iterator reach the given node.
Definition qlists.c:635
qList_Iterator_t qList_End(qList_t *const xList)
Returns an iterator pointing to the last element in the list container.
Definition qlists.c:626
qBool_t qList_IsEmpty(const qList_t *const l)
Check if the list is empty.
Definition qlists.c:340
void * qListIterator_Get(const qList_Iterator_t *const i)
Gets the node that the iterator is currently pointing to.
Definition qlists.c:666
void * qList_Remove(qList_t *const l, void *const node, const qList_Position_t p)
Remove an item from the list.
Definition qlists.c:195
void * qList_GetBack(const qList_t *const l)
Get a pointer to the back item of the list.
Definition qlists.c:327
qBool_t(* qList_CompareFcn_t)(qList_CompareHandle_t h)
Pointer to a function used by the qList_Sort() API to compare nodes of a list.
Definition qlists.h:307
qBool_t qList_IsMember(const qList_t *const l, const void *const node)
Check if the node is member of the list.
Definition qlists.c:295
#define qNode_MinimalFields
This macro can be used to create custom data that can be used as node of a list. User should locate t...
Definition qlists.h:79
qBool_t qList_Insert(qList_t *const l, void *const node, const qList_Position_t p)
Insert an item into the list.
Definition qlists.c:117
qBool_t qList_IteratorSet(qList_Iterator_t *i, qList_t *const l, void *nodeOffset, const qList_Direction_t d)
Setup an instance of the given iterator to traverse the list.
Definition qlists.c:431
qBool_t qList_Swap(void *node1, void *node2)
Swap two nodes that belongs to the same list by changing its own links.
Definition qlists.c:521
void qListIterator_Backward(qList_Iterator_t *i)
Move the iterator backward.
Definition qlists.c:658
qBool_t qList_ForEach(const qList_t *const l, const qList_NodeFcn_t f, void *arg, qList_Direction_t d, void *nodeOffset)
Operate on each element of the list.
Definition qlists.c:460
qList_Node_t *(* qList_Direction_t)(const qList_Node_t *const node)
Typedef to hold the direction in which the list should be traversed.
Definition qlists.h:340
qBool_t qList_Initialize(qList_t *const l)
Must be called before a list is used. This initialises all the members of the list structure.
Definition qlists.c:27
void * qList_GetFront(const qList_t *const l)
Get a pointer to the front item of the list.
Definition qlists.c:314
qList_WalkStage_t
An enum to describe the ForEach stage.
Definition qlists.h:102
void qListIterator_Forward(qList_Iterator_t *i)
Move the iterator forward.
Definition qlists.c:650
qList_Iterator_t qList_Begin(qList_t *const xList)
Returns an iterator pointing to the first element in the list container.
Definition qlists.c:617
qBool_t(* qList_NodeFcn_t)(qList_ForEachHandle_t h)
Pointer to a function that operates on every node when using the qList_ForEach() API.
Definition qlists.h:170
size_t qList_Length(const qList_t *const l)
Get the number of items inside the list.
Definition qlists.c:350
@ qList_WalkEnd
Definition qlists.h:105
@ qList_WalkInit
Definition qlists.h:103
@ qList_WalkThrough
Definition qlists.h:104
qUINT8_t qBool_t
A type to instantiate an OS boolean variable.
Definition qtypes.h:139
int32_t qINT32_t
Signed integer type with width of exactly 32 bits respectively.
Definition qtypes.h:55
Handle of the qList_Sort() API that is passed as an argument to the compare function.
Definition qlists.h:133
const void * n1
Definition qlists.h:134
const void * n2
Definition qlists.h:135
Handle of the qList_ForEach() API that is passed as an argument to the function that operates on each...
Definition qlists.h:115
qList_WalkStage_t stage
Definition qlists.h:118
void * node
Definition qlists.h:116
void * arg
Definition qlists.h:117
Typedef to hold a list-iterator instance.
Definition qlists.h:357
A list-node object (Used internally)
Definition qlists.h:55
A list object (Generic double-linked)
Definition qlists.h:85