Open Lighting Architecture: ola::web::JsonData Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Public Member Functions | List of all members
ola::web::JsonData Class Reference
JSON

## 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 JsonValue * | Value () 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 ValidatorInterface * | GetSchema () const
| Return the schema for this JSON data.

## Constructor & Destructor Documentation

## ◆ JsonData()

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

Construct a new JsonData.

Parameters

  value | The JsonValue to use, ownership is transferred.
  schema | The schema to validate this data against. Ownership is not transferred.

## Member Function Documentation

## ◆ Apply()

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

Apply a set of JSON patches to the value.

Parameters

  patch | The set of JsonPatch operations to apply.

Returns
  True if the patch set was successfully applied, false otherwise.

## ◆ SetValue()

bool ola::web::JsonData::SetValue | ( | JsonValue * | value | ) |

Set the value for this JsonData.

Parameters

  value | the new JsonValue. Ownership is transferred.

## ◆ Value()

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:

- include/ola/web/JsonData.h
- common/web/JsonData.cpp