Merge branch '1.37'
[geany-mirror.git] / ctags / main / htable.h
blob03cff361856fe5be42536bd05ee025b243f9c0e5
1 /*
3 * Copyright (c) 2014, Red Hat, Inc.
4 * Copyright (c) 2014, Masatake YAMATO
6 * This source code is released for free distribution under the terms of the
7 * GNU General Public License version 2 or (at your option) any later version.
9 * Defines hashtable
11 #ifndef CTAGS_MAIN_HTABLE_H
12 #define CTAGS_MAIN_HTABLE_H
14 #include "general.h"
16 typedef struct sHashTable hashTable;
17 typedef unsigned int (* hashTableHashFunc) (const void * const key);
18 typedef bool (* hashTableEqualFunc) (const void* a, const void* b);
19 typedef void (* hashTableFreeFunc) (void * ptr);
20 typedef void (* hashTableForeachFunc) (void *key, void *value, void* user_data);
22 unsigned int hashPtrhash (const void * x);
23 bool hashPtreq (const void * a, const void * constb);
25 unsigned int hashCstrhash (const void * x);
26 bool hashCstreq (const void * a, const void * b);
28 unsigned int hashCstrcasehash (const void * x);
29 bool hashCstrcaseeq (const void * a, const void * b);
31 unsigned int hashInthash (const void * x);
32 bool hashInteq (const void * a, const void * b);
34 extern hashTable* hashTableNew (unsigned int size,
35 hashTableHashFunc hashfn,
36 hashTableEqualFunc equalfn,
37 hashTableFreeFunc keyfreefn,
38 hashTableFreeFunc valfreefn);
39 extern void hashTableDelete (hashTable *htable);
40 extern void hashTableClear (hashTable *htable);
41 extern void hashTablePutItem (hashTable *htable, void *key, void *value);
42 extern void* hashTableGetItem (hashTable *htable, const void * key);
43 extern bool hashTableHasItem (hashTable * htable, const void * key);
44 extern bool hashTableDeleteItem (hashTable *htable, void *key);
45 extern void hashTableForeachItem (hashTable *htable, hashTableForeachFunc proc, void *user_data);
46 extern int hashTableCountItem (hashTable *htable);
48 #endif /* CTAGS_MAIN_HTABLE_H */