Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Macros | Functions

Files

file  afw_yaml.h
 Header file for Adaptive Framework YAML.
 

Macros

#define AFW_ERROR_RV_SOURCE_ID_Z_yaml_parser   "yaml_parser"
 
#define AFW_ERROR_RV_SOURCE_ID_Z_yaml_token_type   "yaml_token_type"
 
#define AFW_YAML_Q_CONTENT_TYPE   "application/x-yaml"
 
#define AFW_YAML_S_CONTENT_TYPE   afw_s_a_application_yaml
 
#define AFW_YAML_Q_CONTENT_TYPE_SHORT   "yaml"
 
#define AFW_YAML_S_CONTENT_TYPE_SHORT   afw_s_yaml
 

Functions

void afw_yaml_register (afw_xctx_t *xctx)
 Register YAML support. More...
 
const afw_utf8_tafw_yaml_from_error (afw_xctx_t *xctx)
 Convert error from xctx to a YAML object. More...
 
const afw_utf8_tafw_yaml_from_value (const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
 Convert an adaptive value to YAML. More...
 
const afw_value_tafw_yaml_to_value (const afw_memory_t *yaml, const afw_utf8_t *path, const afw_pool_t *p, afw_xctx_t *xctx)
 Convert YAML to an adaptive value. More...
 
const afw_object_tafw_yaml_to_object (const afw_memory_t *yaml, const afw_utf8_t *source_location, const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_boolean_t cede_p, const afw_pool_t *p, afw_xctx_t *xctx)
 Convert from YAML to adaptive object. More...
 

Detailed Description

Adaptive Framework YAML support

Macro Definition Documentation

◆ AFW_ERROR_RV_SOURCE_ID_Z_yaml_parser

#define AFW_ERROR_RV_SOURCE_ID_Z_yaml_parser   "yaml_parser"

yaml_parser rv source id

Definition at line 32 of file afw_yaml.h.

◆ AFW_ERROR_RV_SOURCE_ID_Z_yaml_token_type

#define AFW_ERROR_RV_SOURCE_ID_Z_yaml_token_type   "yaml_token_type"

yaml_token_type rv source id

Definition at line 35 of file afw_yaml.h.

Function Documentation

◆ afw_yaml_from_error()

const afw_utf8_t* afw_yaml_from_error ( afw_xctx_t xctx)

Convert error from xctx to a YAML object.

Parameters
xctxof caller.
Returns
YAML string.

Definition at line 176 of file afw_yaml.c.

◆ afw_yaml_from_value()

const afw_utf8_t* afw_yaml_from_value ( const afw_value_t value,
const afw_pool_t p,
afw_xctx_t xctx 
)

Convert an adaptive value to YAML.

Parameters
value
pto use.
xctxof caller.
Returns
yaml

This function can be used for callbacks of type afw_utf8_from_value_t.

Definition at line 539 of file afw_yaml_from_value.c.

◆ afw_yaml_register()

void afw_yaml_register ( afw_xctx_t xctx)

Register YAML support.

Parameters
xctxof caller.

This is called by afw_environment_register_core.c to register YAML support.

Definition at line 92 of file afw_yaml.c.

◆ afw_yaml_to_object()

const afw_object_t* afw_yaml_to_object ( const afw_memory_t yaml,
const afw_utf8_t source_location,
const afw_utf8_t adaptor_id,
const afw_utf8_t object_type_id,
const afw_utf8_t object_id,
afw_boolean_t  cede_p,
const afw_pool_t p,
afw_xctx_t xctx 
)

Convert from YAML to adaptive object.

Parameters
rawYAML to convert.
source_locationor NULL.
adaptor_idto use for created object.
object_type_idto use for created object.
object_idto use for created object.
cede_pif true, cede control of p to the created object.
pto use.
xctxof caller.
Returns
object instance.

Definition at line 388 of file afw_yaml_to_value.c.

◆ afw_yaml_to_value()

const afw_value_t* afw_yaml_to_value ( const afw_memory_t yaml,
const afw_utf8_t path,
const afw_pool_t p,
afw_xctx_t xctx 
)

Convert YAML to an adaptive value.

Parameters
yamlYAML.
pathObject path or NULL.
object_idOptional id of object if value is object or NULL.
poolto allocate memory on.
xctxof caller.
Returns
value

This function can be used for callbacks of type afw_utf8_to_value_t.

The path parameter is only used if the YAML being parsed is an object entity.

The path must be of the form /<adaptor id>/<object type>/<id>. This path is parsed to provide return values for the object's afw_object_meta_get_object_id(), afw_object_meta_get_path(), and afw_object_get_object_type() methods.

Definition at line 338 of file afw_yaml_to_value.c.