![]() | ![]() | ![]() | Evolution API Reference: libedataserver, utility library | ![]() |
---|
ETrie — A trie data structure.
#include <libedataserver/e-trie.h> struct ETrie; ETrie* e_trie_new (gboolean icase); void e_trie_free (ETrie *trie); void e_trie_add (ETrie *trie, const char *pattern, int pattern_id); const char* e_trie_search (ETrie *trie, const char *buffer, size_t buflen, int *matched_id);
ETrie* e_trie_new (gboolean icase);
Creates a new ETrie. If icase is TRUE, then pattern matching done by the ETrie will be case insensitive.
void e_trie_free (ETrie *trie);
Frees the memory associated with the ETrie trie.
trie : | The ETrie to free. |
void e_trie_add (ETrie *trie, const char *pattern, int pattern_id);
Add a new pattern to the ETrie trie.
trie : | The ETrie to add a pattern to. |
pattern : | The pattern to add. |
pattern_id : | The id to use for the pattern. |
const char* e_trie_search (ETrie *trie, const char *buffer, size_t buflen, int *matched_id);
Try to match the string buffer with a pattern in trie.
trie : | The ETrie to search in. |
buffer : | The string to match against a pattern in trie. |
buflen : | The length of buffer. |
matched_id : | An integer address to store the matched pattern id in. |
Returns : | The matched pattern, or NULL if no pattern is matched. |
<< Time-Related Utility Functions | Utility Functions >> |