jkii
|
#include <jkii.h>
Data Fields | |
const char * | name |
const char * | path |
jkii_field_err_t | result |
jkii_field_type_t | type |
size_t | start |
size_t | end |
union { | |
char * string | |
int int_value | |
long long_value | |
double double_value | |
jkii_boolean_t boolean_value | |
} | field_copy |
size_t | field_copy_buff_size |
JSON parsed field data.
Input of jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*).
Array of jkii_field_t is passed to jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*).
End point of the array is specified by jkii_field_t::name and jkii_field_t::path. If both of jkii_field_t::name and jkii_field_t::path are NULL, jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*) consider that it is the end point of the passed array.
jkii_boolean_t jkii_field_t::boolean_value |
This value is used if jkii_field_t::type is jkii_field_type_t::JKII_FIELD_TYPE_BOOLEAN.
double jkii_field_t::double_value |
This value is used if jkii_field_t::type is jkii_field_type_t::JKII_FIELD_TYPE_DOUBLE. If parsing target is overflowed, then this value is plus or minus HUGE_VAL. If parsing is underflowed, then this value is 0.
size_t jkii_field_t::end |
End point of this field in given buffer. Output of jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*).
union { ... } jkii_field_t::field_copy |
Buffer to copy field value. if NULL, no copy is generated. Using value is determined by value of jkii_field_t::type. If jkii_field_t::type is jkii_field_type_t::JKII_FIELD_TYPE_NULL, no copy is generated.
size_t jkii_field_t::field_copy_buff_size |
Length of field_copy::string. ignored if field_copy::string is null or jkii_field_t::type is not jkii_field_type_t::JKII_FIELD_TYPE_STRING, jkii_field_type_t::JKII_FIELD_TYPE_OBJECT and jkii_field_type_t::JKII_FIELD_TYPE_ARRAY.
int jkii_field_t::int_value |
This value is used if jkii_field_t::type is jkii_field_type_t::JKII_FIELD_TYPE_INTEGER. If parsing target is overflowed, then this value is INT_MAX. If parsing is underflowed, then this value is INT_MIN.
long jkii_field_t::long_value |
This value is used if jkii_field_t::type is jkii_field_type_t::JKII_FIELD_TYPE_LONG. If parsing target is overflowed, then this value is LONG_MAX. If parsing is underflowed, then this value is LONG_MIN.
const char* jkii_field_t::name |
Parsing target key name. Input of jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*).
Addressing a top-level field in a json object.
const char* jkii_field_t::path |
Parsing target path. Input of jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*).
This can point any field or element of array. BNF like notation of path is following:
If you want to get first element of color array in following json example:
In rare cases, like following:
You can specify "[]/\\" as following:
jkii_field_err_t jkii_field_t::result |
Field parse result. Output of jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*).
size_t jkii_field_t::start |
Start point of this field in given buffer. Output of jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*).
char* jkii_field_t::string |
This value is used if jkii_field_t::type is jkii_field_type_t::JKII_FIELD_TYPE_STRING, jkii_field_type_t::JKII_FIELD_TYPE_OBJECT or jkii_field_type_t::JKII_FIELD_TYPE_ARRAY.
jkii_field_type_t jkii_field_t::type |
Parsed target value type. Input and Output of jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*). Inputted value is expected value type and outputted value is actual value type.
If type is set as jkii_field_type_t::JKII_FIELD_TYPE_ANY, then jkii_parse(jkii_t*, const char*, size_t, jkii_field_t*) ignore type checking.
If actual type is not matched expected type: