| 1 |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* libdatrie - Double-Array Trie Library |
| 4 |
* Copyright (C) 2006 Theppitak Karoonboonyanan <[email protected]> |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2.1 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this library; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
* trie-string.h - Dynamic string type for Trie alphabets |
| 23 |
* Created: 2012-08-02 |
| 24 |
* Author: Theppitak Karoonboonyanan <[email protected]> |
| 25 |
*/ |
| 26 |
|
| 27 |
#ifndef __TRIE_STRING_H |
| 28 |
#define __TRIE_STRING_H |
| 29 |
|
| 30 |
#include "dstring.h" |
| 31 |
#include "triedefs.h" |
| 32 |
|
| 33 |
#include <stddef.h> |
| 34 |
|
| 35 |
/*----------------------------* |
| 36 |
* STATIC TRIECHAR STRING * |
| 37 |
*----------------------------*/ |
| 38 |
|
| 39 |
size_t trie_char_strlen (const TrieChar *str); |
| 40 |
|
| 41 |
size_t trie_char_strsize (const TrieChar *str); |
| 42 |
|
| 43 |
TrieChar * trie_char_strdup (const TrieChar *str); |
| 44 |
|
| 45 |
/*-----------------------------* |
| 46 |
* DYNAMIC TRIECHAR STRING * |
| 47 |
*-----------------------------*/ |
| 48 |
|
| 49 |
typedef struct _TrieString TrieString; |
| 50 |
|
| 51 |
TrieString * trie_string_new (int n_elm); |
| 52 |
|
| 53 |
void trie_string_free (TrieString *ts); |
| 54 |
|
| 55 |
int trie_string_length (const TrieString *ts); |
| 56 |
|
| 57 |
const void * trie_string_get_val (const TrieString *ts); |
| 58 |
|
| 59 |
void * trie_string_get_val_rw (TrieString *ts); |
| 60 |
|
| 61 |
void trie_string_clear (TrieString *ts); |
| 62 |
|
| 63 |
Bool trie_string_copy (TrieString *dst, const TrieString *src); |
| 64 |
|
| 65 |
Bool trie_string_append (TrieString *dst, const TrieString *src); |
| 66 |
|
| 67 |
Bool trie_string_append_string (TrieString *ts, const TrieChar *str); |
| 68 |
|
| 69 |
Bool trie_string_append_char (TrieString *ts, TrieChar tc); |
| 70 |
|
| 71 |
Bool trie_string_terminate (TrieString *ts); |
| 72 |
|
| 73 |
Bool trie_string_cut_last (TrieString *ts); |
| 74 |
|
| 75 |
|
| 76 |
#endif /* __TRIE_STRING_H */ |
| 77 |
|
| 78 |
/* |
| 79 |
vi:ts=4:ai:expandtab |
| 80 |
*/ |
| 81 |
|