This section contains a list implementation.
More...
|
| Object List API |
| This API is useful for object value types including strings.
|
|
| Typed List API |
| This API is useful for scalar types such as int, long or bool.
|
|
|
RUAPI ruList | ruListNew (ruType valueType) |
| Creates a new list object. To be freed with ruListFree. More...
|
|
RUAPI ruList | ruListFree (ruList rl) |
| Frees the given list object. More...
|
|
RUAPI int32_t | ruListClear (ruList rl) |
| Clears the given list. More...
|
|
RUAPI int32_t | ruListAppendPtr (ruList rl, perm_ptr data) |
| Appends the given object to the list. More...
|
|
RUAPI int32_t | ruListInsertIdx (ruList rl, int32_t index, perm_ptr data) |
| Inserts given object at indexed position in list in given list element. More...
|
|
RUAPI int32_t | ruListInsertBefore (ruList rl, ruListElmt rle, perm_ptr data) |
| Inserts given object before given list element. More...
|
|
RUAPI int32_t | ruListInsertAfter (ruList rl, ruListElmt rle, perm_ptr data) |
| Inserts given object after given list element. More...
|
|
RUAPI uint32_t | ruListSize (ruList rl, int32_t *code) |
| Returns the number of elements in the list. More...
|
|
RUAPI alloc_chars | ruListJoin (ruList rl, trans_chars delim, int32_t *code) |
| Joins a list of char* item with given delim. More...
|
|
RUAPI int32_t | ruListSort (ruList rl) |
| Sorts the given list using the associated types comparator function. More...
|
|
RUAPI ruListElmt | ruListHead (ruList rl, int32_t *code) |
| Returns the first element in the given list. More...
|
|
RUAPI ruListElmt | ruListTail (ruList rl, int32_t *code) |
| Returns the last element in the given list. More...
|
|
RUAPI bool | ruListElmtIsHead (ruListElmt re, int32_t *code) |
| Indicates whether given element is the first in the given list. More...
|
|
RUAPI bool | ruListElmtIsTail (ruListElmt re, int32_t *code) |
| Indicates whether given element is the last in the given list. More...
|
|
RUAPI ruListElmt | ruListNextElmt (ruListElmt re, int32_t *code) |
| Return the next element following the given element from list. More...
|
|
This section contains a list implementation.
The list has typed and non typed variants and can also be used as a queue. The list is made thread safe by a mutex that is locked during read and write operations.
◆ ruListAppend
Calls ruListAppendPtr but handles the void* cast.
- Parameters
-
rl | List to append object to. |
data | Object to append. |
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruListIter
Returns the first element in the given list to iterate over.
- Parameters
-
rl | List to return element of. |
- Returns
- The first element of the list or NULL on failure.
◆ ruListPush
Stack usage synonym for ruListAppend.
- Parameters
-
rl | List to append object to. |
data | Object to append. |
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruIterator
◆ ruList
◆ ruListElmt
◆ ruListAppendPtr()
Appends the given object to the list.
- Parameters
-
rl | List to append object to. |
data | Object to append. |
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruListClear()
RUAPI int32_t ruListClear |
( |
ruList |
rl | ) |
|
Clears the given list.
- Parameters
-
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruListElmtIsHead()
RUAPI bool ruListElmtIsHead |
( |
ruListElmt |
re, |
|
|
int32_t * |
code |
|
) |
| |
Indicates whether given element is the first in the given list.
- Parameters
-
re | List element in question |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- true if the element is the first in the list.
◆ ruListElmtIsTail()
RUAPI bool ruListElmtIsTail |
( |
ruListElmt |
re, |
|
|
int32_t * |
code |
|
) |
| |
Indicates whether given element is the last in the given list.
- Parameters
-
re | List element in question |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- true if the element is the last in the list.
◆ ruListFree()
Frees the given list object.
- Parameters
-
- Returns
- NULL
◆ ruListHead()
Returns the first element in the given list.
- Parameters
-
rl | List to return element of. |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- The first element of the list or NULL on failure.
◆ ruListInsertAfter()
Inserts given object after given list element.
- Parameters
-
rl | List in which to insert object. |
rle | Element after which to insert object. NULL for first element. |
data | Object to insert. |
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruListInsertBefore()
Inserts given object before given list element.
- Parameters
-
rl | List in which to insert object. |
rle | Element before which to insert object. NULL for first element. |
data | Object to insert. |
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruListInsertIdx()
RUAPI int32_t ruListInsertIdx |
( |
ruList |
rl, |
|
|
int32_t |
index, |
|
|
perm_ptr |
data |
|
) |
| |
Inserts given object at indexed position in list in given list element.
- Parameters
-
rl | List in which to insert object. |
index | Index at which to insert the object. 0(first)/-1(last) element. If index is > list size the item will be appended. |
data | Object to insert. |
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruListJoin()
Joins a list of char* item with given delim.
This function should only be called with char* lists.
- Parameters
-
rl | List to join |
delim | Delimiter to join with or NULL for blank |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- Joined string to be freed by the caller
◆ ruListNew()
Creates a new list object. To be freed with ruListFree.
- Parameters
-
valueType | A value specification. Will be freed by this call. |
- Returns
- Guaranteed to return new list object, or process abort.
◆ ruListNextElmt()
Return the next element following the given element from list.
- Parameters
-
re | List element to return follower of. |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- Next element or NULL if given element was the last or an error occured.
◆ ruListSize()
RUAPI uint32_t ruListSize |
( |
ruList |
rl, |
|
|
int32_t * |
code |
|
) |
| |
Returns the number of elements in the list.
- Parameters
-
rl | List to return size of. |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- Number of elements in list or 0 on error.
◆ ruListSort()
RUAPI int32_t ruListSort |
( |
ruList |
rl | ) |
|
Sorts the given list using the associated types comparator function.
- Parameters
-
- Returns
- RUE_OK on success RUE_USER_ABORT when a threaded list has quit else a regify error code.
◆ ruListTail()
Returns the last element in the given list.
- Parameters
-
rl | List to return element of. |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- The last element of the list or NULL on failure.