Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes
PAGE_RES_IT Class Reference

`#include <pageres.h>`

List of all members.

## Public Member Functions

| PAGE_RES_IT ()
| PAGE_RES_IT (PAGE_RES *the_page_res)
bool | operator== (const PAGE_RES_IT &other) const
bool | operator!= (const PAGE_RES_IT &other) const
int | cmp (const PAGE_RES_IT &other) const
WERD_RES * | restart_page ()
WERD_RES * | restart_page_with_empties ()
WERD_RES * | start_page (bool empty_ok)
WERD_RES * | restart_row ()
WERD_RES * | InsertSimpleCloneWord (const WERD_RES &clone_res, WERD *new_word)
void | DeleteCurrentWord ()
WERD_RES * | forward ()
WERD_RES * | forward_with_empties ()
WERD_RES * | forward_paragraph ()
WERD_RES * | forward_block ()
WERD_RES * | prev_word () const
ROW_RES * | prev_row () const
BLOCK_RES * | prev_block () const
WERD_RES * | word () const
ROW_RES * | row () const
BLOCK_RES * | block () const
WERD_RES * | next_word () const
ROW_RES * | next_row () const
BLOCK_RES * | next_block () const
void | rej_stat_word ()

## Public Attributes

PAGE_RES * | page_res

## Detailed Description

Definition at line 689 of file pageres.h.

## Constructor & Destructor Documentation

PAGE_RES_IT::PAGE_RES_IT | ( |  | ) |

inline

Definition at line 693 of file pageres.h.

{
} // empty contructor

PAGE_RES_IT::PAGE_RES_IT | ( | PAGE_RES * | the_page_res | ) |

inline

Definition at line 696 of file pageres.h.

{ // page result
page_res = the_page_res;
restart_page(); // ready to scan
}

## Member Function Documentation

BLOCK_RES* PAGE_RES_IT::block | ( |  | ) | const

inline

Definition at line 763 of file pageres.h.

{ // block of cur. word
return block_res;
}

int PAGE_RES_IT::cmp | ( | const PAGE_RES_IT & | other | ) | const

Definition at line 851 of file pageres.cpp.

{
ASSERT_HOST(page_res == other.page_res);
if (other.block_res == NULL) {
// other points to the end of the page.
if (block_res == NULL)
return 0;
return -1;
}
if (block_res == NULL) {
return 1; // we point to the end of the page.
}
if (block_res == other.block_res) {
if (other.row_res == NULL || row_res == NULL) {
// this should only happen if we hit an image block.
return 0;
}
if (row_res == other.row_res) {
// we point to the same block and row.
ASSERT_HOST(other.word_res != NULL && word_res != NULL);
if (word_res == other.word_res) {
// we point to the same word!
return 0;
}
WERD_RES_IT word_res_it(&row_res->word_res_list);
for (word_res_it.mark_cycle_pt(); !word_res_it.cycled_list();
word_res_it.forward()) {
if (word_res_it.data() == word_res) {
return -1;
} else if (word_res_it.data() == other.word_res) {
return 1;
}
}
ASSERT_HOST("Error: Incomparable PAGE_RES_ITs" == NULL);
}
// we both point to the same block, but different rows.
ROW_RES_IT row_res_it(&block_res->row_res_list);
for (row_res_it.mark_cycle_pt(); !row_res_it.cycled_list();
row_res_it.forward()) {
if (row_res_it.data() == row_res) {
return -1;
} else if (row_res_it.data() == other.row_res) {
return 1;
}
}
ASSERT_HOST("Error: Incomparable PAGE_RES_ITs" == NULL);
}
// We point to different blocks.
BLOCK_RES_IT block_res_it(&page_res->block_res_list);
for (block_res_it.mark_cycle_pt();
!block_res_it.cycled_list(); block_res_it.forward()) {
if (block_res_it.data() == block_res) {
return -1;
} else if (block_res_it.data() == other.block_res) {
return 1;
}
}
// Shouldn't happen...
ASSERT_HOST("Error: Incomparable PAGE_RES_ITs" == NULL);
return 0;
}

void PAGE_RES_IT::DeleteCurrentWord | ( |  | ) |

Definition at line 950 of file pageres.cpp.

{
// Check that this word is as we expect. part_of_combos are NEVER iterated
// by the normal iterator, so we should never be trying to delete them.
ASSERT_HOST(!word_res->part_of_combo);
if (!word_res->combination) {
// Combinations own their own word, so we won't find the word on the
// row's word_list, but it is legitimate to try to delete them.
// Delete word from the ROW when not a combination.
WERD_IT w_it(row()->row->word_list());
for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
if (w_it.data() == word_res->word) {
break;
}
}
ASSERT_HOST(!w_it.cycled_list());
delete w_it.extract();
}
// Remove the WERD_RES for the new_word.
// Remove the WORD_RES from the ROW_RES.
WERD_RES_IT wr_it(&row()->word_res_list);
for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
if (wr_it.data() == word_res) {
word_res = NULL;
break;
}
}
ASSERT_HOST(!wr_it.cycled_list());
delete wr_it.extract();
ResetWordIterator();
}

WERD_RES* PAGE_RES_IT::forward | ( |  | ) |

inline

Definition at line 737 of file pageres.h.

{ // Get next word.
return internal_forward(false, false);
}

WERD_RES * PAGE_RES_IT::forward_block | ( |  | ) |

Definition at line 1130 of file pageres.cpp.

{
while (block_res == next_block_res) {
internal_forward(false, true);
}
return internal_forward(false, true);
}

WERD_RES * PAGE_RES_IT::forward_paragraph | ( |  | ) |

