Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
Framework::json Class Reference

#include <json.h>

+ Collaboration diagram for Framework::json:

Public Member Functions

 json ()
 
 json (const json &)
 
 json (json &&) noexcept
 
jsonoperator= (const json &)
 
jsonoperator= (json &&) noexcept
 
 json (bool b)
 
 json (int i)
 
 json (double d)
 
 json (const char *s)
 
 json (const std::string &s)
 
 ~json ()
 
std::string dump (int indent=-1) const
 
json operator[] (const std::string &key) const
 
jsonoperator[] (const std::string &key)
 
size_t size () const
 
bool empty () const
 
bool is_null () const
 
bool is_object () const
 
bool is_array () const
 
bool is_string () const
 
bool is_boolean () const
 
bool is_number () const
 
template<typename T >
get () const
 
template<typename T >
void get_to (T &out) const
 
template<typename T >
value (const std::string &key, const T &default_val) const
 
void push_back (const json &value)
 
auto begin () const -> nlohmann::json::const_iterator
 
auto end () const -> nlohmann::json::const_iterator
 
nlohmann::json & raw ()
 
const nlohmann::json & raw () const
 
 json (std::initializer_list< std::pair< std::string, json > > init)
 
jsonoperator= (std::initializer_list< std::pair< std::string, json > > init)
 

Static Public Member Functions

static json object ()
 
static json array ()
 

Private Member Functions

 json (std::shared_ptr< IJsonImpl > impl)
 

Private Attributes

std::shared_ptr< IJsonImplimpl
 

Friends

class NlohmannJsonImpl
 

Detailed Description

Definition at line 11 of file json.h.

Constructor & Destructor Documentation

◆ json() [1/10]

Framework::json::json ( )

◆ json() [2/10]

Framework::json::json ( const json )

◆ json() [3/10]

Framework::json::json ( json &&  )
noexcept

◆ json() [4/10]

Framework::json::json ( bool  b)

◆ json() [5/10]

Framework::json::json ( int  i)

◆ json() [6/10]

Framework::json::json ( double  d)

◆ json() [7/10]

Framework::json::json ( const char *  s)

◆ json() [8/10]

Framework::json::json ( const std::string &  s)

◆ ~json()

Framework::json::~json ( )

◆ json() [9/10]

Framework::json::json ( std::initializer_list< std::pair< std::string, json > >  init)

◆ json() [10/10]

Framework::json::json ( std::shared_ptr< IJsonImpl impl)
explicitprivate

Member Function Documentation

◆ array()

static json Framework::json::array ( )
static

◆ begin()

auto Framework::json::begin ( ) const -> nlohmann::json::const_iterator

◆ dump()

std::string Framework::json::dump ( int  indent = -1) const

◆ empty()

bool Framework::json::empty ( ) const

◆ end()

auto Framework::json::end ( ) const -> nlohmann::json::const_iterator

◆ get()

template<typename T >
T Framework::json::get ( ) const
inline

Definition at line 50 of file json.h.

50 {
51 auto* backend = static_cast<NlohmannJsonImpl*>(impl.get());
52 return backend->raw().get<T>();
53 }
friend class NlohmannJsonImpl
Definition json.h:85
std::shared_ptr< IJsonImpl > impl
Definition json.h:83

References impl, and Framework::NlohmannJsonImpl::raw().

+ Here is the call graph for this function:

◆ get_to()

template<typename T >
void Framework::json::get_to ( T &  out) const
inline

Definition at line 56 of file json.h.

56 {
57 auto* backend = static_cast<NlohmannJsonImpl*>(impl.get());
58 backend->raw().get_to(out);
59 }

References impl, and Framework::NlohmannJsonImpl::raw().

+ Here is the call graph for this function:

◆ is_array()

bool Framework::json::is_array ( ) const

◆ is_boolean()

bool Framework::json::is_boolean ( ) const

◆ is_null()

bool Framework::json::is_null ( ) const

◆ is_number()

bool Framework::json::is_number ( ) const

◆ is_object()

bool Framework::json::is_object ( ) const

◆ is_string()

bool Framework::json::is_string ( ) const

◆ object()

static json Framework::json::object ( )
static

◆ operator=() [1/3]

json & Framework::json::operator= ( const json )

◆ operator=() [2/3]

json & Framework::json::operator= ( json &&  )
noexcept

◆ operator=() [3/3]

json & Framework::json::operator= ( std::initializer_list< std::pair< std::string, json > >  init)

◆ operator[]() [1/2]

json & Framework::json::operator[] ( const std::string &  key)

◆ operator[]() [2/2]

json Framework::json::operator[] ( const std::string &  key) const

◆ push_back()

void Framework::json::push_back ( const json value)

◆ raw() [1/2]

nlohmann::json & Framework::json::raw ( )

◆ raw() [2/2]

const nlohmann::json & Framework::json::raw ( ) const

◆ size()

size_t Framework::json::size ( ) const

◆ value()

template<typename T >
T Framework::json::value ( const std::string &  key,
const T &  default_val 
) const
inline

Definition at line 62 of file json.h.

62 {
63 auto* backend = static_cast<NlohmannJsonImpl*>(impl.get());
64 return backend->raw().value(key, default_val);
65 }

References impl, and Framework::NlohmannJsonImpl::raw().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ NlohmannJsonImpl

friend class NlohmannJsonImpl
friend

Definition at line 85 of file json.h.

Member Data Documentation

◆ impl

std::shared_ptr<IJsonImpl> Framework::json::impl
private

Definition at line 83 of file json.h.

Referenced by get(), get_to(), and value().


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