tesseract  4.00.00dev
tesseract::UnicharAndFonts Struct Reference

#include <shapetable.h>

Public Member Functions

 UnicharAndFonts ()
 
 UnicharAndFonts (int uni_id, int font_id)
 
bool Serialize (FILE *fp) const
 
bool DeSerialize (TFile *fp)
 

Static Public Member Functions

static int SortByUnicharId (const void *v1, const void *v2)
 

Public Attributes

GenericVector< inT32font_ids
 
inT32 unichar_id
 

Detailed Description

Definition at line 160 of file shapetable.h.

Constructor & Destructor Documentation

◆ UnicharAndFonts() [1/2]

tesseract::UnicharAndFonts::UnicharAndFonts ( )
inline

Definition at line 161 of file shapetable.h.

161  : unichar_id(0) {
162  }

◆ UnicharAndFonts() [2/2]

tesseract::UnicharAndFonts::UnicharAndFonts ( int  uni_id,
int  font_id 
)
inline

Definition at line 163 of file shapetable.h.

163  : unichar_id(uni_id) {
164  font_ids.push_back(font_id);
165  }
int push_back(T object)
GenericVector< inT32 > font_ids
Definition: shapetable.h:175

Member Function Documentation

◆ DeSerialize()

bool tesseract::UnicharAndFonts::DeSerialize ( TFile fp)

Definition at line 74 of file shapetable.cpp.

74  {
75  if (fp->FReadEndian(&unichar_id, sizeof(unichar_id), 1) != 1) return false;
76  if (!font_ids.DeSerialize(fp)) return false;
77  return true;
78 }
bool DeSerialize(bool swap, FILE *fp)
GenericVector< inT32 > font_ids
Definition: shapetable.h:175

◆ Serialize()

bool tesseract::UnicharAndFonts::Serialize ( FILE *  fp) const

Definition at line 67 of file shapetable.cpp.

67  {
68  if (fwrite(&unichar_id, sizeof(unichar_id), 1, fp) != 1) return false;
69  if (!font_ids.Serialize(fp)) return false;
70  return true;
71 }
GenericVector< inT32 > font_ids
Definition: shapetable.h:175
bool Serialize(FILE *fp) const

◆ SortByUnicharId()

int tesseract::UnicharAndFonts::SortByUnicharId ( const void *  v1,
const void *  v2 
)
static

Definition at line 81 of file shapetable.cpp.

81  {
82  const UnicharAndFonts* p1 = static_cast<const UnicharAndFonts*>(v1);
83  const UnicharAndFonts* p2 = static_cast<const UnicharAndFonts*>(v2);
84  return p1->unichar_id - p2->unichar_id;
85 }

Member Data Documentation

◆ font_ids

GenericVector<inT32> tesseract::UnicharAndFonts::font_ids

Definition at line 175 of file shapetable.h.

◆ unichar_id

inT32 tesseract::UnicharAndFonts::unichar_id

Definition at line 176 of file shapetable.h.


The documentation for this struct was generated from the following files: