werdit.h 2.3 KB
Newer Older
T
tmbdev 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
/**********************************************************************
 * File:			wordit.c
 * Description: An iterator for passing over all the words in a document.
 * Author:		Ray Smith
 * Created:		Mon Apr 27 08:51:22 BST 1992
 *
 * (C) Copyright 1992, Hewlett-Packard Ltd.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.
 *
 **********************************************************************/

#ifndef           WERDIT_H
#define           WERDIT_H

#include          "varable.h"
#include          "ocrblock.h"
#include          "notdll.h"

class WERDIT
{
  public:
    WERDIT() { 
    }                            //empty contructor
    WERDIT(                          //empty contructor
           BLOCK_LIST *blocklist) {  //blocks on page
      start_page(blocklist);  //ready to scan
    }

    void start_page(                         //get ready
                    BLOCK_LIST *blocklist);  //blocks on page

    WERD *forward();  //get next word
    WERD *next_word() {  //get next word
      return word_it.data ();    //already at next
    }
    ROW *row() {  //get current row
      return word_it.cycled_list ()? NULL : row_it.data ();
    }
    ROW *next_row() {  //get next row
      return row_it.data_relative (1);
    }
    BLOCK *block() {  //get current block
      return block_it.data ();
    }

  private:
    BLOCK_IT block_it;           //iterators
    ROW_IT row_it;
    WERD_IT word_it;
};

//extern BOOL_VAR_H(wordit_linearc,FALSE,"Pass poly of linearc to Tess");
WERD *make_pseudo_word(                         //make fake word
                       BLOCK_LIST *block_list,  //blocks to check //block of selection
                       BOX &selection_box,
                       BLOCK *&pseudo_block,
                       ROW *&pseudo_row         //row of selection
                      );
#endif