Skip to content

Commit

Permalink
C-API: add function to set init parameter during Init with c-string a…
Browse files Browse the repository at this point in the history
…rray

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1036 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
zdenop committed Feb 1, 2014
1 parent e28176c commit 080e0c0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions api/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<STRING> varNames;
GenericVector<STRING> 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)
{
Expand Down
5 changes: 5 additions & 0 deletions api/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down

0 comments on commit 080e0c0

Please sign in to comment.