libscipaper 1.0.x
|
Data Structures | |
struct | nx_json |
This struct discribes a parsed entry or file. More... | |
Typedefs | |
typedef int(* | nx_json_unicode_encoder) (unsigned int codepoint, char *p, char **endp) |
this typdef descibes a function that takes a Unicode codepoint and writes corresponding encoded value into buffer pointed by p. | |
Enumerations | |
enum | nx_json_type { NX_JSON_NULL , NX_JSON_OBJECT , NX_JSON_ARRAY , NX_JSON_STRING , NX_JSON_INTEGER , NX_JSON_DOUBLE , NX_JSON_BOOL } |
This enum is used in nx_json to discribe what type a given json entry has. More... | |
Functions | |
const nx_json * | nx_json_parse (char *text, nx_json_unicode_encoder encoder) |
This struct discribes a parsed entry or file. | |
const nx_json * | nx_json_parse_utf8 (char *text) |
This is shortcut for nx_json_parse(text, nx_json_unicode_to_utf8) where nx_json_unicode_to_utf8 is unicode to UTF-8 encoder provided by NXJSON. | |
void | nx_json_free (const nx_json *js) |
Frees a nx_json struct parsed by nx_json_parse() | |
const nx_json * | nx_json_get (const nx_json *json, const char *key) |
Gets object's property or child by key. | |
const nx_json * | nx_json_item (const nx_json *json, int idx) |
Gets an array element by index This function never returns NULL or fails for any reason. | |
Variables | |
nx_json_unicode_encoder | nx_json_unicode_to_utf8 |
typedef int(* nx_json_unicode_encoder) (unsigned int codepoint, char *p, char **endp) |
this typdef descibes a function that takes a Unicode codepoint and writes corresponding encoded value into buffer pointed by p.
It should store pointer to the end of encoded value into *endp. The function should return 1 on success and 0 on error. Number of bytes written must not exceed 6.
enum nx_json_type |
This enum is used in nx_json to discribe what type a given json entry has.
Gets object's property or child by key.
This function never returns NULL or fails for any reason. If a parse error occures or the requested key dosent exist a object of type NX_JSON_NULL is returned.
json | parent json object |
key | key of the child or property you want |
Gets an array element by index This function never returns NULL or fails for any reason.
If a parse error occures or the requested key dosent exist a object of type NX_JSON_NULL is returned.
json | The array |
idx | The index where you want to get the object out of the array |
const nx_json * nx_json_parse | ( | char * | text, |
nx_json_unicode_encoder | encoder ) |
This struct discribes a parsed entry or file.
text | a text string containing the json to be parsed |
encoder | a function of type nx_json_unicode_encoder |
const nx_json * nx_json_parse_utf8 | ( | char * | text | ) |
This is shortcut for nx_json_parse(text, nx_json_unicode_to_utf8) where nx_json_unicode_to_utf8 is unicode to UTF-8 encoder provided by NXJSON.
text | a text string containing the json to be parsed |