00001 /* 00002 * squareball: A general-purpose library for C99. 00003 * Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br> 00004 * 00005 * This program can be distributed under the terms of the BSD License. 00006 * See the file LICENSE. 00007 */ 00008 00009 #ifndef _SQUAREBALL_TRIE_H 00010 #define _SQUAREBALL_TRIE_H 00011 00012 #include <stdbool.h> 00013 #include <stdlib.h> 00014 #include <stdarg.h> 00015 #include "sb-mem.h" 00016 00030 typedef struct _sb_trie_t sb_trie_t; 00031 00035 typedef void (*sb_trie_foreach_func_t)(const char *key, void *data, 00036 void *user_data); 00037 00047 sb_trie_t* sb_trie_new(sb_free_func_t free_func); 00048 00055 void sb_trie_free(sb_trie_t *trie); 00056 00068 void sb_trie_insert(sb_trie_t *trie, const char *key, void *data); 00069 00077 void* sb_trie_lookup(sb_trie_t *trie, const char *key); 00078 00085 size_t sb_trie_size(sb_trie_t *trie); 00086 00094 void sb_trie_foreach(sb_trie_t *trie, sb_trie_foreach_func_t func, 00095 void *user_data); 00096 00099 #endif /* _SQUAREBALL_TRIE_H */