libzypp 17.31.23
zypp::json::Object Class Reference

JSON object. More...

#include <base/Json.h>

Public Member Functions

 Object ()
 
template<class Iterator >
 Object (Iterator begin, Iterator end)
 Construct from map-iterator.
 
 Object (const std::initializer_list< std::pair< String, Value > > &contents_r)
 Construct from map-initializer list { {k1,v1}, {k2,v2},... }.
 
void add (const String &key_r, const Value &val_r)
 Add key/value pair.
 
void add (const std::initializer_list< std::pair< String, Value > > &contents_r)
 
std::string asJSON () const
 JSON representation.
 
std::string asString () const
 String representation.
 
std::ostream & dumpOn (std::ostream &str) const
 Stream output.
 

Private Member Functions

std::ostream & dumpOn (std::ostream &str, std::map< std::string, std::string >::const_iterator val_r) const
 

Private Attributes

std::map< std::string, std::string > _data
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const Object &obj)
 Stream output.
 

Detailed Description

JSON object.

Definition at line 321 of file Json.h.

Constructor & Destructor Documentation

◆ Object() [1/3]

zypp::json::Object::Object ( )
inline

Definition at line 323 of file Json.h.

◆ Object() [2/3]

template<class Iterator >
zypp::json::Object::Object ( Iterator  begin,
Iterator  end 
)
inline

Construct from map-iterator.

Definition at line 327 of file Json.h.

◆ Object() [3/3]

zypp::json::Object::Object ( const std::initializer_list< std::pair< String, Value > > &  contents_r)
inline

Construct from map-initializer list { {k1,v1}, {k2,v2},... }.

Definition at line 331 of file Json.h.

Member Function Documentation

◆ add() [1/2]

void zypp::json::Object::add ( const String key_r,
const Value val_r 
)
inline

Add key/value pair.

Definition at line 336 of file Json.h.

◆ add() [2/2]

void zypp::json::Object::add ( const std::initializer_list< std::pair< String, Value > > &  contents_r)
inline

Definition at line 340 of file Json.h.

◆ asJSON()

std::string zypp::json::Object::asJSON ( ) const
inline

JSON representation.

Definition at line 344 of file Json.h.

◆ asString()

std::string zypp::json::Object::asString ( ) const
inline

String representation.

Definition at line 348 of file Json.h.

◆ dumpOn() [1/2]

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

Stream output.

Definition at line 352 of file Json.h.

◆ dumpOn() [2/2]

std::ostream & zypp::json::Object::dumpOn ( std::ostream &  str,
std::map< std::string, std::string >::const_iterator  val_r 
) const
inlineprivate

Definition at line 364 of file Json.h.

Friends And Related Function Documentation

◆ operator<<()

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

Stream output.

Definition at line 371 of file Json.h.

Member Data Documentation

◆ _data

std::map<std::string,std::string> zypp::json::Object::_data
private

Definition at line 367 of file Json.h.


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