• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**********************************************************************
2  * File:			wordit.c
3  * Description: An iterator for passing over all the words in a document.
4  * Author:		Ray Smith
5  * Created:		Mon Apr 27 08:51:22 BST 1992
6  *
7  * (C) Copyright 1992, Hewlett-Packard Ltd.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  *
18  **********************************************************************/
19 
20 #ifndef           WERDIT_H
21 #define           WERDIT_H
22 
23 #include          "varable.h"
24 #include          "ocrblock.h"
25 #include          "notdll.h"
26 
27 class WERDIT
28 {
29   public:
WERDIT()30     WERDIT() {
31     }                            //empty contructor
WERDIT(BLOCK_LIST * blocklist)32     WERDIT(                          //empty contructor
33            BLOCK_LIST *blocklist) {  //blocks on page
34       start_page(blocklist);  //ready to scan
35     }
36 
37     void start_page(                         //get ready
38                     BLOCK_LIST *blocklist);  //blocks on page
39 
40     WERD *forward();  //get next word
next_word()41     WERD *next_word() {  //get next word
42       return word_it.data ();    //already at next
43     }
row()44     ROW *row() {  //get current row
45       return word_it.cycled_list ()? NULL : row_it.data ();
46     }
next_row()47     ROW *next_row() {  //get next row
48       return row_it.data_relative (1);
49     }
block()50     BLOCK *block() {  //get current block
51       return block_it.data ();
52     }
53 
54   private:
55     BLOCK_IT block_it;           //iterators
56     ROW_IT row_it;
57     WERD_IT word_it;
58 };
59 
60 //extern BOOL_VAR_H(wordit_linearc,FALSE,"Pass poly of linearc to Tess");
61 WERD *make_pseudo_word(                         //make fake word
62                        BLOCK_LIST *block_list,  //blocks to check //block of selection
63                        TBOX &selection_box,
64                        BLOCK *&pseudo_block,
65                        ROW *&pseudo_row         //row of selection
66                       );
67 #endif
68