Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Macros | Enumerations | Functions | Variables
Universal Binary JSON content-type

Files

file  afw_ubjson.h
 Header file for Adaptive Framework UBJSON.
 

Macros

#define AFW_ERROR_RV_SOURCE_ID_Z_ubjson_marker   "ubjson_marker"
 
#define AFW_UBJSON_Q_CONTENT_TYPE   "application/ubjson"
 
#define AFW_UBJSON_S_CONTENT_TYPE   afw_s_a_application_ubjson
 
#define AFW_UBJSON_Q_CONTENT_TYPE_SHORT   "ubjson"
 
#define AFW_UBJSON_S_CONTENT_TYPE_SHORT   afw_s_ubjson
 
#define AFW_UBJSON_MARKER_NULL   'Z'
 
#define AFW_UBJSON_MARKER_NOOP   'N'
 
#define AFW_UBJSON_MARKER_TRUE   'T'
 
#define AFW_UBJSON_MARKER_FALSE   'F'
 
#define AFW_UBJSON_MARKER_INT8   'i'
 
#define AFW_UBJSON_MARKER_UINT8   'U'
 
#define AFW_UBJSON_MARKER_INT16   'I'
 
#define AFW_UBJSON_MARKER_INT32   'l'
 
#define AFW_UBJSON_MARKER_INT64   'L'
 
#define AFW_UBJSON_MARKER_FLOAT32   'd'
 
#define AFW_UBJSON_MARKER_FLOAT64   'D'
 
#define AFW_UBJSON_MARKER_HIGH_PRECISION   'H'
 
#define AFW_UBJSON_MARKER_CHAR   'C'
 
#define AFW_UBJSON_MARKER_STRING   'S'
 
#define AFW_UBJSON_MARKER_ARRAY   '['
 
#define AFW_UBJSON_MARKER_ARRAY_   ']'
 
#define AFW_UBJSON_MARKER_OBJECT   '{'
 
#define AFW_UBJSON_MARKER_OBJECT_   '}'
 
#define AFW_UBJSON_MARKER_TYPE   '$'
 
#define AFW_UBJSON_MARKER_COUNT   '#'
 
#define AFW_UBJSON_BYTES_CHAR   1
 
#define AFW_UBJSON_BYTES_INT8   1
 
#define AFW_UBJSON_BYTES_UINT8   1
 
#define AFW_UBJSON_BYTES_INT16   2
 
#define AFW_UBJSON_BYTES_INT32   4
 
#define AFW_UBJSON_BYTES_INT64   8
 
#define AFW_UBJSON_BYTES_FLOAT32   4
 
#define AFW_UBJSON_BYTES_FLOAT64   8
 

Enumerations

enum  AFW_UBJSON_VALUE_TYPE {
  AFW_UBJSON_VALUE_TYPE_NULL , AFW_UBJSON_VALUE_TYPE_NOOP , AFW_UBJSON_VALUE_TYPE_TRUE , AFW_UBJSON_VALUE_TYPE_FALSE ,
  AFW_UBJSON_VALUE_TYPE_INT8 , AFW_UBJSON_VALUE_TYPE_UINT8 , AFW_UBJSON_VALUE_TYPE_INT16 , AFW_UBJSON_VALUE_TYPE_INT32 ,
  AFW_UBJSON_VALUE_TYPE_INT64 , AFW_UBJSON_VALUE_TYPE_FLOAT32 , AFW_UBJSON_VALUE_TYPE_FLOAT64 , AFW_UBJSON_VALUE_TYPE_HIGH_PRECISION ,
  AFW_UBJSON_VALUE_TYPE_CHAR , AFW_UBJSON_VALUE_TYPE_STRING
}
 
enum  AFW_UBJSON_CONTAINER_TYPE { AFW_UBJSON_CONTAINER_TYPE_ARRAY , AFW_UBJSON_CONTAINER_TYPE_OBJECT }
 

Functions

const afw_utf8_tafw_ubjson_from_error (afw_xctx_t *xctx)
 Convert error from xctx to a UBJSON object. More...
 
const afw_memory_tafw_ubjson_from_value (const afw_value_t *value, const afw_pool_t *pool, afw_xctx_t *xctx)
 Convert an adaptive value to UBJSON. More...
 
const afw_value_tafw_ubjson_to_value (const afw_memory_t *ubjson, const afw_utf8_t *path, const afw_pool_t *pool, afw_xctx_t *xctx)
 Convert UBJSON to an adaptive value. More...
 
const afw_object_tafw_ubjson_to_object (const afw_memory_t *ubjson, 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 UBJSON to adaptive object. More...
 

Variables

const int AFW_UBJSON_SIZE []
 

Detailed Description

Adaptive Framework UBJSON support.

Macro Definition Documentation

◆ AFW_ERROR_RV_SOURCE_ID_Z_ubjson_marker

#define AFW_ERROR_RV_SOURCE_ID_Z_ubjson_marker   "ubjson_marker"

ubjson_marker rv source id

Definition at line 31 of file afw_ubjson.h.

Function Documentation

◆ afw_ubjson_from_error()

const afw_utf8_t* afw_ubjson_from_error ( afw_xctx_t xctx)

Convert error from xctx to a UBJSON object.

Parameters
xctxof caller.
Returns
UBJSON string.

◆ afw_ubjson_from_value()

const afw_memory_t* afw_ubjson_from_value ( const afw_value_t value,
const afw_pool_t pool,
afw_xctx_t xctx 
)

Convert an adaptive value to UBJSON.

Parameters
value
xctxof caller.
Returns
ubjson

This function can be used for callbacks of type afw_utf8_from_value_t.

Definition at line 483 of file afw_ubjson_from_value.c.

◆ afw_ubjson_to_object()

const afw_object_t* afw_ubjson_to_object ( const afw_memory_t ubjson,
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 UBJSON to adaptive object.

Parameters
rawUBJSON 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 483 of file afw_ubjson_to_value.c.

◆ afw_ubjson_to_value()

const afw_value_t* afw_ubjson_to_value ( const afw_memory_t ubjson,
const afw_utf8_t path,
const afw_pool_t pool,
afw_xctx_t xctx 
)

Convert UBJSON to an adaptive value.

Parameters
ubjsonUBJSON.
pathObject path or NULL.
object_idOptional id of object if value is object or NULL.
poolto use for memory allocation.
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 UBJSON 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 455 of file afw_ubjson_to_value.c.