Wt  3.3.8
Public Member Functions | Static Public Attributes | List of all members
Wt::Json::Object Class Reference

A JSON object. More...

Inherits std::map< K, T >.

Public Member Functions

 Object ()
 Default constructor.
 
 Object (const Object &other)
 Copy constructor.
 
void swap (Object &other)
 Swap operation. More...
 
Objectoperator= (const Object &other)
 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 Valueget (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.
 

Detailed Description

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.

Member Function Documentation

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).

See also
get(), Value::isNull()
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.

Note
This may include members with explicit Value::Null values.
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::NullType for when no value is associated with name.


Generated on Mon Sep 4 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11