poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1#ifndef POSER_CORE_LIST_H
2#define POSER_CORE_LIST_H
3
4#include <poser/decl.h>
5
6#include <stddef.h>
7
15C_CLASS_DECL(PSC_List);
16
20C_CLASS_DECL(PSC_ListIterator);
21
27DECLEXPORT PSC_List *
29 ATTR_RETNONNULL;
30
36DECLEXPORT size_t
38 CMETHOD ATTR_PURE;
39
46DECLEXPORT void *
47PSC_List_at(const PSC_List *self, size_t idx)
48 CMETHOD ATTR_PURE;
49
56DECLEXPORT void
57PSC_List_append(PSC_List *self, void *obj, void (*deleter)(void *))
58 CMETHOD ATTR_NONNULL((2));
59
66DECLEXPORT void
67PSC_List_remove(PSC_List *self, void *obj)
68 CMETHOD ATTR_NONNULL((2));
69
79DECLEXPORT void
80PSC_List_removeAll(PSC_List *self, int (*matcher)(void *, const void *),
81 const void *arg)
82 CMETHOD ATTR_NONNULL((2));
83
92DECLEXPORT PSC_ListIterator *
94 CMETHOD;
95
101DECLEXPORT void
103
111DECLEXPORT int
113 CMETHOD;
114
120DECLEXPORT void *
122 CMETHOD ATTR_PURE;
123
128DECLEXPORT void
130
139DECLEXPORT PSC_List *
140PSC_List_fromString(const char *str, const char *delim);
141
142#endif
A list of objects.
void * PSC_List_at(const PSC_List *self, size_t idx)
Gets an object by position.
void PSC_List_append(PSC_List *self, void *obj, void(*deleter)(void *))
Append an object to the list.
PSC_ListIterator * PSC_List_iterator(const PSC_List *self)
Creates an iterator for all entries.
void PSC_List_removeAll(PSC_List *self, int(*matcher)(void *, const void *), const void *arg)
Remove matching objects from the list.
PSC_List * PSC_List_create(void)
PSC_List default constructor.
void PSC_List_destroy(PSC_List *self)
PSC_List destructor.
void PSC_List_remove(PSC_List *self, void *obj)
Remove a given object from the list.
size_t PSC_List_size(const PSC_List *self)
Number of entries.
PSC_List * PSC_List_fromString(const char *str, const char *delim)
Create a List of strings by splitting a given string.
An iterator over the contents of a PSC_List.
void * PSC_ListIterator_current(const PSC_ListIterator *self)
Gets the object at the current position.
int PSC_ListIterator_moveNext(PSC_ListIterator *self)
Move to the next position.
void PSC_ListIterator_destroy(PSC_ListIterator *self)
PSC_ListIterator destructor.