storge container for a JSON object More...
#include <aurostd_xparser_json.h>
Public Member Functions | |
JSON::object & | operator[] (size_t index) const |
direct index access to JSON::object_types::LIST objects | |
JSON::object & | operator[] (const std::string &key) const |
direct key access to JSON::object_types::DICTIONARY objects | |
JSON::object & | operator[] (const char *key) const |
direct key access to JSON::object_types::DICTIONARY objects | |
JSON::object & | operator= (const char *content) |
assignment operator for char | |
JSON::object & | operator= (const std::string &content) |
assignment operator for string | |
JSON::object & | operator= (bool content) |
assignment operator for bool | |
JSON::object & | operator= (std::nullptr_t content) |
assignment operator for nullptr | |
JSON::object & | operator= (const List &content) |
assignment operator for JSON::List | |
JSON::object & | operator= (const Dictionary &content) |
assignment operator for JSON::Dictionary | |
template<class utype, enable_arithmetic< utype > = true> | |
JSON::object & | operator= (utype content) |
template<class utype> | |
JSON::object & | operator= (const xcomplex< utype > &content) |
template<class utype> | |
JSON::object & | operator= (const std::vector< utype > &content) |
template<class utype> | |
JSON::object & | operator= (const std::deque< utype > &content) |
template<class utype> | |
JSON::object & | operator= (const std::map< std::string, utype > &content) |
template<class utype> | |
JSON::object & | operator= (const xvector< utype > &content) |
template<class utype> | |
JSON::object & | operator= (const xmatrix< utype > &content) |
template<class utype> | |
JSON::object & | operator= (const JsonSerializable< utype > &content) |
template<class T, enable_list_like< T > = true> | |
JSON::object & | operator= (const T &content) |
template<class T, enable_dict_like< T > = true> | |
JSON::object & | operator= (const T &content) |
object ()=default | |
object (const char *content) | |
converting constructor: set the content of this JSON::object based on a char | |
object (const std::string &content) | |
converting constructor: set the content of this JSON::object based on a string | |
object (bool content) | |
converting constructor: set the content of this JSON::object based on a bool | |
object (std::nullptr_t content) | |
converting constructor: set the content of this JSON::object to null | |
object (object_types create_type) | |
create an empty JSON::object of a given JSON::object_types | |
object (const List &content) | |
object (const Dictionary &content) | |
template<typename utype, enable_arithmetic< utype > = true> | |
object (utype content) | |
template<typename utype> | |
object (const xcomplex< utype > &content) | |
template<typename utype> | |
object (const std::vector< utype > &content) | |
template<typename utype> | |
object (const std::deque< utype > &content) | |
template<typename utype> | |
object (const std::map< std::string, utype > &content) | |
template<typename utype> | |
object (const xvector< utype > &content) | |
template<typename utype> | |
object (const xmatrix< utype > &content) | |
template<typename T> | |
object (const JsonSerializable< T > &content) | |
template<typename T, enable_list_like< T > = true> | |
object (const T &content) | |
template<typename T, enable_dict_like< T > = true> | |
object (const T &content) | |
operator bool () const | |
conversion function for bool | |
operator std::string () const | |
conversion function for string | |
operator double () const | |
conversion function for double | |
operator long double () const | |
conversion function for float | |
operator float () const | |
conversion function for float | |
operator long long () const | |
conversion function for long long | |
operator long () const | |
conversion function for long | |
operator int () const | |
conversion function for int | |
operator char () const | |
conversion function for char | |
operator unsigned long long () const | |
conversion function for unsigned long long | |
operator unsigned long () const | |
conversion function for unsigned long | |
operator unsigned int () const | |
conversion function for int | |
operator List () const | |
operator Dictionary () const | |
template<class utype> | |
operator xcomplex< utype > () const | |
template<class utype> | |
operator std::vector< utype > () const | |
template<class utype> | |
operator std::deque< utype > () const | |
template<class utype> | |
operator std::set< utype > () const | |
template<class utype> | |
operator std::map< std::string, utype > () const | |
template<class utype> | |
operator aurostd::xvector< utype > () const | |
template<class utype> | |
operator aurostd::xmatrix< utype > () const | |
template<class T, enable_list_like< T > = true> | |
operator T () const | |
template<class T, enable_dict_like< T > = true> | |
operator T () const | |
template<class T, enable_serializable< T > = true> | |
operator T () const | |
void | push_back (const JSON::object &content) const |
allow to append to JSON::object_type::LIST | |
void | join (const JSON::object &content) const |
allow to merge two dictionaries or lists | |
size_t | size () const |
gives the size of JSON::object_tpe::LIST, JSON::object_tpe::DICTIONARY or JSON::object_tpe::STRING | |
bool | empty () const |
checks if JSON::object_tpe::LIST, JSON::object_tpe::DICTIONARY or JSON::object_tpe::STRING is empty | |
size_t | count (const std::string &) const |
count the occurrence of key string in a JSON::object_type::DICTIONARY | |
std::map< std::string, JSON::object >::iterator | find (const std::string &key) const |
returns an iterator to the result of find in JSON::object_type::DICTIONARY | |
template<class utype> | |
std::list< utype >::iterator | find_list (const utype &key) const |
std::map< std::string, JSON::object >::iterator | end () const |
returns an iterator to the end() of a JSON::object_type::DICTIONARY | |
std::map< std::string, JSON::object >::iterator | begin () const |
returns an iterator to the begin() of a JSON::object_type::DICTIONARY | |
std::vector< std::string > | keys () const |
returns a vector of all keys in a JSON::object_type::DICTIONARY | |
void | fromString (const std::string &content) |
change this JSON::object to a JSON::object_types::STRING | |
void | fromList (const List &content) |
change this JSON::object to a JSON::object_types::LIST | |
void | fromDictionary (const Dictionary &content) |
change this JSON::object to a JSON::object_types::DICTIONARY | |
template<class utype> | |
void | fromNumber (utype content) |
template<class utype> | |
void | fromComplex (const xcomplex< utype > &content) |
template<class utype> | |
void | fromVector (const std::vector< utype > &content) |
template<class utype> | |
void | fromDeque (const std::deque< utype > &content) |
template<class utype> | |
void | fromMap (const std::map< std::string, utype > &content) |
template<class utype> | |
void | fromXvector (const xvector< utype > &content) |
template<class utype> | |
void | fromXmatrix (const xmatrix< utype > &content) |
template<class T, enable_list_like< T > = true> | |
void | fromListLike (const T &content) |
template<class T, enable_dict_like< T > = true> | |
void | fromDictLike (const T &content) |
template<class T, enable_list_like< T > = true> | |
T | toListLike () const |
template<class T, enable_dict_like< T > = true> | |
T | toDictLike () const |
std::string | toString (bool json_format=true, bool escape_unicode=true) const |
converts a JSON::object into a string | |
void | saveFile (const std::string &file_path, compression_type ct=compression_type::None, bool escape_unicode=true) const |
save JSON::object to file | |
Public Attributes | |
object_types | type = object_types::NONE |
std::shared_ptr< void > | obj = nullptr |
storge container for a JSON object
Definition at line 51 of file aurostd_xparser_json.h.
|
default |
aurostd::JSON::object::object | ( | const char * | content | ) |
converting constructor: set the content of this JSON::object based on a char
Definition at line 208 of file aurostd_xparser_json.cpp.
aurostd::JSON::object::object | ( | const std::string & | content | ) |
converting constructor: set the content of this JSON::object based on a string
Definition at line 213 of file aurostd_xparser_json.cpp.
aurostd::JSON::object::object | ( | bool | content | ) |
converting constructor: set the content of this JSON::object based on a bool
Definition at line 218 of file aurostd_xparser_json.cpp.
aurostd::JSON::object::object | ( | std::nullptr_t | content | ) |
converting constructor: set the content of this JSON::object to null
Definition at line 228 of file aurostd_xparser_json.cpp.
aurostd::JSON::object::object | ( | object_types | create_type | ) |
create an empty JSON::object of a given JSON::object_types
Definition at line 236 of file aurostd_xparser_json.cpp.
aurostd::JSON::object::object | ( | const List & | content | ) |
aurostd::JSON::object::object | ( | const Dictionary & | content | ) |
aurostd::JSON::object::object | ( | utype | content | ) |
aurostd::JSON::object::object | ( | const xcomplex< utype > & | content | ) |
aurostd::JSON::object::object | ( | const std::vector< utype > & | content | ) |
aurostd::JSON::object::object | ( | const std::deque< utype > & | content | ) |
aurostd::JSON::object::object | ( | const std::map< std::string, utype > & | content | ) |
aurostd::JSON::object::object | ( | const xvector< utype > & | content | ) |
aurostd::JSON::object::object | ( | const xmatrix< utype > & | content | ) |
|
inline |
Definition at line 92 of file aurostd_xparser_json.h.
aurostd::JSON::object::object | ( | const T & | content | ) |
aurostd::JSON::object::object | ( | const T & | content | ) |
JSON::object & aurostd::JSON::object::operator[] | ( | size_t | index | ) | const |
direct index access to JSON::object_types::LIST objects
index | list index |
string content = json_obj[3];
Definition at line 56 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator[] | ( | const std::string & | key | ) | const |
direct key access to JSON::object_types::DICTIONARY objects
key | dictionary key |
Definition at line 74 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator[] | ( | const char * | key | ) | const |
direct key access to JSON::object_types::DICTIONARY objects
Definition at line 91 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator= | ( | const char * | content | ) |
assignment operator for char
Definition at line 281 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator= | ( | const std::string & | content | ) |
assignment operator for string
Definition at line 287 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator= | ( | bool | content | ) |
assignment operator for bool
Definition at line 293 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator= | ( | std::nullptr_t | content | ) |
assignment operator for nullptr
Definition at line 303 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator= | ( | const List & | content | ) |
assignment operator for JSON::List
Definition at line 310 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator= | ( | const Dictionary & | content | ) |
assignment operator for JSON::Dictionary
Definition at line 316 of file aurostd_xparser_json.cpp.
JSON::object & aurostd::JSON::object::operator= | ( | utype | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const xcomplex< utype > & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const std::vector< utype > & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const std::deque< utype > & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const std::map< std::string, utype > & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const xvector< utype > & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const xmatrix< utype > & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const JsonSerializable< utype > & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const T & | content | ) |
JSON::object & aurostd::JSON::object::operator= | ( | const T & | content | ) |
|
explicit |
conversion function for bool
Definition at line 324 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for string
Definition at line 474 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for double
Definition at line 384 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for float
Definition at line 404 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for float
Definition at line 409 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for long long
Definition at line 414 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for long
Definition at line 459 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for int
Definition at line 464 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for char
Definition at line 469 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for unsigned long long
Definition at line 439 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for unsigned long
Definition at line 449 of file aurostd_xparser_json.cpp.
|
explicit |
conversion function for int
Definition at line 454 of file aurostd_xparser_json.cpp.
aurostd::JSON::object::operator List | ( | ) | const |
aurostd::JSON::object::operator Dictionary | ( | ) | const |
aurostd::JSON::object::operator xcomplex< utype > | ( | ) | const |
aurostd::JSON::object::operator std::vector< utype > | ( | ) | const |
aurostd::JSON::object::operator std::deque< utype > | ( | ) | const |
aurostd::JSON::object::operator std::set< utype > | ( | ) | const |
aurostd::JSON::object::operator std::map< std::string, utype > | ( | ) | const |
aurostd::JSON::object::operator aurostd::xvector< utype > | ( | ) | const |
aurostd::JSON::object::operator aurostd::xmatrix< utype > | ( | ) | const |
|
explicit |
|
explicit |
|
explicit |
void aurostd::JSON::object::push_back | ( | const JSON::object & | content | ) | const |
allow to append to JSON::object_type::LIST
Definition at line 497 of file aurostd_xparser_json.cpp.
void aurostd::JSON::object::join | ( | const JSON::object & | content | ) | const |
allow to merge two dictionaries or lists
Definition at line 508 of file aurostd_xparser_json.cpp.
|
nodiscard |
gives the size of JSON::object_tpe::LIST, JSON::object_tpe::DICTIONARY or JSON::object_tpe::STRING
Definition at line 527 of file aurostd_xparser_json.cpp.
|
nodiscard |
checks if JSON::object_tpe::LIST, JSON::object_tpe::DICTIONARY or JSON::object_tpe::STRING is empty
Definition at line 548 of file aurostd_xparser_json.cpp.
|
nodiscard |
count the occurrence of key string in a JSON::object_type::DICTIONARY
Definition at line 556 of file aurostd_xparser_json.cpp.
|
nodiscard |
returns an iterator to the result of find in JSON::object_type::DICTIONARY
Definition at line 595 of file aurostd_xparser_json.cpp.
std::list< utype >::iterator aurostd::JSON::object::find_list | ( | const utype & | key | ) | const |
|
nodiscard |
returns an iterator to the end() of a JSON::object_type::DICTIONARY
Definition at line 569 of file aurostd_xparser_json.cpp.
|
nodiscard |
returns an iterator to the begin() of a JSON::object_type::DICTIONARY
Definition at line 582 of file aurostd_xparser_json.cpp.
|
nodiscard |
returns a vector of all keys in a JSON::object_type::DICTIONARY
Definition at line 608 of file aurostd_xparser_json.cpp.
void aurostd::JSON::object::fromString | ( | const std::string & | content | ) |
change this JSON::object to a JSON::object_types::STRING
Definition at line 180 of file aurostd_xparser_json.cpp.
void aurostd::JSON::object::fromList | ( | const List & | content | ) |
change this JSON::object to a JSON::object_types::LIST
Definition at line 190 of file aurostd_xparser_json.cpp.
void aurostd::JSON::object::fromDictionary | ( | const Dictionary & | content | ) |
change this JSON::object to a JSON::object_types::DICTIONARY
Definition at line 200 of file aurostd_xparser_json.cpp.
void aurostd::JSON::object::fromNumber | ( | utype | content | ) |
void aurostd::JSON::object::fromComplex | ( | const xcomplex< utype > & | content | ) |
void aurostd::JSON::object::fromVector | ( | const std::vector< utype > & | content | ) |
void aurostd::JSON::object::fromDeque | ( | const std::deque< utype > & | content | ) |
void aurostd::JSON::object::fromMap | ( | const std::map< std::string, utype > & | content | ) |
void aurostd::JSON::object::fromXvector | ( | const xvector< utype > & | content | ) |
void aurostd::JSON::object::fromXmatrix | ( | const xmatrix< utype > & | content | ) |
void aurostd::JSON::object::fromListLike | ( | const T & | content | ) |
void aurostd::JSON::object::fromDictLike | ( | const T & | content | ) |
T aurostd::JSON::object::toListLike | ( | ) | const |
T aurostd::JSON::object::toDictLike | ( | ) | const |
|
nodiscard |
converts a JSON::object into a string
json_format | if true add encapsulate strings in " (default: true ) |
escape_unicode | if true escape unicode in strings - αβγ becomes \u03b1\u03b2\u03b3 (default: true ) |
Definition at line 107 of file aurostd_xparser_json.cpp.
void aurostd::JSON::object::saveFile | ( | const std::string & | file_path, |
compression_type | ct = compression_type::None, | ||
bool | escape_unicode = true ) const |
save JSON::object to file
file_path | path to save to |
escape_unicode | if true escape unicode in strings - αβγ becomes \u03b1\u03b2\u03b3 (default: true ) |
ct | compression type |
Definition at line 173 of file aurostd_xparser_json.cpp.
object_types aurostd::JSON::object::type = object_types::NONE |
Definition at line 52 of file aurostd_xparser_json.h.
std::shared_ptr<void> aurostd::JSON::object::obj = nullptr |
Definition at line 53 of file aurostd_xparser_json.h.