#ifndef UCX_LIST_H
#define UCX_LIST_H
#include "ucx.h"
#include "allocator.h"
#ifdef __cplusplus
extern "C" {
#endif
#define UCX_FOREACH(elem,list) \
for (UcxList* elem = list ; elem !=
NULL ; elem = elem->next)
typedef struct UcxList UcxList;
struct UcxList {
void *data;
UcxList *next;
UcxList *prev;
};
UcxList *ucx_list_clone(UcxList *list, copy_func cpyfnc,
void* data);
UcxList *ucx_list_clone_a(UcxAllocator *allocator, UcxList *list,
copy_func cpyfnc,
void* data);
int ucx_list_equals(
const UcxList *list1,
const UcxList *list2,
cmp_func cmpfnc,
void* data);
void ucx_list_free(UcxList *list);
void ucx_list_free_a(UcxAllocator *allocator, UcxList *list);
void ucx_list_free_content(UcxList* list, ucx_destructor destr);
UcxList *ucx_list_append(UcxList *list,
void *data);
UcxList *ucx_list_append_a(UcxAllocator *allocator, UcxList *list,
void *data);
UcxList *ucx_list_prepend(UcxList *list,
void *data);
UcxList *ucx_list_prepend_a(UcxAllocator *allocator, UcxList *list,
void *data);
UcxList *ucx_list_concat(UcxList *list1, UcxList *list2);
UcxList *ucx_list_first(
const UcxList *elem);
UcxList *ucx_list_last(
const UcxList *elem);
UcxList *ucx_list_get(
const UcxList *list,
size_t index);
ssize_t ucx_list_indexof(
const UcxList *list,
const UcxList *elem);
size_t ucx_list_size(
const UcxList *list);
ssize_t ucx_list_find(UcxList *list,
void *elem, cmp_func cmpfnc,
void *data);
int ucx_list_contains(UcxList *list,
void *elem, cmp_func cmpfnc,
void *data);
UcxList *ucx_list_sort(UcxList *list, cmp_func cmpfnc,
void *data);
UcxList *ucx_list_remove(UcxList *list, UcxList *element);
UcxList *ucx_list_remove_a(UcxAllocator *allocator, UcxList *list,
UcxList *element);
#ifdef __cplusplus
}
#endif
#endif