! * \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
| 745 | * </pre> |
| 746 | */ |
| 747 | l_int32 |
| 748 | recogGetClassString(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 | /*! |
no test coverage detected