Class representing the json array type. More...
#include <json_array.hpp>
Inherits oos::json_type.
Public Types | |
typedef std::vector< json_value > | t_value_vector |
typedef t_value_vector::const_iterator | const_iterator |
typedef t_value_vector::iterator | iterator |
typedef t_value_vector::size_type | size_type |
Public Member Functions | |
json_array (size_t size) | |
json_array (const json_value &x) | |
json_array & | operator= (const json_value &x) |
virtual bool | parse (std::istream &in) |
virtual void | print (std::ostream &out) const |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
bool | empty () const |
virtual json_value & | operator[] (size_t index) |
virtual const json_value & | operator[] (size_t index) const |
virtual void | push_back (const json_value &x) |
virtual size_t | size () const |
Public Member Functions inherited from oos::json_type | |
virtual json_value & | operator[] (const std::string &key) |
std::string | type () const |
Friends | |
OOS_API std::istream & | operator>> (std::istream &str, json_array &ary) |
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 array type.
This class represents the json array type.
Member Typedef Documentation
typedef t_value_vector::const_iterator oos::json_array::const_iterator |
Shortcut for value vector iterator.
typedef t_value_vector::iterator oos::json_array::iterator |
Shortcut for value vector const iterator.
typedef t_value_vector::size_type oos::json_array::size_type |
Shortcut for value vector size type.
typedef std::vector<json_value> oos::json_array::t_value_vector |
Shortcut for value vector.
Constructor & Destructor Documentation
|
explicit |
Create a new json_array with a predefined size.
- Parameters
-
size The size of the array.
oos::json_array::json_array | ( | const json_value & | x | ) |
Creates a new json_array and initializes the value with the given json_value.
- Parameters
-
x The json_value to set.
Member Function Documentation
iterator oos::json_array::begin | ( | ) |
Return the begin iterator
- Returns
- The begin iterator.
const_iterator oos::json_array::begin | ( | ) | const |
Return the constant begin iterator
- Returns
- The constant begin iterator.
bool oos::json_array::empty | ( | ) | const |
Returns true on empty array.
- Returns
- True on empty array.
iterator oos::json_array::end | ( | ) |
Return the end iterator
- Returns
- The end iterator.
const_iterator oos::json_array::end | ( | ) | const |
Return the constant end iterator
- Returns
- The constant end iterator.
json_array& oos::json_array::operator= | ( | const json_value & | x | ) |
|
inlinevirtual |
Returns a json_value at the given index.
- Parameters
-
index The index of the json_value.
- Returns
- the corresponding json_value.
Reimplemented from oos::json_type.
|
inlinevirtual |
Returns a json_value at the given index.
- Parameters
-
index The index 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 |
Adds a json_value to the current value.
- Parameters
-
x The json_value to add.
Reimplemented from oos::json_type.
|
inlinevirtual |
Returns the size of the json_value. If the concrete type doesn't support this method an exception is thrown.
- Returns
- The size of the json_value.
Reimplemented from oos::json_type.
Friends And Related Function Documentation
|
friend |
Input operator for a json_array.
- Parameters
-
str The input stream to read from. ary The json_array read in.
- Returns
- The modified input stream.
The documentation for this class was generated from the following file:
- json/json_array.hpp