Tesseract  3.02
tesseract::UnicharIdArrayUtils Class Reference

#include <ambigs.h>

List of all members.

Static Public Member Functions

static int compare (const UNICHAR_ID array1[], const UNICHAR_ID array2[])
static int find_in (const UnicharIdVector &uid_vec, const UNICHAR_ID uid)
static int copy (const UNICHAR_ID src[], UNICHAR_ID dst[])
static void print (const UNICHAR_ID array[], const UNICHARSET &unicharset)

Detailed Description

Definition at line 56 of file ambigs.h.


Member Function Documentation

static int tesseract::UnicharIdArrayUtils::compare ( const UNICHAR_ID  array1[],
const UNICHAR_ID  array2[] 
) [inline, static]

Definition at line 62 of file ambigs.h.

                                                       {
    const UNICHAR_ID *ptr1 = array1;
    const UNICHAR_ID *ptr2 = array2;
    while (*ptr1 != INVALID_UNICHAR_ID && *ptr2 != INVALID_UNICHAR_ID) {
      if (*ptr1 != *ptr2) return *ptr1 < *ptr2 ? -1 : 1;
      ++ptr1;
      ++ptr2;
    }
    if (*ptr1 == INVALID_UNICHAR_ID && *ptr2 == INVALID_UNICHAR_ID) return 0;
    return *ptr1 == INVALID_UNICHAR_ID ? -1 : 1;
  }
static int tesseract::UnicharIdArrayUtils::copy ( const UNICHAR_ID  src[],
UNICHAR_ID  dst[] 
) [inline, static]

Definition at line 87 of file ambigs.h.

                                                                   {
    int i = 0;
    do {
      dst[i] = src[i];
    } while (dst[i++] != INVALID_UNICHAR_ID);
    return i - 1;
  }
static int tesseract::UnicharIdArrayUtils::find_in ( const UnicharIdVector uid_vec,
const UNICHAR_ID  uid 
) [inline, static]

Definition at line 77 of file ambigs.h.

                                                  {
    for (int i = 0; i < uid_vec.size(); ++i)
      if (uid_vec[i] == uid) return i;
    return -1;
  }
static void tesseract::UnicharIdArrayUtils::print ( const UNICHAR_ID  array[],
const UNICHARSET unicharset 
) [inline, static]

Definition at line 97 of file ambigs.h.

                                                         {
    const UNICHAR_ID *ptr = array;
    if (*ptr == INVALID_UNICHAR_ID) tprintf("[Empty]");
    while (*ptr != INVALID_UNICHAR_ID) {
      tprintf("%s ", unicharset.id_to_unichar(*ptr++));
    }
    tprintf("( ");
    ptr = array;
    while (*ptr != INVALID_UNICHAR_ID) tprintf("%d ", *ptr++);
    tprintf(")\n");
  }

The documentation for this class was generated from the following file: