ScParser Struct Reference
Public Member Functions | |
| ScParser * | sc_parser_new_with_context (ScRecognitionContext *context, ScParserType type, ScContextStatus *status) |
| void | sc_parser_free (ScParser *parser) |
| ScBool | sc_parser_parse_string (ScParser *parser, char const *str, size_t length, ScParserResult **result) |
| ScByteArray | sc_parser_set_options (ScParser *parser, char const *str, size_t length) |
Detailed Description
Parser interface.
Member Function Documentation
| ScParser * sc_parser_new_with_context | ( | ScRecognitionContext * | context, |
| ScParserType | type, | ||
| ScContextStatus * | status | ||
| ) |
Creates a parser if the license used by the context permits it.
- Parameters
-
context a recognition context. Must not be null. type type of the parser status An optional pointer to the status struct to write parser creation error status to. May be null, otherwise instance must be freed with sc_context_status_free.
- Returns
- a parser object or null if the license does not include the parser
| void sc_parser_free | ( | ScParser * | parser | ) |
Free the parser and associated resources.
- Parameters
-
parser The parser to free. May be null
| ScBool sc_parser_parse_string | ( | ScParser * | parser, |
| char const * | str, | ||
| size_t | length, | ||
| ScParserResult ** | result | ||
| ) |
parse the data contained in the given string
- Parameters
-
parser The parser object. Must not be null. str input string. Must not be null. length length of the input string result ouput parameter. Needs to be freed by the caller.
- Returns
- True on success, false if the data could not be parsed for some reason. In case of error, more details on why the parsing failed can be obtained by calling ScParserResult::sc_parser_result_get_error_message.
| ScByteArray sc_parser_set_options | ( | ScParser * | parser, |
| char const * | str, | ||
| size_t | length | ||
| ) |
Sets the options contained in the given json string.
- Parameters
-
parser The parser object. Must not be null. str options string. Must not be null. length length of the options string
- Returns
- the error message. If there were no errors, a NULL string is returned. The life-time of the string is not bound to the life-time of the parser object. The user has to free the ScByteArray structure using sc_byte_array_free.
The documentation for this struct was generated from the following file: