38 UNICHARMAP_NODE* current_nodes = nodes;
40 assert(*unichar_repr !=
'\0');
44 if (index >= length || unichar_repr[index] ==
'\0')
return INVALID_UNICHAR_ID;
46 if (index + 1 >= length || unichar_repr[index + 1] ==
'\0')
47 return current_nodes[
static_cast<unsigned char>(unichar_repr[index])].
id;
49 current_nodes[
static_cast<unsigned char>(unichar_repr[index])].children;
59 const char* current_char = unichar_repr;
60 if (*current_char ==
'\0')
return;
61 UNICHARMAP_NODE** current_nodes_pointer = &nodes;
63 if (*current_nodes_pointer ==
nullptr)
64 *current_nodes_pointer =
new UNICHARMAP_NODE[256];
65 if (current_char[1] ==
'\0') {
66 (*current_nodes_pointer)
67 [
static_cast<unsigned char>(*current_char)].id = id;
70 current_nodes_pointer =
71 &((*current_nodes_pointer)
72 [
static_cast<unsigned char>(*current_char)].children);
83 if (unichar_repr ==
nullptr || *unichar_repr ==
'\0')
return false;
84 if (length <= 0 || length >
UNICHAR_LEN)
return false;
86 if (unichar_repr[index] ==
'\0')
return false;
87 UNICHARMAP_NODE* current_nodes = nodes;
89 while (current_nodes !=
nullptr && index + 1 < length &&
90 unichar_repr[index + 1] !=
'\0') {
92 current_nodes[
static_cast<unsigned char>(unichar_repr[index])].children;
95 return current_nodes !=
nullptr &&
96 (index + 1 >= length || unichar_repr[index + 1] ==
'\0') &&
97 current_nodes[static_cast<unsigned char>(unichar_repr[index])].id >= 0;
103 const char* current_char = unichar_repr;
104 if (*current_char ==
'\0')
return 0;
105 UNICHARMAP_NODE* current_nodes = nodes;
107 while (current_nodes !=
nullptr && *current_char !=
'\0') {
108 if (current_nodes[static_cast<unsigned char>(*current_char)].
id >= 0)
109 return current_char + 1 - unichar_repr;
111 current_nodes[
static_cast<unsigned char>(*current_char)].children;
122 UNICHARMAP::UNICHARMAP_NODE::UNICHARMAP_NODE() :
128 UNICHARMAP::UNICHARMAP_NODE::~UNICHARMAP_NODE() {
UNICHAR_ID unichar_to_id(const char *const unichar_repr, int length) const
bool contains(const char *const unichar_repr, int length) const
void insert(const char *const unichar_repr, UNICHAR_ID id)
int minmatch(const char *const unichar_repr) const