Collection
Loading...
Searching...
No Matches
IArray Struct Reference

Interface for a thread-safe, generic, singly linked list. More...

#include <IArray.h>

Public Attributes

const void *(* unshift )(struct IArray *self, const void *item)
 Inserts an item at the beginning of the list.
const void *(* push )(struct IArray *self, const void *item)
 Appends an item at the end of the list.
bool(* containsValue )(const struct IArray *self, const void *item)
 Checks if the list contains a specific item.
const void *(* shift )(struct IArray *self)
 Removes and returns the first item in the list.
const void *(* pop )(struct IArray *self)
 Removes and returns the last item in the list.
void *(* removeItem )(struct IArray *self, const void *item)
 Removes and returns a specific item from the list.
struct IArray *(* clone )(const struct IArray *self)
 Clones the list (shallow copy).
int(* size )(const struct IArray *self)
 Returns the number of items in the list.
void(* clear )(struct IArray *self, void(*callback)(void *item))
 Clears all items from the list.

Detailed Description

Interface for a thread-safe, generic, singly linked list.

Member Data Documentation

◆ clear

void(* IArray::clear) (struct IArray *self, void(*callback)(void *item))

Clears all items from the list.

Parameters
selfPointer to the IArray instance.
callbackOptional callback called on each item before it is freed. Can be NULL.

◆ clone

struct IArray *(* IArray::clone) (const struct IArray *self)

Clones the list (shallow copy).

Parameters
selfPointer to the IArray instance.
Returns
A new IArray instance that is a shallow copy of the original, or NULL on failure.

◆ containsValue

bool(* IArray::containsValue) (const struct IArray *self, const void *item)

Checks if the list contains a specific item.

Parameters
selfPointer to the IArray instance.
itemPointer to the item to search for.
Returns
true if the item exists in the list, false otherwise.

◆ pop

const void *(* IArray::pop) (struct IArray *self)

Removes and returns the last item in the list.

Parameters
selfPointer to the IArray instance.
Returns
The removed item pointer, or NULL if list is empty.

◆ push

const void *(* IArray::push) (struct IArray *self, const void *item)

Appends an item at the end of the list.

Parameters
selfPointer to the IArray instance.
itemPointer to the item to append.
Returns
The appended item pointer on success, or NULL on failure.

◆ removeItem

void *(* IArray::removeItem) (struct IArray *self, const void *item)

Removes and returns a specific item from the list.

Parameters
selfPointer to the IArray instance.
itemPointer to the item to remove.
Returns
The removed item pointer, or NULL if not found.

◆ shift

const void *(* IArray::shift) (struct IArray *self)

Removes and returns the first item in the list.

Parameters
selfPointer to the IArray instance.
Returns
The removed item pointer, or NULL if list is empty.

◆ size

int(* IArray::size) (const struct IArray *self)

Returns the number of items in the list.

Parameters
selfPointer to the IArray instance.
Returns
Number of items in the list.

◆ unshift

const void *(* IArray::unshift) (struct IArray *self, const void *item)

Inserts an item at the beginning of the list.

Parameters
selfPointer to the IArray instance.
itemPointer to the item to insert.
Returns
The inserted item pointer on success, or NULL on failure.

The documentation for this struct was generated from the following file: