ScParserResult Struct Reference

Public Member Functions

void sc_parser_result_free (ScParserResult *result)
 
size_t sc_parser_result_get_fields_count (ScParserResult const *result)
 
ScField const * sc_parser_result_get_field_by_name (ScParserResult const *result, char const *field_name)
 
ScField const * sc_parser_result_get_field_by_index (ScParserResult const *result, size_t index)
 
ScBool sc_parser_result_is_ok (ScParserResult const *result)
 
ScByteArray sc_parser_result_get_error_message (ScParserResult const *result)
 
ScByteArray sc_parser_result_get_json_values (ScParserResult const *result)
 

Detailed Description

Parser result.

Member Function Documentation

void sc_parser_result_free ( ScParserResult result)

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

Parameters
resultThe parsing result. May be null.
size_t sc_parser_result_get_fields_count ( ScParserResult const *  result)

Get number of fields of this result.

Parameters
resultThe parser result. Must not be NULL.
Returns
The number of fields
ScField const * sc_parser_result_get_field_by_name ( ScParserResult 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.
ScField const * sc_parser_result_get_field_by_index ( ScParserResult 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.
ScBool sc_parser_result_is_ok ( ScParserResult 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.
Returns
SC_TRUE if the result is valid.
ScByteArray sc_parser_result_get_error_message ( ScParserResult 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 ScByteArray structure using sc_byte_array_free.
ScByteArray sc_parser_result_get_json_values ( ScParserResult const *  result)

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

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

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