Wt: Wt::Json::Object Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Attributes
Wt::Json::Object Class Reference
JSON Library (Wt::Json)

A JSON object. More...

Inherits std::map< K, T >.

List of all members.

## Public Member Functions
| Object ()
| Default constructor.
| Object (const Object &other)
| Copy constructor.
void | swap (Object &other)
| Swap operation.
Object & | operator= (const Object &other)
| Assignment operator.
std::set< std::string > | names () const
| Returns the key set.
bool | contains (const std::string &name) const
| Returns whether a member exists.
Type | type (const std::string &name) const
| Returns the type of a given member.
bool | isNull (const std::string &name) const
| Returns whether the value for a member is null (or not defined).
const Value & | get (const std::string &name) const
| Returns the value for a member (or null if not defined).
## 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`.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator