ETrie
3
LIBEDATASERVER Library

# ETrie

A trie data structure.

## Synopsis

                        ETrie;
    ETrie *             e_trie_new                          (gboolean icase);
    void                e_trie_free                         (ETrie *trie);
    void                e_trie_add                          (ETrie *trie,
                                                             const gchar *pattern,
                                                             gint pattern_id);
    const gchar *       e_trie_search                       (ETrie *trie,
                                                             const gchar *buffer,
                                                             gsize buflen,
                                                             gint *matched_id);

## Description

## Details

### ETrie

    typedef struct _ETrie ETrie;

`ETrie` is deprecated and should not be used in newly-written code.

A trie data structure.

### e_trie_new ()

    ETrie *             e_trie_new                          (gboolean icase);

`e_trie_new` is deprecated and should not be used in newly-written code.

Creates a new ETrie. If `icase` is `TRUE`, then pattern matching done by the ETrie will be case insensitive.

`icase` :

  Case sensitivity for the ETrie.

Returns :

  The newly-created ETrie.

### e_trie_free ()

    void                e_trie_free                         (ETrie *trie);

`e_trie_free` is deprecated and should not be used in newly-written code.

Frees the memory associated with the ETrie `trie`.

`trie` :

  The ETrie to free.

### e_trie_add ()

    void                e_trie_add                          (ETrie *trie,
                                                             const gchar *pattern,
                                                             gint pattern_id);

`e_trie_add` is deprecated and should not be used in newly-written code.

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.

### e_trie_search ()

    const gchar *       e_trie_search                       (ETrie *trie,
                                                             const gchar *buffer,
                                                             gsize buflen,
                                                             gint *matched_id);

`e_trie_search` is deprecated and should not be used in newly-written code.

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.