libircbot
library providing a framework for implementing an IRC bot
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1#ifndef IRCBOT_LIST_H
2#define IRCBOT_LIST_H
3
4#include <ircbot/decl.h>
5
6#include <stddef.h>
7
15C_CLASS_DECL(IBList);
16
20C_CLASS_DECL(IBListIterator);
21
27DECLEXPORT IBList *IBList_create(void) ATTR_RETNONNULL;
28
34DECLEXPORT size_t IBList_size(const IBList *self) CMETHOD ATTR_PURE;
35
42DECLEXPORT void *IBList_at(const IBList *self, size_t idx) CMETHOD ATTR_PURE;
43
50DECLEXPORT void IBList_append(IBList *self, void *obj, void (*deleter)(void *))
51 CMETHOD ATTR_NONNULL((2));
52
59DECLEXPORT void IBList_remove(IBList *self, void *obj)
60 CMETHOD ATTR_NONNULL((2));
61
71DECLEXPORT void IBList_removeAll(IBList *self,
72 int (*matcher)(void *, const void *), const void *arg)
73 CMETHOD ATTR_NONNULL((2));
74
83DECLEXPORT IBListIterator *IBList_iterator(const IBList *self) CMETHOD;
84
90DECLEXPORT void IBList_destroy(IBList *self);
91
99DECLEXPORT int IBListIterator_moveNext(IBListIterator *self) CMETHOD;
100
106DECLEXPORT void *IBListIterator_current(const IBListIterator *self)
107 CMETHOD ATTR_PURE;
108
114
123DECLEXPORT IBList *IBList_fromString(const char *str, const char *delim);
124
125#endif
A list of objects.
void IBList_remove(IBList *self, void *obj)
Remove a given object from the list.
void * IBList_at(const IBList *self, size_t idx)
Gets an object by position.
size_t IBList_size(const IBList *self)
Number of entries.
void IBList_append(IBList *self, void *obj, void(*deleter)(void *))
Append an object to the list.
IBList * IBList_fromString(const char *str, const char *delim)
Create a List of strings by splitting a given string.
IBListIterator * IBList_iterator(const IBList *self)
Creates an iterator for all entries.
IBList * IBList_create(void)
IBList default constructor.
void IBList_destroy(IBList *self)
IBList destructor.
void IBList_removeAll(IBList *self, int(*matcher)(void *, const void *), const void *arg)
Remove matching objects from the list.
An iterator over the contents of an IBList.
void * IBListIterator_current(const IBListIterator *self)
Gets the object at the current position.
void IBListIterator_destroy(IBListIterator *self)
IBListIterator destructor.
int IBListIterator_moveNext(IBListIterator *self)
Move to the next position.
Common preprocessor declarations for libircbot.