Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
ola::web::JsonData Class Reference

Detailed Description

Represents a JSON text as defined in section 2 of RFC7158.

JsonData encapsulates a JsonValue and permits patch operations to be applied.

Clients should use this rather than JsonValues when using JSON patch operations. This is because some patch ops may delete the entire value, so you shouldn't really be passing JsonValue* around.

Public Member Functions

 JsonData (const JsonValue *value, ValidatorInterface *schema=NULL)
 Construct a new JsonData.
const JsonValueValue () const
 Return the JsonValue for this text.
bool SetValue (JsonValue *value)
 Set the value for this JsonData.
bool Apply (const JsonPatchSet &patch)
 Apply a set of JSON patches to the value.
const ValidatorInterfaceGetSchema () const
 Return the schema for this JSON data.

Constructor & Destructor Documentation

ola::web::JsonData::JsonData ( const JsonValue value,
ValidatorInterface schema = NULL 
)
inline

Construct a new JsonData.

Parameters
valueThe JsonValue to use, ownership is transferred.
schemaThe schema to validate this data against. Ownership is not transferred.

Member Function Documentation

bool ola::web::JsonData::Apply ( const JsonPatchSet patch)

Apply a set of JSON patches to the value.

Parameters
patchThe set of JsonPatch operations to apply.
Returns
True if the patch set was successfully applied, false otherwise.
bool ola::web::JsonData::SetValue ( JsonValue value)

Set the value for this JsonData.

Parameters
valuethe new JsonValue. Ownership is transferred.
const JsonValue* ola::web::JsonData::Value ( ) const
inline

Return the JsonValue for this text.

The pointer is valid until the next patch operation or call to SetValue()


The documentation for this class was generated from the following files: