#include <shapetable.h>
List of all members.
Detailed Description
Definition at line 62 of file shapetable.h.
Constructor & Destructor Documentation
tesseract::Shape::Shape |
( |
| ) |
|
|
inline |
Definition at line 64 of file shapetable.h.
: destination_index_(-1) {}
Member Function Documentation
void tesseract::Shape::AddShape |
( |
const Shape & |
other | ) |
|
Definition at line 94 of file shapetable.cpp.
{
for (int c = 0; c < other.unichars_.size(); ++c) {
for (
int f = 0;
f < other.unichars_[c].font_ids.size(); ++
f) {
other.unichars_[c].font_ids[
f]);
}
}
unichars_sorted_ = unichars_.
size() <= 1;
}
void tesseract::Shape::AddToShape |
( |
int |
unichar_id, |
|
|
int |
font_id |
|
) |
| |
Definition at line 75 of file shapetable.cpp.
{
for (
int c = 0; c < unichars_.
size(); ++c) {
if (unichars_[c].unichar_id == unichar_id) {
for (
int f = 0;
f < font_list.
size(); ++
f) {
if (font_list[
f] == font_id)
return;
}
return;
}
}
unichars_.
push_back(UnicharAndFonts(unichar_id, font_id));
unichars_sorted_ = unichars_.
size() <= 1;
}
bool tesseract::Shape::ContainsFont |
( |
int |
font_id | ) |
const |
Definition at line 131 of file shapetable.cpp.
{
for (
int c = 0; c < unichars_.
size(); ++c) {
for (
int f = 0;
f < font_list.
size(); ++
f) {
if (font_list[
f] == font_id)
return true;
}
}
return false;
}
bool tesseract::Shape::ContainsUnichar |
( |
int |
unichar_id | ) |
const |
Definition at line 121 of file shapetable.cpp.
{
for (
int c = 0; c < unichars_.
size(); ++c) {
if (unichars_[c].unichar_id == unichar_id) {
return true;
}
}
return false;
}
bool tesseract::Shape::ContainsUnicharAndFont |
( |
int |
unichar_id, |
|
|
int |
font_id |
|
) |
| const |
Definition at line 105 of file shapetable.cpp.
{
for (
int c = 0; c < unichars_.
size(); ++c) {
if (unichars_[c].unichar_id == unichar_id) {
for (
int f = 0;
f < font_list.
size(); ++
f) {
if (font_list[
f] == font_id)
return true;
}
return false;
}
}
return false;
}
bool tesseract::Shape::DeSerialize |
( |
bool |
swap, |
|
|
FILE * |
fp |
|
) |
| |
Definition at line 64 of file shapetable.cpp.
{
if (fread(&sorted, sizeof(sorted), 1, fp) != 1)
return false;
unichars_sorted_ = sorted != 0;
return true;
}
int tesseract::Shape::destination_index |
( |
| ) |
const |
|
inline |
Definition at line 72 of file shapetable.h.
{
return destination_index_;
}
bool tesseract::Shape::IsEqualUnichars |
( |
Shape * |
other | ) |
|
Definition at line 158 of file shapetable.cpp.
{
if (unichars_.
size() != other->unichars_.size())
return false;
if (!unichars_sorted_) SortUnichars();
if (!other->unichars_sorted_) other->SortUnichars();
for (
int c = 0; c < unichars_.
size(); ++c) {
if (unichars_[c].unichar_id != other->unichars_[c].unichar_id)
return false;
}
return true;
}
bool tesseract::Shape::IsSubsetOf |
( |
const Shape & |
other | ) |
const |
Definition at line 143 of file shapetable.cpp.
{
for (
int c = 0; c < unichars_.
size(); ++c) {
int unichar_id = unichars_[c].unichar_id;
for (
int f = 0;
f < font_list.
size(); ++
f) {
if (!other.ContainsUnicharAndFont(unichar_id, font_list[
f]))
return false;
}
}
return true;
}
Definition at line 83 of file shapetable.h.
{
return unichars_[index];
}
bool tesseract::Shape::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 55 of file shapetable.cpp.
{
uinT8 sorted = unichars_sorted_;
if (fwrite(&sorted, sizeof(sorted), 1, fp) != 1)
return false;
return true;
}
void tesseract::Shape::set_destination_index |
( |
int |
index | ) |
|
|
inline |
Definition at line 75 of file shapetable.h.
{
destination_index_ = index;
}
int tesseract::Shape::size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: