rippled
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Json::Object::Root Class Reference
Inheritance diagram for Json::Object::Root:
Inheritance graph
[legend]
Collaboration diagram for Json::Object::Root:
Collaboration graph
[legend]

Public Member Functions

 Root (Writer &)
 Each Object::Root must be constructed with its own unique Writer. More...
 
template<typename Scalar >
void set (std::string const &key, Scalar const &)
 Set a scalar value in the Object for a key. More...
 
void set (std::string const &key, Json::Value const &)
 
Proxy operator[] (std::string const &key)
 
Proxy operator[] (Json::StaticString const &key)
 
Object setObject (std::string const &key)
 Make a new Object at a key and return it. More...
 
Array setArray (std::string const &key)
 Make a new Array at a key and return it. More...
 

Protected Member Functions

void checkWritable (std::string const &label)
 

Protected Attributes

Collectionparent_
 
Writerwriter_
 
bool enabled_
 

Detailed Description

Definition at line 235 of file Object.h.

Constructor & Destructor Documentation

◆ Root()

Each Object::Root must be constructed with its own unique Writer.

Definition at line 75 of file Object.cpp.

Member Function Documentation

◆ set() [1/2]

template<typename Scalar >
void Json::Object::set ( std::string const &  key,
Scalar const &  value 
)
inherited

Set a scalar value in the Object for a key.

A JSON scalar is a single value - a number, string, boolean, nullptr or a Json::Value.

set() throws an exception if this object is disabled (which means that one of its children is enabled).

In a debug build, set() also throws an exception if the key has already been set() before.

An operator[] is provided to allow writing object["key"] = scalar;.

Definition at line 406 of file Object.h.

◆ set() [2/2]

void Json::Object::set ( std::string const &  key,
Json::Value const &  v 
)
inherited

Definition at line 175 of file Object.cpp.

◆ operator[]() [1/2]

Object::Proxy Json::Object::operator[] ( std::string const &  key)
inherited

Definition at line 126 of file Object.cpp.

◆ operator[]() [2/2]

Object::Proxy Json::Object::operator[] ( Json::StaticString const &  key)
inherited

Definition at line 132 of file Object.cpp.

◆ setObject()

Object Json::Object::setObject ( std::string const &  key)
inherited

Make a new Object at a key and return it.

This Object is disabled until that sub-object is destroyed. Throws an exception if this Object was already disabled.

Definition at line 81 of file Object.cpp.

◆ setArray()

Array Json::Object::setArray ( std::string const &  key)
inherited

Make a new Array at a key and return it.

This Object is disabled until that sub-array is destroyed. Throws an exception if this Object was already disabled.

Definition at line 90 of file Object.cpp.

◆ checkWritable()

void Json::Collection::checkWritable ( std::string const &  label)
protectedinherited

Definition at line 65 of file Object.cpp.

Member Data Documentation

◆ parent_

Collection* Json::Collection::parent_
protectedinherited

Definition at line 168 of file Object.h.

◆ writer_

Writer* Json::Collection::writer_
protectedinherited

Definition at line 169 of file Object.h.

◆ enabled_

bool Json::Collection::enabled_
protectedinherited

Definition at line 170 of file Object.h.