00001 /********************************************************************** 00002 * File: wordit.c 00003 * Description: An iterator for passing over all the words in a document. 00004 * Author: Ray Smith 00005 * Created: Mon Apr 27 08:51:22 BST 1992 00006 * 00007 * (C) Copyright 1992, Hewlett-Packard Ltd. 00008 ** Licensed under the Apache License, Version 2.0 (the "License"); 00009 ** you may not use this file except in compliance with the License. 00010 ** You may obtain a copy of the License at 00011 ** http://www.apache.org/licenses/LICENSE-2.0 00012 ** Unless required by applicable law or agreed to in writing, software 00013 ** distributed under the License is distributed on an "AS IS" BASIS, 00014 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 ** See the License for the specific language governing permissions and 00016 ** limitations under the License. 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef WERDIT_H 00021 #define WERDIT_H 00022 00023 #include "varable.h" 00024 #include "ocrblock.h" 00025 #include "notdll.h" 00026 00027 class WERDIT 00028 { 00029 public: 00030 WERDIT() { 00031 } //empty contructor 00032 WERDIT( //empty contructor 00033 BLOCK_LIST *blocklist) { //blocks on page 00034 start_page(blocklist); //ready to scan 00035 } 00036 00037 void start_page( //get ready 00038 BLOCK_LIST *blocklist); //blocks on page 00039 00040 WERD *forward(); //get next word 00041 WERD *next_word() { //get next word 00042 return word_it.data (); //already at next 00043 } 00044 ROW *row() { //get current row 00045 return word_it.cycled_list ()? NULL : row_it.data (); 00046 } 00047 ROW *next_row() { //get next row 00048 return row_it.data_relative (1); 00049 } 00050 BLOCK *block() { //get current block 00051 return block_it.data (); 00052 } 00053 00054 private: 00055 BLOCK_IT block_it; //iterators 00056 ROW_IT row_it; 00057 WERD_IT word_it; 00058 }; 00059 00060 //extern BOOL_VAR_H(wordit_linearc,FALSE,"Pass poly of linearc to Tess"); 00061 WERD *make_pseudo_word( //make fake word 00062 BLOCK_LIST *block_list, //blocks to check //block of selection 00063 TBOX &selection_box, 00064 BLOCK *&pseudo_block, 00065 ROW *&pseudo_row //row of selection 00066 ); 00067 #endif