#include <unicharmap.h>
Definition at line 29 of file unicharmap.h.
◆ UNICHARMAP()
tesseract::UNICHARMAP::UNICHARMAP |
( |
| ) |
|
◆ ~UNICHARMAP()
tesseract::UNICHARMAP::~UNICHARMAP |
( |
| ) |
|
◆ clear()
void tesseract::UNICHARMAP::clear |
( |
| ) |
|
◆ contains()
bool tesseract::UNICHARMAP::contains |
( |
const char *const |
unichar_repr, |
|
|
int |
length |
|
) |
| const |
Definition at line 83 of file unicharmap.cpp.
84 if (unichar_repr ==
nullptr || *unichar_repr ==
'\0') {
91 if (unichar_repr[index] ==
'\0') {
94 UNICHARMAP_NODE *current_nodes = nodes;
96 while (current_nodes !=
nullptr && index + 1 < length && unichar_repr[index + 1] !=
'\0') {
97 current_nodes = current_nodes[
static_cast<unsigned char>(unichar_repr[index])].children;
100 return current_nodes !=
nullptr && (index + 1 >= length || unichar_repr[index + 1] ==
'\0') &&
101 current_nodes[
static_cast<unsigned char>(unichar_repr[index])].id >= 0;
◆ insert()
void tesseract::UNICHARMAP::insert |
( |
const char *const |
unichar_repr, |
|
|
UNICHAR_ID |
id |
|
) |
| |
Definition at line 59 of file unicharmap.cpp.
60 const char *current_char = unichar_repr;
61 if (*current_char ==
'\0') {
64 UNICHARMAP_NODE **current_nodes_pointer = &nodes;
66 if (*current_nodes_pointer ==
nullptr) {
67 *current_nodes_pointer =
new UNICHARMAP_NODE[256];
69 if (current_char[1] ==
'\0') {
70 (*current_nodes_pointer)[
static_cast<unsigned char>(*current_char)].id = id;
73 current_nodes_pointer =
74 &((*current_nodes_pointer)[
static_cast<unsigned char>(*current_char)].children);
◆ minmatch()
int tesseract::UNICHARMAP::minmatch |
( |
const char *const |
unichar_repr | ) |
const |
Definition at line 106 of file unicharmap.cpp.
107 const char *current_char = unichar_repr;
108 if (*current_char ==
'\0') {
111 UNICHARMAP_NODE *current_nodes = nodes;
113 while (current_nodes !=
nullptr && *current_char !=
'\0') {
114 if (current_nodes[
static_cast<unsigned char>(*current_char)].
id >= 0) {
115 return current_char + 1 - unichar_repr;
117 current_nodes = current_nodes[
static_cast<unsigned char>(*current_char)].children;
◆ unichar_to_id()
UNICHAR_ID tesseract::UNICHARMAP::unichar_to_id |
( |
const char *const |
unichar_repr, |
|
|
int |
length |
|
) |
| const |
Definition at line 36 of file unicharmap.cpp.
37 UNICHARMAP_NODE *current_nodes = nodes;
39 assert(*unichar_repr !=
'\0');
43 if (length <= 0 || unichar_repr[index] ==
'\0') {
44 return INVALID_UNICHAR_ID;
47 if (index + 1 >= length || unichar_repr[index + 1] ==
'\0') {
48 return current_nodes[
static_cast<unsigned char>(unichar_repr[index])].
id;
50 current_nodes = current_nodes[
static_cast<unsigned char>(unichar_repr[index])].children;
The documentation for this class was generated from the following files: