#include <kii_json.h>
Public Attributes | |
kii_json_resource_t * | resource |
KII_JSON_RESOURCE_CB | resource_cb |
char * | error_string_buff |
size_t | error_string_length |
object manages context of kii json apis. Do not share this object and fields inside this object among the thread/tasks. library won't sync the request if the multiple threads/tasks share the resource.
char* kii_json_t::error_string_buff |
Error string. If error occurs in kii_json library, then error message is set to this fields. If NULL, no error message is set.
size_t kii_json_t::error_string_length |
Size of error_string_buff.
kii_json_resource_t* kii_json_t::resource |
Resource used by KII JSON library.
This field is optional. If KII_JSON_FIXED_TOKEN_NUM macro is defined, KII JSON library allocate resources in stack memory with the size specified number by the macro. In this case, re-allocation won't happens. This would be convenient if your environment has enough size of stack memory to work with the targetting JSON data structure.
If KII_JSON_FIXED_TOKEN_NUM macro is not present, you can allocate resource anywhere you want to put. Library never allocate/free the resource. Allocation and free must be done by application. In case of running out given resource and need more resouces to parse given JSON string, library calls resource_cb to ask application to allocate more resources.
KII_JSON_RESOURCE_CB kii_json_t::resource_cb |
Callback asks for allocate more tokens to parse JSON.
Called when the target JSON string can not be parsed with given resource. Library won't try to allocate resource when given resource is not enough to parse JSON string when this field is NULL.
If KII_JSON_FIXED_TOKEN_NUM is defined, this callback won't be called.