LIPH's C++ Codes
liph::json Class Reference

#include <json.h>

Public Types

enum  value_type {
  object , array , string , number ,
  boolean , null
}
 

Public Member Functions

 json (value_type type=null)
 
 json (bool b)
 
 json (double d)
 
 json (int32_t n)
 
 json (int64_t n)
 
 json (std::string str)
 
 json (const char *str)
 
 json (const std::vector< json > &arr)
 
 json (const std::unordered_map< std::string, json > &obj)
 
 json (const json &other)
 
 json (json &&other)
 
jsonoperator= (const json &other)
 
jsonoperator= (json &&other)
 
 ~json ()
 
value_type type () const
 
void clear ()
 
void reset ()
 
std::string to_string (int indent=0, bool sort_keys=false) const
 
bool operator== (const json &other) const
 
bool operator!= (const json &other) const
 
jsonat (const std::string &key)
 
const jsonat (const std::string &key) const
 
jsonoperator[] (const std::string &key)
 
const jsonoperator[] (const std::string &key) const
 
jsonat (std::size_t pos)
 
const jsonat (std::size_t pos) const
 
jsonoperator[] (std::size_t pos)
 
const jsonoperator[] (std::size_t pos) const
 
bool & bool_ref ()
 
bool bool_ref () const
 
double & double_ref ()
 
double double_ref () const
 
int64_t & i64_ref ()
 
int64_t i64_ref () const
 
std::string & string_ref ()
 
const std::string & string_ref () const
 
std::vector< json > & array_ref ()
 
const std::vector< json > & array_ref () const
 
std::unordered_map< std::string, json > & object_ref ()
 
const std::unordered_map< std::string, json > & object_ref () const
 
bool is_null () const
 
bool is_boolean () const
 
bool is_number () const
 
bool is_string () const
 
bool is_array () const
 
bool is_object () const
 

Static Public Member Functions

static json parse (const std::string &str)
 
static json load (const std::filesystem::path &path)
 

Member Enumeration Documentation

◆ value_type

Enumerator
object 
array 
string 
number 
boolean 
null 

Constructor & Destructor Documentation

◆ json() [1/11]

liph::json::json ( value_type  type = null)

◆ json() [2/11]

liph::json::json ( bool  b)

◆ json() [3/11]

liph::json::json ( double  d)

◆ json() [4/11]

liph::json::json ( int32_t  n)

◆ json() [5/11]

liph::json::json ( int64_t  n)

◆ json() [6/11]

liph::json::json ( std::string  str)

◆ json() [7/11]

liph::json::json ( const char *  str)

◆ json() [8/11]

liph::json::json ( const std::vector< json > &  arr)

◆ json() [9/11]

liph::json::json ( const std::unordered_map< std::string, json > &  obj)

◆ json() [10/11]

liph::json::json ( const json other)

◆ json() [11/11]

liph::json::json ( json &&  other)

◆ ~json()

liph::json::~json ( )

Member Function Documentation

◆ array_ref() [1/2]

std::vector< json > & liph::json::array_ref ( )

◆ array_ref() [2/2]

const std::vector< json > & liph::json::array_ref ( ) const

◆ at() [1/4]

json & liph::json::at ( const std::string &  key)

◆ at() [2/4]

const json & liph::json::at ( const std::string &  key) const

◆ at() [3/4]

json & liph::json::at ( std::size_t  pos)

◆ at() [4/4]

const json & liph::json::at ( std::size_t  pos) const

◆ bool_ref() [1/2]

bool & liph::json::bool_ref ( )

◆ bool_ref() [2/2]

bool liph::json::bool_ref ( ) const

◆ clear()

void liph::json::clear ( )

◆ double_ref() [1/2]

double & liph::json::double_ref ( )

◆ double_ref() [2/2]

double liph::json::double_ref ( ) const

◆ i64_ref() [1/2]

int64_t & liph::json::i64_ref ( )

◆ i64_ref() [2/2]

int64_t liph::json::i64_ref ( ) const

◆ is_array()

bool liph::json::is_array ( ) const

◆ is_boolean()

bool liph::json::is_boolean ( ) const

◆ is_null()

bool liph::json::is_null ( ) const

◆ is_number()

bool liph::json::is_number ( ) const

◆ is_object()

bool liph::json::is_object ( ) const

◆ is_string()

bool liph::json::is_string ( ) const

◆ load()

json liph::json::load ( const std::filesystem::path &  path)
static

◆ object_ref() [1/2]

std::unordered_map< std::string, json > & liph::json::object_ref ( )

◆ object_ref() [2/2]

const std::unordered_map< std::string, json > & liph::json::object_ref ( ) const

◆ operator!=()

bool liph::json::operator!= ( const json other) const

◆ operator=() [1/2]

json & liph::json::operator= ( const json other)

◆ operator=() [2/2]

json & liph::json::operator= ( json &&  other)

◆ operator==()

bool liph::json::operator== ( const json other) const

◆ operator[]() [1/4]

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

◆ operator[]() [2/4]

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

◆ operator[]() [3/4]

json & liph::json::operator[] ( std::size_t  pos)

◆ operator[]() [4/4]

const json & liph::json::operator[] ( std::size_t  pos) const

◆ parse()

json liph::json::parse ( const std::string &  str)
static

◆ reset()

void liph::json::reset ( )

◆ string_ref() [1/2]

std::string & liph::json::string_ref ( )

◆ string_ref() [2/2]

const std::string & liph::json::string_ref ( ) const

◆ to_string()

std::string liph::json::to_string ( int  indent = 0,
bool  sort_keys = false 
) const

◆ type()

json::value_type liph::json::type ( ) const

Member Data Documentation

◆ array_

std::vector<json>* liph::json::array_

◆ bool_

bool liph::json::bool_

◆ double_

double liph::json::double_

◆ i64_

int64_t liph::json::i64_

◆ object_

std::unordered_map<std::string, json>* liph::json::object_

◆ string_

std::string* liph::json::string_

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