poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
dictionary.h
Go to the documentation of this file.
1#ifndef POSER_CORE_DICTIONARY_H
2#define POSER_CORE_DICTIONARY_H
3
8#include <poser/decl.h>
9
10#include <stddef.h>
11
30C_CLASS_DECL(PSC_Dictionary);
31
36DECLDATA void (*PSC_DICT_NODELETE)(void *);
37
50DECLEXPORT PSC_Dictionary *
51PSC_Dictionary_create(void (*deleter)(void *));
52
64DECLEXPORT void
65PSC_Dictionary_set(PSC_Dictionary *self, const void *key, size_t keysz,
66 void *obj, void (*deleter)(void *))
67 CMETHOD ATTR_NONNULL((2));
68
76DECLEXPORT void *
77PSC_Dictionary_get(const PSC_Dictionary *self, const void *key, size_t keysz)
78 CMETHOD ATTR_PURE ATTR_NONNULL((2));
79
85DECLEXPORT size_t
87 CMETHOD ATTR_PURE;
88
99DECLEXPORT size_t
101 int (*matcher)(const void *, size_t, void *, const void *),
102 const void *arg)
103 CMETHOD ATTR_NONNULL((1));
104
111void
113
114#endif
A dictionary storing any data objects using any type of keys.
PSC_Dictionary * PSC_Dictionary_create(void(*deleter)(void *))
PSC_Dictionary default constructor.
size_t PSC_Dictionary_removeAll(PSC_Dictionary *self, int(*matcher)(const void *, size_t, void *, const void *), const void *arg)
Remove all matching entries from dictionary.
void * PSC_Dictionary_get(const PSC_Dictionary *self, const void *key, size_t keysz)
Retrieve a stored object by its key.
void PSC_Dictionary_destroy(PSC_Dictionary *self)
PSC_Dictionary destructor.
void PSC_Dictionary_set(PSC_Dictionary *self, const void *key, size_t keysz, void *obj, void(*deleter)(void *))
Set a new object for a given key.
size_t PSC_Dictionary_count(const PSC_Dictionary *self)
The total number of stored objects.