Typedefs | |
typedef _SBTrie | SBTrie |
Single-byte domain trie data type. | |
typedef unsigned char | SBChar |
Single-byte character type. | |
typedef Bool(*) | SBTrieEnumFunc (const SBChar *key, TrieData key_data, void *user_data) |
Single-byte domain trie enumeration function. | |
typedef _SBTrieState | SBTrieState |
Single-byte domain trie walking state. | |
Functions | |
SBTrie * | sb_trie_open (const char *path, const char *name, TrieIOMode mode) |
Open a single-byte domain trie. | |
int | sb_trie_close (SBTrie *sb_trie) |
Close a single-byte domain trie. | |
int | sb_trie_save (SBTrie *sb_trie) |
Save a single-byte domain trie. | |
Bool | sb_trie_retrieve (SBTrie *sb_trie, const SBChar *key, TrieData *o_data) |
Retrieve an entry from single-byte domain trie. | |
Bool | sb_trie_store (SBTrie *sb_trie, const SBChar *key, TrieData data) |
Store a value for an entry to single-byte domain trie. | |
Bool | sb_trie_delete (SBTrie *sb_trie, const SBChar *key) |
Delete an entry from single-byte domain trie. | |
Bool | sb_trie_enumerate (SBTrie *sb_trie, SBTrieEnumFunc enum_func, void *user_data) |
Enumerate entries in single-byte domain trie. | |
SBTrieState * | sb_trie_root (SBTrie *sb_trie) |
Get root state of a single-byte domain trie. | |
SBTrieState * | sb_trie_state_clone (const SBTrieState *s) |
Clone a single-byte domain trie state. | |
void | sb_trie_state_free (SBTrieState *s) |
Free a single-byte trie state. | |
void | sb_trie_state_rewind (SBTrieState *s) |
Rewind a single-byte trie state. | |
Bool | sb_trie_state_walk (SBTrieState *s, SBChar c) |
Walk the single-byte domain trie from the state. | |
Bool | sb_trie_state_is_walkable (const SBTrieState *s, SBChar c) |
Test walkability of character from state. | |
Bool | sb_trie_state_is_terminal (const SBTrieState *s) |
Check for terminal state. | |
Bool | sb_trie_state_is_leaf (const SBTrieState *s) |
Check for leaf state. | |
TrieData | sb_trie_state_get_data (const SBTrieState *s) |
Get data from leaf state. |
typedef Bool(*) SBTrieEnumFunc(const SBChar *key, TrieData key_data, void *user_data) |
Single-byte domain trie enumeration function.
key | : the key of the entry | |
data | : the data of the entry |
int sb_trie_close | ( | SBTrie * | sb_trie | ) |
Close a single-byte domain trie.
sb_trie,: | the single-byte domain trie |
Delete an entry from single-byte domain trie.
sb_trie | : the single-byte domain trie | |
key | : the key for the entry to delete |
Bool sb_trie_enumerate | ( | SBTrie * | sb_trie, | |
SBTrieEnumFunc | enum_func, | |||
void * | user_data | |||
) |
Enumerate entries in single-byte domain trie.
sb_trie | : the single-byte domain 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 |
SBTrie* sb_trie_open | ( | const char * | path, | |
const char * | name, | |||
TrieIOMode | mode | |||
) |
Open a single-byte domain 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 single-byte domain trie.
sb_trie | : the single-byte domain trie | |
key | : the key for the entry to retrieve | |
o_data | : the storage for storing the entry data on return |
SBTrieState* sb_trie_root | ( | SBTrie * | sb_trie | ) |
Get root state of a single-byte domain trie.
sb_trie | : the single-byte domain trie |
The returned state is allocated and must be freed with trie_state_free()
int sb_trie_save | ( | SBTrie * | sb_trie | ) |
Save a single-byte domain trie.
sb_trie,: | the single-byte domain trie |
SBTrieState* sb_trie_state_clone | ( | const SBTrieState * | s | ) |
Clone a single-byte domain trie state.
s | : the state to clone |
The returned state is allocated and must be freed with trie_state_free()
void sb_trie_state_free | ( | SBTrieState * | s | ) |
Free a single-byte trie state.
s | : the state to free |
TrieData sb_trie_state_get_data | ( | const SBTrieState * | s | ) |
Get data from leaf state.
s | : the leaf state |
Bool sb_trie_state_is_leaf | ( | const SBTrieState * | s | ) |
Check for leaf state.
s | : the state to check |
Bool sb_trie_state_is_terminal | ( | const SBTrieState * | s | ) |
Check for terminal state.
s | : the state to check |
Bool sb_trie_state_is_walkable | ( | const SBTrieState * | s, | |
SBChar | c | |||
) |
Test walkability of character from state.
s | : the state to check | |
c | : the input character |
void sb_trie_state_rewind | ( | SBTrieState * | s | ) |
Rewind a single-byte trie state.
s | : the state to rewind |
Bool sb_trie_state_walk | ( | SBTrieState * | s, | |
SBChar | c | |||
) |
Walk the single-byte domain trie from the state.
s | : current state | |
c | : key character for walking |
Store a value for an entry to single-byte domain trie.
sb_trie | : the single-byte domain trie | |
key | : the key for the entry to retrieve | |
data | : the data associated to the entry |