Debian Codegraph @

src/libarikkei/arikkei-dict.h

raw symbols SCIP
1 #ifndef __ARIKKEI_DICT_H__
2 #define __ARIKKEI_DICT_H__
3
4 /*
5 * Arikkei
6 *
7 * Basic datatypes and code snippets
8 *
9 * Author:
10 * Lauris Kaplinski <[email protected]>
11 *
12 * This code is in public domain
13 *
14 */
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 typedef struct _ArikkeiDict ArikkeiDict;
21 typedef struct _ArikkeiDictEntry ArikkeiDictEntry;
22
23 struct _ArikkeiDict {
24 unsigned int size;
25 unsigned int hashsize;
26 ArikkeiDictEntry *entries;
27 int free;
28 unsigned int (* hash) (const void *data);
29 unsigned int (* equal) (const void *l, const void *r);
30 };
31
32 void arikkei_dict_setup_full (ArikkeiDict *dict, unsigned int hashsize,
33 unsigned int (* hash) (const void *),
34 unsigned int (* equal) (const void *, const void *));
35 void arikkei_dict_setup_string (ArikkeiDict *dict, unsigned int hashsize);
36 void arikkei_dict_setup_pointer (ArikkeiDict *dict, unsigned int hashsize);
37 void arikkei_dict_setup_int (ArikkeiDict *dict, unsigned int hashsize);
38 void arikkei_dict_release (ArikkeiDict *dict);
39
40 void arikkei_dict_insert (ArikkeiDict *dict, const void *key, const void *val);
41 void arikkei_dict_remove (ArikkeiDict *dict, const void *key);
42 void arikkei_dict_clear (ArikkeiDict *dict);
43 unsigned int arikkei_dict_exists (ArikkeiDict *dict, const void *key);
44 const void *arikkei_dict_lookup (ArikkeiDict *dict, const void *key);
45 /* Stop if forall returns 0 */
46 unsigned int arikkei_dict_forall (ArikkeiDict *dict, unsigned int (* forall) (const void *, const void *, void *), void *data);
47
48 /* Utility methods */
49 unsigned int arikkei_string_hash (const void *data);
50 unsigned int arikkei_string_equal (const void *l, const void *r);
51 unsigned int arikkei_pointer_hash (const void *data);
52 unsigned int arikkei_pointer_equal (const void *l, const void *r);
53 unsigned int arikkei_int_hash (const void *data);
54 unsigned int arikkei_int_equal (const void *l, const void *r);
55
56 unsigned int arikkei_memory_hash (const void *data, unsigned int size);
57 unsigned int arikkei_memory_equal (const void *l, const void *r, unsigned int size);
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif