Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 36 of file shapetable.h.

Constructor & Destructor Documentation

tesseract::UnicharAndFonts::UnicharAndFonts ( )
inline

Definition at line 37 of file shapetable.h.

37  : unichar_id(0) {
38  }
tesseract::UnicharAndFonts::UnicharAndFonts ( int  uni_id,
int  font_id 
)
inline

Definition at line 39 of file shapetable.h.

39  : unichar_id(uni_id) {
40  font_ids.push_back(font_id);
41  }
GenericVector< inT32 > font_ids
Definition: shapetable.h:52
int push_back(T object)

Member Function Documentation

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

Definition at line 39 of file shapetable.cpp.

39  {
40  if (fread(&unichar_id, sizeof(unichar_id), 1, fp) != 1) return false;
41  if (swap)
42  ReverseN(&unichar_id, sizeof(unichar_id));
43  if (!font_ids.DeSerialize(swap, fp)) return false;
44  return true;
45 }
void ReverseN(void *ptr, int num_bytes)
Definition: helpers.h:126
virtual bool DeSerialize(bool swap, FILE *fp)
GenericVector< inT32 > font_ids
Definition: shapetable.h:52
bool tesseract::UnicharAndFonts::Serialize ( FILE *  fp) const

Definition at line 32 of file shapetable.cpp.

32  {
33  if (fwrite(&unichar_id, sizeof(unichar_id), 1, fp) != 1) return false;
34  if (!font_ids.Serialize(fp)) return false;
35  return true;
36 }
GenericVector< inT32 > font_ids
Definition: shapetable.h:52
virtual bool Serialize(FILE *fp) const
int tesseract::UnicharAndFonts::SortByUnicharId ( const void *  v1,
const void *  v2 
)
static

Definition at line 48 of file shapetable.cpp.

48  {
49  const UnicharAndFonts* p1 = reinterpret_cast<const UnicharAndFonts*>(v1);
50  const UnicharAndFonts* p2 = reinterpret_cast<const UnicharAndFonts*>(v2);
51  return p1->unichar_id - p2->unichar_id;
52 }

Member Data Documentation

GenericVector<inT32> tesseract::UnicharAndFonts::font_ids

Definition at line 52 of file shapetable.h.

inT32 tesseract::UnicharAndFonts::unichar_id

Definition at line 53 of file shapetable.h.


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