Make a text string from the internal data structures. */
| 1279 | |
| 1280 | /** Make a text string from the internal data structures. */ |
| 1281 | char* TessBaseAPI::GetUTF8Text() { |
| 1282 | if (tesseract_ == NULL || |
| 1283 | (!recognition_done_ && Recognize(NULL) < 0)) |
| 1284 | return NULL; |
| 1285 | STRING text(""); |
| 1286 | ResultIterator *it = GetIterator(); |
| 1287 | do { |
| 1288 | if (it->Empty(RIL_PARA)) continue; |
| 1289 | char *para_text = it->GetUTF8Text(RIL_PARA); |
| 1290 | text += para_text; |
| 1291 | delete []para_text; |
| 1292 | } while (it->Next(RIL_PARA)); |
| 1293 | char* result = new char[text.length() + 1]; |
| 1294 | strncpy(result, text.string(), text.length() + 1); |
| 1295 | delete it; |
| 1296 | return result; |
| 1297 | } |
| 1298 | |
| 1299 | /** |
| 1300 | * Gets the block orientation at the current iterator position. |
no test coverage detected