All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 (bool swap, FILE *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

tesseract::UnicharAndFonts::UnicharAndFonts ( )
inline

Definition at line 161 of file shapetable.h.

161  : unichar_id(0) {
162  }
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:176

Member Function Documentation

bool tesseract::UnicharAndFonts::DeSerialize ( bool  swap,
FILE *  fp 
)

Definition at line 74 of file shapetable.cpp.

74  {
75  if (fread(&unichar_id, sizeof(unichar_id), 1, fp) != 1) return false;
76  if (swap)
77  ReverseN(&unichar_id, sizeof(unichar_id));
78  if (!font_ids.DeSerialize(swap, fp)) return false;
79  return true;
80 }
bool DeSerialize(bool swap, FILE *fp)
GenericVector< inT32 > font_ids
Definition: shapetable.h:176
void ReverseN(void *ptr, int num_bytes)
Definition: helpers.h:177
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 }
bool Serialize(FILE *fp) const
GenericVector< inT32 > font_ids
Definition: shapetable.h:176
int tesseract::UnicharAndFonts::SortByUnicharId ( const void *  v1,
const void *  v2 
)
static

Definition at line 83 of file shapetable.cpp.

83  {
84  const UnicharAndFonts* p1 = reinterpret_cast<const UnicharAndFonts*>(v1);
85  const UnicharAndFonts* p2 = reinterpret_cast<const UnicharAndFonts*>(v2);
86  return p1->unichar_id - p2->unichar_id;
87 }

Member Data Documentation

GenericVector<inT32> tesseract::UnicharAndFonts::font_ids

Definition at line 176 of file shapetable.h.

inT32 tesseract::UnicharAndFonts::unichar_id

Definition at line 177 of file shapetable.h.


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