#include <unicharmap.h>
Definition at line 27 of file unicharmap.h.
◆ UNICHARMAP()
UNICHARMAP::UNICHARMAP |
( |
| ) |
|
◆ ~UNICHARMAP()
UNICHARMAP::~UNICHARMAP |
( |
| ) |
|
◆ clear()
void UNICHARMAP::clear |
( |
| ) |
|
◆ contains()
bool UNICHARMAP::contains |
( |
const char *const |
unichar_repr, |
|
|
int |
length |
|
) |
| const |
Definition at line 79 of file unicharmap.cpp.
81 if (unichar_repr ==
nullptr || *unichar_repr ==
'\0')
return false;
82 if (length <= 0 || length >
UNICHAR_LEN)
return false;
84 if (unichar_repr[index] ==
'\0')
return false;
85 UNICHARMAP_NODE* current_nodes = nodes;
87 while (current_nodes !=
nullptr && index + 1 < length &&
88 unichar_repr[index + 1] !=
'\0') {
90 current_nodes[static_cast<unsigned char>(unichar_repr[index])].children;
93 return current_nodes !=
nullptr &&
94 (index + 1 >= length || unichar_repr[index + 1] ==
'\0') &&
95 current_nodes[static_cast<unsigned char>(unichar_repr[index])].id >= 0;
◆ insert()
void UNICHARMAP::insert |
( |
const char *const |
unichar_repr, |
|
|
UNICHAR_ID |
id |
|
) |
| |
Definition at line 56 of file unicharmap.cpp.
57 const char* current_char = unichar_repr;
58 if (*current_char ==
'\0')
return;
59 UNICHARMAP_NODE** current_nodes_pointer = &nodes;
61 if (*current_nodes_pointer ==
nullptr)
62 *current_nodes_pointer =
new UNICHARMAP_NODE[256];
63 if (current_char[1] ==
'\0') {
64 (*current_nodes_pointer)
65 [static_cast<unsigned char>(*current_char)].id = id;
68 current_nodes_pointer =
69 &((*current_nodes_pointer)
70 [static_cast<unsigned char>(*current_char)].children);
◆ minmatch()
int UNICHARMAP::minmatch |
( |
const char *const |
unichar_repr | ) |
const |
Definition at line 100 of file unicharmap.cpp.
101 const char* current_char = unichar_repr;
102 if (*current_char ==
'\0')
return 0;
103 UNICHARMAP_NODE* current_nodes = nodes;
105 while (current_nodes !=
nullptr && *current_char !=
'\0') {
106 if (current_nodes[static_cast<unsigned char>(*current_char)].
id >= 0)
107 return current_char + 1 - unichar_repr;
109 current_nodes[static_cast<unsigned char>(*current_char)].children;
◆ unichar_to_id()
UNICHAR_ID UNICHARMAP::unichar_to_id |
( |
const char *const |
unichar_repr, |
|
|
int |
length |
|
) |
| const |
Definition at line 34 of file unicharmap.cpp.
36 UNICHARMAP_NODE* current_nodes = nodes;
38 assert(*unichar_repr !=
'\0');
42 if (length <= 0 || unichar_repr[index] ==
'\0')
return INVALID_UNICHAR_ID;
44 if (index + 1 >= length || unichar_repr[index + 1] ==
'\0')
45 return current_nodes[static_cast<unsigned char>(unichar_repr[index])].id;
47 current_nodes[static_cast<unsigned char>(unichar_repr[index])].children;
The documentation for this class was generated from the following files: