68 lines
1.9 KiB
C
68 lines
1.9 KiB
C
#ifndef FX_DS_LIST_H_
|
|
#define FX_DS_LIST_H_
|
|
|
|
#include <fx/iterator.h>
|
|
#include <fx/macros.h>
|
|
#include <fx/status.h>
|
|
|
|
FX_DECLS_BEGIN;
|
|
|
|
#define FX_TYPE_LIST (fx_list_get_type())
|
|
#define FX_TYPE_LIST_ITERATOR (fx_list_iterator_get_type())
|
|
|
|
struct fx_list_p;
|
|
|
|
FX_DECLARE_TYPE(fx_list);
|
|
FX_DECLARE_TYPE(fx_list_iterator);
|
|
|
|
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_list)
|
|
FX_TYPE_CLASS_DECLARATION_END(fx_list)
|
|
|
|
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_list_iterator)
|
|
FX_TYPE_CLASS_DECLARATION_END(fx_list_iterator)
|
|
|
|
typedef struct fx_list_entry fx_list_entry;
|
|
|
|
FX_API fx_type fx_list_get_type(void);
|
|
FX_API fx_type fx_list_iterator_get_type(void);
|
|
|
|
FX_TYPE_DEFAULT_CONSTRUCTOR(fx_list, FX_TYPE_LIST);
|
|
|
|
FX_API bool fx_list_empty(fx_list *q);
|
|
FX_API void *fx_list_first_item(const fx_list *q);
|
|
FX_API void *fx_list_last_item(const fx_list *q);
|
|
FX_API fx_list_entry *fx_list_first_entry(const fx_list *q);
|
|
FX_API fx_list_entry *fx_list_last_entry(const fx_list *q);
|
|
FX_API fx_list_entry *fx_list_next(const fx_list_entry *entry);
|
|
FX_API fx_list_entry *fx_list_prev(const fx_list_entry *entry);
|
|
|
|
FX_API size_t fx_list_length(const fx_list *q);
|
|
|
|
FX_API fx_list_entry *fx_list_insert_before(
|
|
fx_list *q,
|
|
void *ptr,
|
|
fx_list_entry *before);
|
|
FX_API fx_list_entry *fx_list_insert_after(
|
|
fx_list *q,
|
|
void *ptr,
|
|
fx_list_entry *after);
|
|
|
|
FX_API fx_list_entry *fx_list_push_front(fx_list *q, void *ptr);
|
|
FX_API fx_list_entry *fx_list_push_back(fx_list *q, void *ptr);
|
|
|
|
FX_API void *fx_list_pop_front(fx_list *q);
|
|
FX_API void *fx_list_pop_back(fx_list *q);
|
|
|
|
FX_API fx_status fx_list_delete_item(fx_list *q, void *ptr);
|
|
FX_API fx_status fx_list_delete_entry(fx_list *q, fx_list_entry *entry);
|
|
FX_API void fx_list_delete_all(fx_list *q);
|
|
|
|
FX_API void *fx_list_entry_value(const fx_list_entry *entry);
|
|
|
|
FX_API fx_iterator *fx_list_begin(fx_list *q);
|
|
FX_API const fx_iterator *fx_list_cbegin(const fx_list *q);
|
|
|
|
FX_DECLS_END;
|
|
|
|
#endif
|