From 080e0c028a96619a93299009abfcaa485f278998 Mon Sep 17 00:00:00 2001 From: zdenop Date: Sat, 1 Feb 2014 10:36:40 +0000 Subject: [PATCH] C-API: add function to set init parameter during Init with c-string array git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1036 d0cd1f9f-072b-0410-8dd7-cf729c803f20 --- api/capi.cpp | 18 ++++++++++++++++++ api/capi.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/api/capi.cpp b/api/capi.cpp index d73bbfdfab..5e36252e61 100644 --- a/api/capi.cpp +++ b/api/capi.cpp @@ -113,6 +113,24 @@ TESS_API BOOL TESS_CALL TessBaseAPIGetVariableAsString(TessBaseAPI* handle, cons return handle->GetVariableAsString(name, val) ? TRUE : FALSE; } +TESS_API int TESS_CALL TessBaseAPIInit4(TessBaseAPI* handle, const char* datapath, const char* language, + TessOcrEngineMode mode, char** configs, int configs_size, + char** vars_vec, char** vars_values, size_t vars_vec_size, + BOOL set_only_non_debug_params) +{ + GenericVector varNames; + GenericVector varValues; + if (vars_vec != NULL && vars_values != NULL) { + for (int i = 0; i < vars_vec_size; i++) { + varNames.push_back(STRING(vars_vec[i])); + varValues.push_back(STRING(vars_values[i])); + } + } + + return handle->Init(datapath, language, mode, configs, configs_size, &varNames, &varValues, set_only_non_debug_params); +} + + TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem, char** configs, int configs_size) { diff --git a/api/capi.h b/api/capi.h index 8f4bfdd9d4..25d61bb60c 100644 --- a/api/capi.h +++ b/api/capi.h @@ -116,6 +116,11 @@ TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle, const char* datap TESS_API int TESS_CALL TessBaseAPIInit2(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem); TESS_API int TESS_CALL TessBaseAPIInit3(TessBaseAPI* handle, const char* datapath, const char* language); +TESS_API int TESS_CALL TessBaseAPIInit4(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode mode, + char** configs, int configs_size, + char** vars_vec, char** vars_values, size_t vars_vec_size, + BOOL set_only_non_debug_params); + TESS_API const char* TESS_CALL TessBaseAPIGetInitLanguagesAsString(const TessBaseAPI* handle); TESS_API char**