#include <shapetable.h>
Definition at line 154 of file shapetable.h.
◆ Shape()
tesseract::Shape::Shape |
( |
| ) |
|
|
inline |
Definition at line 156 of file shapetable.h.
156 : destination_index_(-1) {}
◆ AddShape()
void tesseract::Shape::AddShape |
( |
const Shape & |
other | ) |
|
Definition at line 123 of file shapetable.cpp.
124 for (
const auto &unichar : other.unichars_) {
125 for (
unsigned f = 0; f < unichar.font_ids.size(); ++f) {
126 AddToShape(unichar.unichar_id, unichar.font_ids[f]);
129 unichars_sorted_ = unichars_.size() <= 1;
void AddToShape(int unichar_id, int font_id)
◆ AddToShape()
void tesseract::Shape::AddToShape |
( |
int |
unichar_id, |
|
|
int |
font_id |
|
) |
| |
Definition at line 103 of file shapetable.cpp.
104 for (
auto &unichar : unichars_) {
105 if (unichar.unichar_id == unichar_id) {
107 std::vector<int> &font_list = unichar.font_ids;
108 for (
int f : font_list) {
113 font_list.push_back(font_id);
118 unichars_.emplace_back(unichar_id, font_id);
119 unichars_sorted_ = unichars_.size() <= 1;
◆ ContainsFont()
bool tesseract::Shape::ContainsFont |
( |
int |
font_id | ) |
const |
Definition at line 160 of file shapetable.cpp.
161 for (
const auto &unichar : unichars_) {
162 auto &font_list = unichar.font_ids;
163 for (
int f : font_list) {
◆ ContainsFontProperties()
bool tesseract::Shape::ContainsFontProperties |
( |
const FontInfoTable & |
font_table, |
|
|
uint32_t |
properties |
|
) |
| const |
Definition at line 173 of file shapetable.cpp.
174 for (
const auto &unichar : unichars_) {
175 auto &font_list = unichar.font_ids;
176 for (
int f : font_list) {
177 if (font_table.at(f).properties == properties) {
◆ ContainsMultipleFontProperties()
bool tesseract::Shape::ContainsMultipleFontProperties |
( |
const FontInfoTable & |
font_table | ) |
const |
Definition at line 186 of file shapetable.cpp.
187 uint32_t properties = font_table.at(unichars_[0].font_ids[0]).properties;
188 for (
const auto &unichar : unichars_) {
189 auto &font_list = unichar.font_ids;
190 for (
int f : font_list) {
191 if (font_table.at(f).properties != properties) {
◆ ContainsUnichar()
bool tesseract::Shape::ContainsUnichar |
( |
int |
unichar_id | ) |
const |
Definition at line 150 of file shapetable.cpp.
151 for (
const auto &unichar : unichars_) {
152 if (unichar.unichar_id == unichar_id) {
◆ ContainsUnicharAndFont()
bool tesseract::Shape::ContainsUnicharAndFont |
( |
int |
unichar_id, |
|
|
int |
font_id |
|
) |
| const |
Definition at line 133 of file shapetable.cpp.
134 for (
const auto &unichar : unichars_) {
135 if (unichar.unichar_id == unichar_id) {
137 auto &font_list = unichar.font_ids;
138 for (
int f : font_list) {
◆ DeSerialize()
bool tesseract::Shape::DeSerialize |
( |
TFile * |
fp | ) |
|
Definition at line 92 of file shapetable.cpp.
94 if (!fp->DeSerialize(&sorted)) {
97 unichars_sorted_ = sorted != 0;
98 return fp->DeSerialize(unichars_);
◆ destination_index()
int tesseract::Shape::destination_index |
( |
| ) |
const |
|
inline |
Definition at line 163 of file shapetable.h.
164 return destination_index_;
◆ IsEqualUnichars()
bool tesseract::Shape::IsEqualUnichars |
( |
Shape * |
other | ) |
|
Definition at line 222 of file shapetable.cpp.
223 if (unichars_.size() != other->unichars_.size()) {
226 if (!unichars_sorted_) {
229 if (!other->unichars_sorted_) {
230 other->SortUnichars();
232 for (
unsigned c = 0; c < unichars_.size(); ++c) {
233 if (unichars_[c].unichar_id != other->unichars_[c].unichar_id) {
◆ IsSubsetOf()
bool tesseract::Shape::IsSubsetOf |
( |
const Shape & |
other | ) |
const |
Definition at line 206 of file shapetable.cpp.
207 for (
const auto &unichar : unichars_) {
208 int unichar_id = unichar.unichar_id;
209 const std::vector<int> &font_list = unichar.font_ids;
210 for (
int f : font_list) {
211 if (!other.ContainsUnicharAndFont(unichar_id, f)) {
◆ operator==()
bool tesseract::Shape::operator== |
( |
const Shape & |
other | ) |
const |
Definition at line 201 of file shapetable.cpp.
202 return IsSubsetOf(other) && other.IsSubsetOf(*
this);
bool IsSubsetOf(const Shape &other) const
◆ operator[]()
◆ Serialize()
bool tesseract::Shape::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 86 of file shapetable.cpp.
87 uint8_t sorted = unichars_sorted_;
bool Serialize(FILE *fp, const std::vector< T > &data)
◆ set_destination_index()
void tesseract::Shape::set_destination_index |
( |
int |
index | ) |
|
|
inline |
Definition at line 166 of file shapetable.h.
167 destination_index_ = index;
◆ SetUnicharId()
void tesseract::Shape::SetUnicharId |
( |
int |
index, |
|
|
int |
unichar_id |
|
) |
| |
|
inline |
Definition at line 178 of file shapetable.h.
179 unichars_[index].unichar_id = unichar_id;
◆ size()
int tesseract::Shape::size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: