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

Function recogGetClassString

deps/leptonica/src/recogbasic.c:747–765  ·  view source on GitHub ↗

! * \brief recogGetClassString() * * \param[in] recog * \param[in] index into array of char types * \param[out] pcharstr string representation; * returns an empty string on error * \return 0 if found, 1 on error * * * Notes: * (1) Extracts a copy of the string from sa_text, which * the caller must free. * (2) Caller must check

Source from the content-addressed store, hash-verified

745 * </pre>
746 */
747l_int32
748recogGetClassString(L_RECOG *recog,
749 l_int32 index,
750 char **pcharstr)
751{
752 PROCNAME("recogGetClassString");
753
754 if (!pcharstr)
755 return ERROR_INT("&charstr not defined", procName, 1);
756 *pcharstr = stringNew("");
757 if (!recog)
758 return ERROR_INT("recog not defined", procName, 2);
759
760 if (index < 0 || index >= recog->setsize)
761 return ERROR_INT("invalid index", procName, 1);
762 LEPT_FREE(*pcharstr);
763 *pcharstr = sarrayGetString(recog->sa_text, index, L_COPY);
764 return 0;
765}
766
767
768/*!

Callers 4

recogStringToIndexFunction · 0.85
recogShowMatchFunction · 0.85
recogCorrelationBestCharFunction · 0.85
recogIdentifyPixFunction · 0.85

Calls 2

stringNewFunction · 0.85
sarrayGetStringFunction · 0.85

Tested by

no test coverage detected