Tesseract  3.02
tesseract-ocr/ccmain/mutableiterator.h
Go to the documentation of this file.
00001 
00002 // File:        mutableiterator.h
00003 // Description: Iterator for tesseract results providing access to
00004 //              both high-level API and Tesseract internal data structures.
00005 // Author:      David Eger
00006 // Created:     Thu Feb 24 19:01:06 PST 2011
00007 //
00008 // (C) Copyright 2011, Google Inc.
00009 // Licensed under the Apache License, Version 2.0 (the "License");
00010 // you may not use this file except in compliance with the License.
00011 // You may obtain a copy of the License at
00012 // http://www.apache.org/licenses/LICENSE-2.0
00013 // Unless required by applicable law or agreed to in writing, software
00014 // distributed under the License is distributed on an "AS IS" BASIS,
00015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016 // See the License for the specific language governing permissions and
00017 // limitations under the License.
00018 //
00020 
00021 #ifndef TESSERACT_CCMAIN_MUTABLEITERATOR_H__
00022 #define TESSERACT_CCMAIN_MUTABLEITERATOR_H__
00023 
00024 #include "resultiterator.h"
00025 
00026 class BLOB_CHOICE_IT;
00027 
00028 namespace tesseract {
00029 
00030 class Tesseract;
00031 
00032 // Class to iterate over tesseract results, providing access to all levels
00033 // of the page hierarchy, without including any tesseract headers or having
00034 // to handle any tesseract structures.
00035 // WARNING! This class points to data held within the TessBaseAPI class, and
00036 // therefore can only be used while the TessBaseAPI class still exists and
00037 // has not been subjected to a call of Init, SetImage, Recognize, Clear, End
00038 // DetectOS, or anything else that changes the internal PAGE_RES.
00039 // See apitypes.h for the definition of PageIteratorLevel.
00040 // See also base class PageIterator, which contains the bulk of the interface.
00041 // ResultIterator adds text-specific methods for access to OCR output.
00042 // MutableIterator adds access to internal data structures.
00043 
00044 class MutableIterator : public ResultIterator {
00045  public:
00046   // See argument descriptions in ResultIterator()
00047   MutableIterator(PAGE_RES* page_res, Tesseract* tesseract,
00048                   int scale, int scaled_yres,
00049                   int rect_left, int rect_top,
00050                   int rect_width, int rect_height)
00051       : ResultIterator(
00052           LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
00053                             rect_top, rect_width, rect_height)) {}
00054   virtual ~MutableIterator() {}
00055 
00056   // See PageIterator and ResultIterator for most calls.
00057 
00058   // Return access to Tesseract internals.
00059   const PAGE_RES_IT *PageResIt() const { return it_; }
00060 };
00061 
00062 }  // namespace tesseract.
00063 
00064 #endif  // TESSERACT_CCMAIN_MUTABLEITERATOR_H__