#include <unicharset.h>
Definition at line 49 of file unicharset.h.
◆ equals() [1/2]
bool CHAR_FRAGMENT::equals |
( |
const char * |
other_unichar, |
|
|
int |
other_pos, |
|
|
int |
other_total |
|
) |
| const |
|
inline |
Definition at line 86 of file unicharset.h.
88 return (strcmp(this->unichar, other_unichar) == 0 &&
89 this->pos == other_pos && this->total == other_total);
◆ equals() [2/2]
Definition at line 91 of file unicharset.h.
const char * get_unichar() const
bool equals(const char *other_unichar, int other_pos, int other_total) const
◆ get_pos()
int CHAR_FRAGMENT::get_pos |
( |
| ) |
const |
|
inline |
◆ get_total()
int CHAR_FRAGMENT::get_total |
( |
| ) |
const |
|
inline |
Definition at line 73 of file unicharset.h.
73 {
return this->total; }
◆ get_unichar()
const char* CHAR_FRAGMENT::get_unichar |
( |
| ) |
const |
|
inline |
Definition at line 71 of file unicharset.h.
71 {
return this->unichar; }
◆ is_beginning()
bool CHAR_FRAGMENT::is_beginning |
( |
| ) |
const |
|
inline |
Definition at line 106 of file unicharset.h.
106 {
return this->pos == 0; }
◆ is_continuation_of()
bool CHAR_FRAGMENT::is_continuation_of |
( |
const CHAR_FRAGMENT * |
fragment | ) |
const |
|
inline |
Definition at line 99 of file unicharset.h.
100 return (strcmp(this->unichar, fragment->
get_unichar()) == 0 &&
102 this->pos == fragment->
get_pos() + 1);
const char * get_unichar() const
◆ is_ending()
bool CHAR_FRAGMENT::is_ending |
( |
| ) |
const |
|
inline |
Definition at line 109 of file unicharset.h.
109 {
return this->pos == this->total-1; }
◆ is_natural()
bool CHAR_FRAGMENT::is_natural |
( |
| ) |
const |
|
inline |
◆ parse_from_string()
CHAR_FRAGMENT * CHAR_FRAGMENT::parse_from_string |
( |
const char * |
str | ) |
|
|
static |
Definition at line 1067 of file unicharset.cpp.
1068 const char *ptr = string;
1069 int len = strlen(
string);
1070 if (len <
kMinLen || *ptr != kSeparator) {
1075 while ((ptr + step) < (
string + len) && *(ptr + step) != kSeparator) {
1076 step += UNICHAR::utf8_step(ptr + step);
1082 strncpy(unichar, ptr, step);
1083 unichar[step] =
'\0';
1087 bool natural =
false;
1088 char *end_ptr =
nullptr;
1089 for (
int i = 0; i < 2; i++) {
1090 if (ptr >
string + len || *ptr != kSeparator) {
1091 if (i == 1 && *ptr == kNaturalFlag)
1097 i == 0 ? pos =
static_cast<int>(strtol(ptr, &end_ptr, 10))
1098 : total = static_cast<int>(strtol(ptr, &end_ptr, 10));
1101 if (ptr !=
string + len) {
1105 fragment->
set_all(unichar, pos, total, natural);
void set_all(const char *unichar, int pos, int total, bool natural)
◆ set_all()
void CHAR_FRAGMENT::set_all |
( |
const char * |
unichar, |
|
|
int |
pos, |
|
|
int |
total, |
|
|
bool |
natural |
|
) |
| |
|
inline |
Definition at line 59 of file unicharset.h.
void set_unichar(const char *uch)
void set_natural(bool value)
◆ set_natural()
void CHAR_FRAGMENT::set_natural |
( |
bool |
value | ) |
|
|
inline |
◆ set_pos()
void CHAR_FRAGMENT::set_pos |
( |
int |
p | ) |
|
|
inline |
◆ set_total()
void CHAR_FRAGMENT::set_total |
( |
int |
t | ) |
|
|
inline |
◆ set_unichar()
void CHAR_FRAGMENT::set_unichar |
( |
const char * |
uch | ) |
|
|
inline |
◆ to_string() [1/2]
STRING CHAR_FRAGMENT::to_string |
( |
const char * |
unichar, |
|
|
int |
pos, |
|
|
int |
total, |
|
|
bool |
natural |
|
) |
| |
|
static |
Definition at line 1054 of file unicharset.cpp.
1056 if (total == 1)
return STRING(unichar);
1058 result += kSeparator;
1061 snprintf(buffer,
kMaxLen,
"%c%d%c%d", kSeparator, pos,
1062 natural ? kNaturalFlag : kSeparator, total);
◆ to_string() [2/2]
STRING CHAR_FRAGMENT::to_string |
( |
| ) |
const |
|
inline |
◆ kMaxChunks
const int CHAR_FRAGMENT::kMaxChunks = 5 |
|
static |
◆ kMaxLen
◆ kMinLen
const int CHAR_FRAGMENT::kMinLen = 6 |
|
static |
The documentation for this class was generated from the following files: