Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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. More...
const JsonValueValue () const
 Return the JsonValue for this text. More...
bool SetValue (JsonValue *value)
 Set the value for this JsonData. More...
bool Apply (const JsonPatchSet &patch)
 Apply a set of JSON patches to the value. More...
const ValidatorInterfaceGetSchema () const
 Return the schema for this JSON data.

Constructor & Destructor Documentation

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

Construct a new JsonData.

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.

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

Set the value for this JsonData.

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

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: