Reads all boxes from the given filename. Reads a specific target_page number if >= 0, or all pages otherwise. Skips blanks if skip_blanks is true. The UTF-8 label of the box is put in texts, and the full box definition as a string is put in box_texts, with the corresponding page number in pages. Each of the output vectors is optional (may be NULL). Returns false if no boxes are found.
| 48 | // Each of the output vectors is optional (may be NULL). |
| 49 | // Returns false if no boxes are found. |
| 50 | bool ReadAllBoxes(int target_page, bool skip_blanks, const STRING& filename, |
| 51 | GenericVector<TBOX>* boxes, |
| 52 | GenericVector<STRING>* texts, |
| 53 | GenericVector<STRING>* box_texts, |
| 54 | GenericVector<int>* pages) { |
| 55 | GenericVector<char> box_data; |
| 56 | if (!tesseract::LoadDataFromFile(BoxFileName(filename), &box_data)) |
| 57 | return false; |
| 58 | // Convert the array of bytes to a string, so it can be used by the parser. |
| 59 | box_data.push_back('\0'); |
| 60 | return ReadMemBoxes(target_page, skip_blanks, &box_data[0], boxes, texts, |
| 61 | box_texts, pages); |
| 62 | } |
| 63 | |
| 64 | // Reads all boxes from the string. Otherwise, as ReadAllBoxes. |
| 65 | bool ReadMemBoxes(int target_page, bool skip_blanks, const char* box_data, |
no test coverage detected