#include <shapetable.h>
Definition at line 186 of file shapetable.h.
◆ Shape()
tesseract::Shape::Shape |
( |
| ) |
|
|
inline |
Definition at line 188 of file shapetable.h.
188 : destination_index_(-1) {}
◆ AddShape()
void tesseract::Shape::AddShape |
( |
const Shape & |
other | ) |
|
Definition at line 129 of file shapetable.cpp.
130 for (
int c = 0; c < other.unichars_.size(); ++c) {
131 for (
int f = 0; f < other.unichars_[c].font_ids.size(); ++f) {
133 other.unichars_[c].font_ids[f]);
136 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 110 of file shapetable.cpp.
111 for (
int c = 0; c < unichars_.size(); ++c) {
112 if (unichars_[c].unichar_id == unichar_id) {
115 for (
int f = 0; f < font_list.
size(); ++f) {
116 if (font_list[f] == font_id)
124 unichars_.push_back(UnicharAndFonts(unichar_id, font_id));
125 unichars_sorted_ = unichars_.size() <= 1;
◆ ContainsFont()
bool tesseract::Shape::ContainsFont |
( |
int |
font_id | ) |
const |
Definition at line 166 of file shapetable.cpp.
167 for (
int c = 0; c < unichars_.size(); ++c) {
169 for (
int f = 0; f < font_list.
size(); ++f) {
170 if (font_list[f] == font_id)
◆ ContainsFontProperties()
bool tesseract::Shape::ContainsFontProperties |
( |
const FontInfoTable & |
font_table, |
|
|
uinT32 |
properties |
|
) |
| const |
Definition at line 178 of file shapetable.cpp.
180 for (
int c = 0; c < unichars_.size(); ++c) {
182 for (
int f = 0; f < font_list.
size(); ++f) {
183 if (font_table.get(font_list[f]).properties == properties)
◆ ContainsMultipleFontProperties()
bool tesseract::Shape::ContainsMultipleFontProperties |
( |
const FontInfoTable & |
font_table | ) |
const |
Definition at line 191 of file shapetable.cpp.
193 uinT32 properties = font_table.get(unichars_[0].font_ids[0]).properties;
194 for (
int c = 0; c < unichars_.size(); ++c) {
196 for (
int f = 0; f < font_list.
size(); ++f) {
197 if (font_table.get(font_list[f]).properties != properties)
◆ ContainsUnichar()
bool tesseract::Shape::ContainsUnichar |
( |
int |
unichar_id | ) |
const |
Definition at line 156 of file shapetable.cpp.
157 for (
int c = 0; c < unichars_.size(); ++c) {
158 if (unichars_[c].unichar_id == unichar_id) {
◆ ContainsUnicharAndFont()
bool tesseract::Shape::ContainsUnicharAndFont |
( |
int |
unichar_id, |
|
|
int |
font_id |
|
) |
| const |
Definition at line 140 of file shapetable.cpp.
141 for (
int c = 0; c < unichars_.size(); ++c) {
142 if (unichars_[c].unichar_id == unichar_id) {
145 for (
int f = 0; f < font_list.
size(); ++f) {
146 if (font_list[f] == font_id)
◆ DeSerialize()
bool tesseract::Shape::DeSerialize |
( |
bool |
swap, |
|
|
FILE * |
fp |
|
) |
| |
Definition at line 99 of file shapetable.cpp.
101 if (fread(&sorted,
sizeof(sorted), 1, fp) != 1)
103 unichars_sorted_ = sorted != 0;
104 if (!unichars_.DeSerializeClasses(swap, fp))
return false;
◆ destination_index()
int tesseract::Shape::destination_index |
( |
| ) |
const |
|
inline |
Definition at line 196 of file shapetable.h.
197 return destination_index_;
◆ IsEqualUnichars()
bool tesseract::Shape::IsEqualUnichars |
( |
Shape * |
other | ) |
|
Definition at line 226 of file shapetable.cpp.
227 if (unichars_.size() != other->unichars_.size())
return false;
228 if (!unichars_sorted_) SortUnichars();
229 if (!other->unichars_sorted_) other->SortUnichars();
230 for (
int c = 0; c < unichars_.size(); ++c) {
231 if (unichars_[c].unichar_id != other->unichars_[c].unichar_id)
◆ IsSubsetOf()
bool tesseract::Shape::IsSubsetOf |
( |
const Shape & |
other | ) |
const |
Definition at line 211 of file shapetable.cpp.
212 for (
int c = 0; c < unichars_.size(); ++c) {
213 int unichar_id = unichars_[c].unichar_id;
215 for (
int f = 0; f < font_list.
size(); ++f) {
216 if (!other.ContainsUnicharAndFont(unichar_id, font_list[f]))
◆ operator==()
bool tesseract::Shape::operator== |
( |
const Shape & |
other | ) |
const |
Definition at line 206 of file shapetable.cpp.
207 return IsSubsetOf(other) && other.IsSubsetOf(*
this);
bool IsSubsetOf(const Shape &other) const
◆ operator[]()
◆ Serialize()
bool tesseract::Shape::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 90 of file shapetable.cpp.
91 uinT8 sorted = unichars_sorted_;
92 if (fwrite(&sorted,
sizeof(sorted), 1, fp) != 1)
94 if (!unichars_.SerializeClasses(fp))
return false;
◆ set_destination_index()
void tesseract::Shape::set_destination_index |
( |
int |
index | ) |
|
|
inline |
Definition at line 199 of file shapetable.h.
200 destination_index_ = index;
◆ SetUnicharId()
void tesseract::Shape::SetUnicharId |
( |
int |
index, |
|
|
int |
unichar_id |
|
) |
| |
|
inline |
Definition at line 211 of file shapetable.h.
212 unichars_[index].unichar_id = unichar_id;
◆ size()
int tesseract::Shape::size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: