SpParserResult Struct Reference

Public Member Functions

void sp_parser_result_free (SpParserResult *result)
 
size_t sp_parser_result_get_fields_count (SpParserResult const *result)
 
SpField const * sp_parser_result_get_field_by_name (SpParserResult const *result, char const *field_name)
 
SpField const * sp_parser_result_get_field_by_index (SpParserResult const *result, size_t index)
 
SpBool sp_parser_result_is_ok (SpParserResult const *result)
 
SpData sp_parser_result_get_error_message (SpParserResult const *result)
 
SpData sp_parser_result_get_json_values (SpParserResult const *result)
 

Detailed Description

Parser result.

Member Function Documentation

void sp_parser_result_free ( SpParserResult result)

Free the parsing result and any resource associated with it, including all its fields.

Parameters
resultThe parsing result. May be null.
size_t sp_parser_result_get_fields_count ( SpParserResult const *  result)

Get number of fields of this result.

Parameters
resultThe parser result. Must not be NULL.
Returns
The number of fields
SpField const * sp_parser_result_get_field_by_name ( SpParserResult const *  result,
char const *  field_name 
)

Get the data associated with a field.

Parameters
resultThe parser result. Must not be NULL.
field_nameThe field name. Must not be NULL.
Returns
The data associated to the given field. In case no field of the given name exists, NULL is returned.
SpField const * sp_parser_result_get_field_by_index ( SpParserResult const *  result,
size_t  index 
)

Get the data associated with a field.

Parameters
resultThe parsing result. Must not be NULL.
indexThe field index.
Returns
The data associated to the given field. In case the field index is out of range, NULL is returned.
SpBool sp_parser_result_is_ok ( SpParserResult const *  result)

Returns true when result contains a valid result, false if an error occurred during parsing.

Parameters
resultThe parsing result. Must not be NULL.
SpData sp_parser_result_get_error_message ( SpParserResult const *  result)

Retrieve error message from parser result.

In case there were no errors, a NULL string is returned.

Parameters
resultThe parser result. Must not be NULL.
Returns
the error message. The life-time of the string is not bound to the life-time of the of the parser result. The user has to free the SpData structure using sp_data_free.
SpData sp_parser_result_get_json_values ( SpParserResult const *  result)

Returns the json string value of the fields in a result.

Parameters
resultThe parser result. Must not be NULL. The life-time of the string is bound to the life-time of the parser result. The user has to free the SpData structure using sp_data_free. Returns NULL if the result is NULL.

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