Defines | |
#define | trie_state_is_terminal(s) trie_state_is_walkable((s),TRIE_CHAR_TERM) |
Check for terminal state. | |
Typedefs | |
typedef _Trie | Trie |
Trie data type. | |
typedef Bool(*) | TrieEnumFunc (const TrieChar *key, TrieData key_data, void *user_data) |
Trie enumeration function. | |
typedef _TrieState | TrieState |
Trie walking state. | |
Functions | |
Trie * | trie_open (const char *path, const char *name, TrieIOMode mode) |
Open a trie. | |
int | trie_close (Trie *trie) |
Close a trie. | |
int | trie_save (Trie *trie) |
Save a trie. | |
Bool | trie_retrieve (Trie *trie, const TrieChar *key, TrieData *o_data) |
Retrieve an entry from trie. | |
Bool | trie_store (Trie *trie, const TrieChar *key, TrieData data) |
Store a value for an entry to trie. | |
Bool | trie_delete (Trie *trie, const TrieChar *key) |
Delete an entry from trie. | |
Bool | trie_enumerate (Trie *trie, TrieEnumFunc enum_func, void *user_data) |
Enumerate entries in trie. | |
TrieState * | trie_root (Trie *trie) |
Get root state of a trie. | |
TrieState * | trie_state_clone (const TrieState *s) |
Clone a trie state. | |
void | trie_state_free (TrieState *s) |
Free a trie state. | |
void | trie_state_rewind (TrieState *s) |
Rewind a trie state. | |
Bool | trie_state_walk (TrieState *s, TrieChar c) |
Walk the trie from the state. | |
Bool | trie_state_is_walkable (const TrieState *s, TrieChar c) |
Test walkability of character from state. | |
Bool | trie_state_is_leaf (const TrieState *s) |
Check for leaf state. | |
TrieData | trie_state_get_data (const TrieState *s) |
Get data from leaf state. |
#define trie_state_is_terminal | ( | s | ) | trie_state_is_walkable((s),TRIE_CHAR_TERM) |
Check for terminal state.
s | : the state to check |
typedef Bool(*) TrieEnumFunc(const TrieChar *key, TrieData key_data, void *user_data) |
Trie enumeration function.
key | : the key of the entry | |
data | : the data of the entry |
int trie_close | ( | Trie * | trie | ) |
Close a trie.
trie,: | the trie |
Delete an entry from trie.
trie | : the trie | |
key | : the key for the entry to delete |
Bool trie_enumerate | ( | Trie * | trie, | |
TrieEnumFunc | enum_func, | |||
void * | user_data | |||
) |
Enumerate entries in trie.
trie | : the trie | |
enum_func | : the callback function to be called on each key | |
user_data | : user-supplied data to send as an argument to enum_func |
Trie* trie_open | ( | const char * | path, | |
const char * | name, | |||
TrieIOMode | mode | |||
) |
Open a trie.
path | : the path that stores the trie files | |
name | : the name of the trie (not actual file name) | |
mode | : openning mode, read or write |
Retrieve an entry from trie.
trie | : the trie | |
key | : the key for the entry to retrieve | |
o_data | : the storage for storing the entry data on return |
Get root state of a trie.
trie | : the trie |
The returned state is allocated and must be freed with trie_state_free()
int trie_save | ( | Trie * | trie | ) |
Save a trie.
trie,: | the trie |
Clone a trie state.
s | : the state to clone |
The returned state is allocated and must be freed with trie_state_free()
void trie_state_free | ( | TrieState * | s | ) |
Free a trie state.
s | : the state to free |
Get data from leaf state.
s | : the leaf state |
Bool trie_state_is_leaf | ( | const TrieState * | s | ) |
Check for leaf state.
s | : the state to check |
Test walkability of character from state.
s | : the state to check | |
c | : the input character |
void trie_state_rewind | ( | TrieState * | s | ) |
Rewind a trie state.
s | : the state to rewind |
Walk the trie from the state.
s | : current state | |
c | : key character for walking |
Store a value for an entry to trie.
trie | : the trie | |
key | : the key for the entry to retrieve | |
data | : the data associated to the entry |