Wt
4.11.1
|
A JSON object. More...
#include <Object.h>
Inherits std::map< K, T >.
Public Member Functions | |
Object () | |
Default constructor. | |
Object (const Object &other) | |
Copy constructor. | |
void | swap (Object &other) |
Swap operation. More... | |
Object & | operator= (const Object &other) |
Assignment operator. | |
Object (Object &&other) | |
Move constructor. | |
Object (std::initializer_list< std::pair< const std::string, Value > > list) | |
Initializer list constructor. | |
Object & | operator= (Object &&other) |
Move assignment operator. | |
std::set< std::string > | names () const |
Returns the key set. More... | |
bool | contains (const std::string &name) const |
Returns whether a member exists. More... | |
Type | type (const std::string &name) const |
Returns the type of a given member. More... | |
bool | isNull (const std::string &name) const |
Returns whether the value for a member is null (or not defined). More... | |
const Value & | get (const std::string &name) const |
Returns the value for a member (or null if not defined). More... | |
Static Public Attributes | |
static Object | Empty |
Empty object constant. | |
A JSON object.
This class represents a JSON object, which defines a value map. It is implemented as a std::map<std::string,Json::Value>
. It is therefore possible to use the std::map API to deal with it.
However, a number of additional methods have been added to more conveniently query the existence and the type of contained objects. A get() method can be used to return a member value, which returns Value::Null if the member is not defined.
bool Wt::Json::Object::contains | ( | const std::string & | name | ) | const |
Returns whether a member exists.
This returns whether the name
is in the names() set.
const Value & Wt::Json::Object::get | ( | const std::string & | name | ) | const |
Returns the value for a member (or null if not defined).
Returns the value associated with member name
or null if no value has been associated with this member name.
bool Wt::Json::Object::isNull | ( | const std::string & | name | ) | const |
Returns whether the value for a member is null (or not defined).
std::set< std::string > Wt::Json::Object::names | ( | ) | const |
Returns the key set.
This returns the member names: these are the members for which values have been associated in this object.
void Wt::Json::Object::swap | ( | Object & | other | ) |
Swap operation.
This swaps the contents of two objects.
Type Wt::Json::Object::type | ( | const std::string & | name | ) | const |
Returns the type of a given member.
This method returns the type of the value for members that are included, or returns Json::Type::Null for when no value is associated with name
.