tesseract  3.03
UNICHAR::const_iterator Class Reference

#include <unichar.h>

List of all members.

Public Member Functions

const_iteratoroperator++ ()
int operator* () const
int get_utf8 (char *buf) const
int utf8_len () const
const char * utf8_data () const

Friends

class UNICHAR
bool operator== (const CI &lhs, const CI &rhs)
bool operator!= (const CI &lhs, const CI &rhs)

Detailed Description

Definition at line 100 of file unichar.h.


Member Function Documentation

int UNICHAR::const_iterator::get_utf8 ( char *  buf) const

Definition at line 173 of file unichar.cpp.

                                                           {
  ASSERT_HOST(it_ != NULL);
  const int len = utf8_step(it_);
  if (len == 0) {
    tprintf("WARNING: Illegal UTF8 encountered\n");
    utf8_output[0] = ' ';
    return 1;
  }
  strncpy(utf8_output, it_, len);
  return len;
}
int UNICHAR::const_iterator::operator* ( ) const

Definition at line 162 of file unichar.cpp.

                                           {
  ASSERT_HOST(it_ != NULL);
  const int len = utf8_step(it_);
  if (len == 0) {
    tprintf("WARNING: Illegal UTF8 encountered\n");
    return ' ';
  }
  UNICHAR uch(it_, len);
  return uch.first_uni();
}
UNICHAR::const_iterator & UNICHAR::const_iterator::operator++ ( )

Definition at line 148 of file unichar.cpp.

                                                         {
  ASSERT_HOST(it_ != NULL);
  int step = utf8_step(it_);
  if (step == 0) {
    tprintf("ERROR: Illegal UTF8 encountered.\n");
    for (int i = 0; i < 5 && it_[i] != '\0'; ++i) {
      tprintf("Index %d char = 0x%x", i, it_[i]);
    }
    step = 1;
  }
  it_ += step;
  return *this;
}
const char* UNICHAR::const_iterator::utf8_data ( ) const [inline]

Definition at line 126 of file unichar.h.

{ return it_; }

Definition at line 185 of file unichar.cpp.

                                          {
  ASSERT_HOST(it_ != NULL);
  const int len = utf8_step(it_);
  if (len == 0) {
    tprintf("WARNING: Illegal UTF8 encountered\n");
    return 1;
  }
  return len;
}

Friends And Related Function Documentation

bool operator!= ( const CI lhs,
const CI rhs 
) [friend]

Definition at line 132 of file unichar.h.

                                                         {
      return !(lhs == rhs);
    }
bool operator== ( const CI lhs,
const CI rhs 
) [friend]

Definition at line 129 of file unichar.h.

                                                         {
      return lhs.it_ == rhs.it_;
    }
friend class UNICHAR [friend]

Definition at line 137 of file unichar.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines