8
8
#ifndef __ALPHA_MAP_H
9
9
#define __ALPHA_MAP_H
11
13
#include "typedefs.h"
12
14
#include "triedefs.h"
14
typedef uint16 UniChar;
16
#define UNI_CHAR_ERROR (~(UniChar)0)
18
* @brief AlphaMap data type and functions
22
* @brief AlphaMap data type
18
24
typedef struct _AlphaMap AlphaMap;
20
AlphaMap * alpha_map_open (const char *path,
27
* @brief Create new alphabet map
29
* @return a pointer to the newly created alphabet map, NULL on failure
31
* Create a new empty alphabet map. The map contents can then be added with
32
* alpha_map_add_range().
34
* The created object must be freed with alpha_map_free().
36
AlphaMap * alpha_map_new ();
39
* @brief Create a clone of alphabet map
41
* @param a_map : the source alphabet map to clone
43
* @return a pointer to the alphabet map clone, NULL on failure
45
* The created object must be freed with alpha_map_free().
47
AlphaMap * alpha_map_clone (const AlphaMap *a_map);
50
* @brief Free an alphabet map object
52
* @param alpha_map : the alphabet map object to free
54
* Destruct the @a alpha_map and free its allocated memory.
24
56
void alpha_map_free (AlphaMap *alpha_map);
26
TrieChar alpha_map_char_to_alphabet (const AlphaMap *alpha_map, UniChar uc);
28
UniChar alpha_map_alphabet_to_char (const AlphaMap *alpha_map, TrieChar tc);
59
* @brief Add a range to alphabet map
61
* @param alpha_map : the alphabet map object
62
* @param begin : the first character of the range
63
* @param end : the last character of the range
65
* Add a range of character codes from @a begin to @a end to the
68
int alpha_map_add_range (AlphaMap *alpha_map,
73
* @brief Alphabet string length
75
* @param str : the array of null-terminated AlphaChar string to measure
77
* @return the total characters in @a str.
79
int alpha_char_strlen (const AlphaChar *str);
31
81
#endif /* __ALPHA_MAP_H */