SpParser Struct Reference

Public Member Functions

SpParsersp_parser_new_with_context (ScRecognitionContext *context, SpParserType type, ScContextStatusFlag *status)
void sp_parser_free (SpParser *parser)
SpBool sp_parser_parse_string (SpParser *parser, char const *str, size_t length, SpParserResult **result)
SpData sp_parser_set_options (SpParser *parser, char const *str, size_t length)

Detailed Description

Parser interface.

Member Function Documentation

SpParser * sp_parser_new_with_context ( ScRecognitionContext context,
SpParserType  type,
ScContextStatusFlag status 

Creates a parser if the license used by the context permits it.

contexta recognition context. Must not be null.
typetype of the parser
statusindicates errors during instantiation. Check this flag if the returned parser is a null pointer. Also, see sc_context_status_flag_get_message and ScContextStatusFlag for more information about status flags.
a parser object or null if the license does not include the parser
void sp_parser_free ( SpParser parser)

Free the parser and associated resources.

parserThe parser to free. May be null
SpBool sp_parser_parse_string ( SpParser parser,
char const *  str,
size_t  length,
SpParserResult **  result 

parse the data contained in the given string

parserThe parser object. Must not be null.
strinput string. Must not be null.
lengthlength of the input string
resultouput parameter. Needs to be freed by the caller.
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 sp_parse_result_get_error_message.
SpData sp_parser_set_options ( SpParser parser,
char const *  str,
size_t  length 

Sets the options contained in the given json string.

parserThe parser object. Must not be null.
stroptions string. Must not be null.
lengthlength of the options string
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 SpData structure using sp_data_free.

The documentation for this struct was generated from the following file: