MCPcopy Create free account
hub / github.com/creatale/node-dv / IsAtFinalElement

Method IsAtFinalElement

deps/tesseract/ccmain/pageiterator.cpp:208–226  ·  view source on GitHub ↗

* Returns whether the iterator is positioned at the last element in a * given level. (e.g. the last word in a line, the last line in a block) */

Source from the content-addressed store, hash-verified

206 * given level. (e.g. the last word in a line, the last line in a block)
207 */
208bool PageIterator::IsAtFinalElement(PageIteratorLevel level,
209 PageIteratorLevel element) const {
210 if (Empty(element)) return true; // Already at the end!
211 // The result is true if we step forward by element and find we are
212 // at the the end of the page or at beginning of *all* levels in:
213 // [level, element).
214 // When there is more than one level difference between element and level,
215 // we could for instance move forward one symbol and still be at the first
216 // word on a line, so we also have to be at the first symbol in a word.
217 PageIterator next(*this);
218 next.Next(element);
219 if (next.Empty(element)) return true; // Reached the end of the page.
220 while (element > level) {
221 element = static_cast<PageIteratorLevel>(element - 1);
222 if (!next.IsAtBeginningOf(element))
223 return false;
224 }
225 return true;
226}
227
228/**
229 * Returns whether this iterator is positioned

Callers 7

DetectParagraphsFunction · 0.45
GetComponentImagesMethod · 0.45
GetHOCRTextMethod · 0.45
GetTSVTextMethod · 0.45
GetPDFTextObjectsMethod · 0.45

Calls 3

NextMethod · 0.45
EmptyMethod · 0.45
IsAtBeginningOfMethod · 0.45

Tested by

no test coverage detected