libzypp  15.28.6
zypp::json::Value Class Reference

JSON representation of datatypes via toJSON. More...

#include <Json.h>

Inheritance diagram for zypp::json::Value:

Public Member Functions

 Value ()
 Default ctor (null) More...
 
 Value (const Value &rhs)
 Copy ctor. More...
 
template<class T >
 Value (const T &val_r)
 Ctor creating a JSON representation of T via toJSON(T) More...
 
const std::string & asJSON () const
 JSON representation. More...
 
const std::string & asString () const
 String representation. More...
 
std::ostream & dumpOn (std::ostream &str) const
 Stream output. More...
 

Private Attributes

std::string _data
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const Value &obj)
 

Detailed Description

JSON representation of datatypes via toJSON.

namespace mynamspace
{
struct Mydata
{...};
std::string toJSON( const Mydata & )
{ return json::Array{ "answer", 42 }.asJSON(); }
}
mynamspace::Mydata data;
json::Object bigone {
{ "mydata", data },
{ "panic", false },
{ "nested", json::Object{ {"one",1}, {"two",2}, {"three",3} } }
};
cout << bigone << endl;
See Also
http://www.json.org/

Definition at line 202 of file Json.h.

Constructor & Destructor Documentation

zypp::json::Value::Value ( )
inline

Default ctor (null)

Definition at line 205 of file Json.h.

zypp::json::Value::Value ( const Value rhs)
inline

Copy ctor.

Definition at line 208 of file Json.h.

template<class T >
zypp::json::Value::Value ( const T &  val_r)
inline

Ctor creating a JSON representation of T via toJSON(T)

Definition at line 212 of file Json.h.

Member Function Documentation

const std::string& zypp::json::Value::asJSON ( ) const
inline

JSON representation.

Definition at line 215 of file Json.h.

const std::string& zypp::json::Value::asString ( ) const
inline

String representation.

Definition at line 219 of file Json.h.

std::ostream& zypp::json::Value::dumpOn ( std::ostream &  str) const
inline

Stream output.

Definition at line 223 of file Json.h.

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  str,
const Value obj 
)
related

Stream output

Definition at line 231 of file Json.h.

Member Data Documentation

std::string zypp::json::Value::_data
private

Definition at line 227 of file Json.h.


The documentation for this class was generated from the following file: