Adaptive Framework
0.9.0
|
Files | |
file | afw_json.h |
Header file for Adaptive Framework JSON. | |
Macros | |
#define | AFW_JSON_Q_CONTENT_TYPE "application/json" |
#define | AFW_JSON_S_CONTENT_TYPE afw_s_a_application_json |
#define | AFW_JSON_Q_CONTENT_TYPE_SHORT "json" |
#define | AFW_JSON_S_CONTENT_TYPE_SHORT afw_s_json |
#define | AFW_JSON_PN_JSON_PRIMITIVE AFW_Q_jsonPrimitive |
#define | AFW_JSON_PN_s_JSON_PRIMITIVE afw_s_jsonPrimitive |
#define | AFW_JSON_Q_PRIMITIVE_OBJECT AFW_Q_object |
#define | AFW_JSON_S_PRIMITIVE_OBJECT afw_s_object |
#define | AFW_JSON_Q_PRIMITIVE_ARRAY AFW_Q_array |
#define | AFW_JSON_S_PRIMITIVE_ARRAY afw_s_array |
#define | AFW_JSON_Q_PRIMITIVE_NUMBER AFW_Q_number |
#define | AFW_JSON_S_PRIMITIVE_NUMBER afw_s_number |
#define | AFW_JSON_Q_PRIMITIVE_STRING AFW_Q_string |
#define | AFW_JSON_S_PRIMITIVE_STRING afw_s_string |
#define | AFW_JSON_Q_PRIMITIVE_BOOLEAN AFW_Q_boolean |
#define | AFW_JSON_S_PRIMITIVE_BOOLEAN afw_s_boolean |
#define | AFW_JSON_Q_PRIMITIVE_NULL AFW_Q_null |
#define | AFW_JSON_S_PRIMITIVE_NULL afw_s_null |
#define | AFW_JSON_Q_PRIMITIVE_BOOLEAN_TRUE AFW_Q_true |
#define | AFW_JSON_S_PRIMITIVE_BOOLEAN_TRUE afw_s_true |
#define | AFW_JSON_Q_PRIMITIVE_BOOLEAN_FALSE AFW_Q_false |
#define | AFW_JSON_S_PRIMITIVE_BOOLEAN_FALSE afw_s_false |
#define | AFW_JSON_Q_INFINITY "Infinity" |
#define | AFW_JSON_Q_MINUS_INFINITY "-Infinity" |
#define | AFW_JSON_Q_NAN "NaN" |
#define | AFW_JSON_Q_MINUS_NAN "-NaN" |
#define | AFW_JSON_Q_PN_META AFW_OBJECT_Q_PN_META |
#define | AFW_JSON_Q_PN_ID AFW_OBJECT_Q_PN_ID |
#define | AFW_JSON_Q_PN_PATH AFW_OBJECT_Q_PN_PATH |
#define | AFW_JSON_Q_PN_OBJECT_TYPE AFW_OBJECT_Q_PN_OBJECT_TYPE |
#define | AFW_JSON_Q_PN_PARENT_PATH AFW_OBJECT_Q_PN_PARENT_PATH |
#define | afw_json_to_value(json, source_location, p, xctx) |
Convert JSON to an adaptive value. More... | |
#define | afw_json_to_object(string, cede_p, p, xctx) |
Compile json string to adaptive object. More... | |
#define | afw_json_to_object_with_meta(string, source_location, adaptor_id, object_type_id, object_id, cede_p, p, xctx) |
Compile json string to adaptive object with meta. More... | |
Functions | |
const afw_content_type_t * | afw_json_content_type_get () |
Get the content type instance for json. | |
void | afw_json_register (afw_xctx_t *xctx) |
Register JSON support. More... | |
const afw_utf8_t * | afw_json_from_value (const afw_value_t *value, const afw_object_options_t *options, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert an adaptive value to JSON. More... | |
void | afw_json_write_encoded_string (const afw_utf8_t *string, const afw_writer_t *writer, afw_xctx_t *xctx) |
Write string as json encoded string. More... | |
afw_json_utf8_string_create (const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx) | |
Create a json encoded quoted string. More... | |
Adaptive Framework JSON support
#define AFW_JSON_Q_PN_META AFW_OBJECT_Q_PN_META |
Property name "_meta_" of a special JSON object property whose value is an object. The properties of this object correspond to certain methods of the afw_object interface or carry additional information.
Property name | Related method or purpose |
---|---|
objectId | afw_object_meta_get_object_id() |
path | afw_object_meta_get_path() |
objectType | afw_object_meta_get_object_type() |
parentPaths | afw_object_meta_get_parent_paths() |
Properties parentPaths and expanded can be included in input objects to
Definition at line 77 of file afw_json.h.
#define afw_json_to_object | ( | string, | |
cede_p, | |||
p, | |||
xctx | |||
) |
Compile json string to adaptive object.
string | to compile. |
cede_p | if true, cede control of p to the created object. |
p | to use. |
xctx | of caller. |
Definition at line 142 of file afw_json.h.
#define afw_json_to_object_with_meta | ( | string, | |
source_location, | |||
adaptor_id, | |||
object_type_id, | |||
object_id, | |||
cede_p, | |||
p, | |||
xctx | |||
) |
Compile json string to adaptive object with meta.
string | to compile. |
source_location | or NULL. |
adaptor_id | to use for created object. |
object_type_id | to use for created object. |
object_id | to use for created object. |
cede_p | if true, cede control of p to the created object. |
p | to use. |
xctx | of caller. |
If source_location is NULL and path is specified, adaptor_id, object_type_id, and object_id will be used to produce a path that will be used as the source location.
If adaptor_id is NULL, object_type_id and object_id must be NULL. If they're NULL, the object's meta will not be set.
Definition at line 167 of file afw_json.h.
#define afw_json_to_value | ( | json, | |
source_location, | |||
p, | |||
xctx | |||
) |
Convert JSON to an adaptive value.
json | JSON. |
source_location | or NULL. |
object_id | Optional id of object if value is object or NULL. |
p | to use. |
xctx | of caller. |
This function can be used for callbacks of type afw_utf8_to_value_t.
Definition at line 128 of file afw_json.h.
const afw_utf8_t* afw_json_from_value | ( | const afw_value_t * | value, |
const afw_object_options_t * | options, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert an adaptive value to JSON.
value | |
options | or NULL. |
p | to use. |
xctx | of caller. |
This function can be used for callbacks of type afw_utf8_from_value_t.
Definition at line 494 of file afw_json_from_value.c.
void afw_json_register | ( | afw_xctx_t * | xctx | ) |
Register JSON support.
xctx | of caller. |
This is called by afw_environment_register_core.c to register JSON support.
afw_json_utf8_string_create | ( | const afw_utf8_t * | string, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a json encoded quoted string.
string | to encode. |
p | for result. |
Definition at line 587 of file afw_json_from_value.c.
void afw_json_write_encoded_string | ( | const afw_utf8_t * | string, |
const afw_writer_t * | writer, | ||
afw_xctx_t * | xctx | ||
) |
Write string as json encoded string.
string | to write. |
writer | to use. |
xctx | of caller. |
Definition at line 513 of file afw_json_from_value.c.