Definition at line 1115 of file pageres.cpp.

{
while (block_res == next_block_res &&
(next_row_res != NULL && next_row_res->row != NULL &&
row_res->row->para() == next_row_res->row->para())) {
internal_forward(false, true);
}
return internal_forward(false, true);
}

WERD_RES* PAGE_RES_IT::forward_with_empties | ( |  | ) |

inline

Definition at line 741 of file pageres.h.

{
return internal_forward(false, true);
}

WERD_RES * PAGE_RES_IT::InsertSimpleCloneWord | ( | const WERD_RES & | clone_res,
|  | WERD * | new_word
| ) |  |

Definition at line 918 of file pageres.cpp.

{
// Insert new_word into the ROW.
WERD_IT w_it(row()->row->word_list());
for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
WERD* word = w_it.data();
if (word == word_res->word)
break;
}
ASSERT_HOST(!w_it.cycled_list());
w_it.add_before_then_move(new_word);
// Make a WERD_RES for the new_word.
WERD_RES* new_res = new WERD_RES(new_word);
new_res->CopySimpleFields(clone_res);
// Insert into the appropriate place in the ROW_RES.
WERD_RES_IT wr_it(&row()->word_res_list);
for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
WERD_RES* word = wr_it.data();
if (word == word_res)
break;
}
ASSERT_HOST(!wr_it.cycled_list());
wr_it.add_before_then_move(new_res);
if (wr_it.at_first()) {
// This is the new first word, so reset the member iterator so it
// detects the cycled_list state correctly.
ResetWordIterator();
}
return new_res;
}

BLOCK_RES* PAGE_RES_IT::next_block | ( |  | ) | const

inline

Definition at line 772 of file pageres.h.

{ // block of next word
return next_block_res;
}

ROW_RES* PAGE_RES_IT::next_row | ( |  | ) | const

inline

Definition at line 769 of file pageres.h.

{ // row of next word
return next_row_res;
}

WERD_RES* PAGE_RES_IT::next_word | ( |  | ) | const

inline

Definition at line 766 of file pageres.h.

{ // next word
return next_word_res;
}

bool PAGE_RES_IT::operator!= | ( | const PAGE_RES_IT & | other | ) | const

inline

Definition at line 705 of file pageres.h.

{return !(*this == other); }

bool PAGE_RES_IT::operator== | ( | const PAGE_RES_IT & | other | ) | const

Definition at line 845 of file pageres.cpp.

{
return word_res == other.word_res &&
row_res == other.row_res &&
block_res == other.block_res;
}

BLOCK_RES* PAGE_RES_IT::prev_block | ( |  | ) | const

inline

Definition at line 754 of file pageres.h.

{ // block of prev word
return prev_block_res;
}

ROW_RES* PAGE_RES_IT::prev_row | ( |  | ) | const

inline

Definition at line 751 of file pageres.h.

{ // row of prev word
return prev_row_res;
}

WERD_RES* PAGE_RES_IT::prev_word | ( |  | ) | const

inline

Definition at line 748 of file pageres.h.

{ // previous word
return prev_word_res;
}

void PAGE_RES_IT::rej_stat_word | ( |  | ) |

Definition at line 1137 of file pageres.cpp.

{
inT16 chars_in_word;
inT16 rejects_in_word = 0;
chars_in_word = word_res->reject_map.length ();
page_res->char_count += chars_in_word;
block_res->char_count += chars_in_word;
row_res->char_count += chars_in_word;
rejects_in_word = word_res->reject_map.reject_count ();
page_res->rej_count += rejects_in_word;
block_res->rej_count += rejects_in_word;
row_res->rej_count += rejects_in_word;
if (chars_in_word == rejects_in_word)
row_res->whole_word_rej_count += rejects_in_word;
}

WERD_RES* PAGE_RES_IT::restart_page | ( |  | ) |

inline

Definition at line 713 of file pageres.h.

{
return start_page(false); // Skip empty blocks.
}

WERD_RES* PAGE_RES_IT::restart_page_with_empties | ( |  | ) |

inline

Definition at line 716 of file pageres.h.

{
return start_page(true); // Allow empty blocks.
}

WERD_RES * PAGE_RES_IT::restart_row | ( |  | ) |

Definition at line 1100 of file pageres.cpp.

{
ROW_RES *row = this->row();
if (!row) return NULL;
for (restart_page(); this->row() != row; forward()) {
// pass
}
return word();
}

ROW_RES* PAGE_RES_IT::row | ( |  | ) | const

inline

Definition at line 760 of file pageres.h.

{ // row of current word
return row_res;
}

WERD_RES * PAGE_RES_IT::start_page | ( | bool | empty_ok | ) |

Definition at line 987 of file pageres.cpp.

{
block_res_it.set_to_list(&page_res->block_res_list);
block_res_it.mark_cycle_pt();
prev_block_res = NULL;
prev_row_res = NULL;
prev_word_res = NULL;
block_res = NULL;
row_res = NULL;
word_res = NULL;
next_block_res = NULL;
next_row_res = NULL;
next_word_res = NULL;
internal_forward(true, empty_ok);
return internal_forward(false, empty_ok);
}

WERD_RES* PAGE_RES_IT::word | ( |  | ) | const

inline

Definition at line 757 of file pageres.h.

{ // current word
return word_res;
}

## Member Data Documentation

PAGE_RES* PAGE_RES_IT::page_res

Definition at line 691 of file pageres.h.

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

- /mnt/data/src/tesseract-ocr/ccstruct/pageres.h
- /mnt/data/src/tesseract-ocr/ccstruct/pageres.cpp