Class representing the json object type. More...
#include <json_object.hpp>
Inherits oos::json_type.
Public Types | |
typedef std::map< json_string, json_value > | t_string_value_map |
typedef t_string_value_map::const_iterator | const_iterator |
typedef t_string_value_map::iterator | iterator |
typedef t_string_value_map::size_type | size_type |
Public Member Functions | |
json_object (const json_value &x) | |
json_object & | operator= (const json_value &x) |
virtual bool | parse (std::istream &in) |
virtual void | print (std::ostream &out) const |
void | clear () |
bool | empty () const |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
bool | contains (const std::string &key) |
void | insert (const json_string &key, const json_value &value) |
virtual json_value & | operator[] (const std::string &key) |
virtual size_t | size () const |
Public Member Functions inherited from oos::json_type | |
virtual json_value & | operator[] (size_t index) |
virtual const json_value & | operator[] (size_t index) const |
virtual void | push_back (const json_value &x) |
std::string | type () const |
Friends | |
OOS_API std::istream & | operator>> (std::istream &str, json_object &obj) |
Additional Inherited Members | |
Protected Member Functions inherited from oos::json_type | |
json_type (const std::string &name) | |
void | type (const std::string &type) |
Static Protected Attributes inherited from oos::json_type | |
static json_parser | parser |
Detailed Description
Class representing the json object type.
This class represents the json object type.
Member Typedef Documentation
typedef t_string_value_map::const_iterator oos::json_object::const_iterator |
Shortcut for the map const iterator
typedef t_string_value_map::iterator oos::json_object::iterator |
Shortcut for the map iterator
typedef t_string_value_map::size_type oos::json_object::size_type |
Shortcut for the map size type
typedef std::map<json_string, json_value> oos::json_object::t_string_value_map |
Shortcut for the string value map
Constructor & Destructor Documentation
oos::json_object::json_object | ( | const json_value & | x | ) |
Creates a new json_object and initializes the value with the given json_value.
- Parameters
-
x The json_value to set.
Member Function Documentation
iterator oos::json_object::begin | ( | ) |
Return the begin iterator of the children map.
- Returns
- The begin iterator.
const_iterator oos::json_object::begin | ( | ) | const |
Return the constant begin iterator of the children map.
- Returns
- The constant begin iterator.
void oos::json_object::clear | ( | ) |
Removes every children of the json_object.
bool oos::json_object::contains | ( | const std::string & | key | ) |
Returns true if the json_object contains a child element with the given key.
- Parameters
-
key The key to validate.
- Returns
- True if the key exists.
bool oos::json_object::empty | ( | ) | const |
Returns true if the json_object doesn't have a child element.
- Returns
- True if json_object is empty.
iterator oos::json_object::end | ( | ) |
Return the end iterator of the children map.
- Returns
- The end iterator.
const_iterator oos::json_object::end | ( | ) | const |
Return the constant end iterator of the children map.
- Returns
- The constant end iterator.
void oos::json_object::insert | ( | const json_string & | key, |
const json_value & | value | ||
) |
Inserts a json_value with a given key.
- Parameters
-
key The key of the json_value to insert. value The json_value to insert.
json_object& oos::json_object::operator= | ( | const json_value & | x | ) |
|
virtual |
Returns a json_value with the given key.
- Parameters
-
key The key of the json_value.
- Returns
- the corresponding json_value.
Reimplemented from oos::json_type.
|
virtual |
Parses in json input stream
- Parameters
-
in The json input stream
- Returns
- True if stream was parsed correctly
Implements oos::json_type.
|
virtual |
Prints the json type (tree) to a output stream.
- Parameters
-
out The stream to write on.
Implements oos::json_type.
|
inlinevirtual |
Returns the size of the json_object
- Returns
- The size of the json_object.
Reimplemented from oos::json_type.
Friends And Related Function Documentation
|
friend |
Input operator for a json_object.
- Parameters
-
str The input stream to read from. obj The json_object read in.
- Returns
- The modified input stream.
The documentation for this class was generated from the following file:
- json/json_object.hpp