#include <Json.hpp>
Classes | |
class | Data |
Public Member Functions | |
Json () | |
~Json ()=default | |
Json (bool in) | |
Json (int in) | |
Json (unsigned int in) | |
Json (double in) | |
Json (long in) | |
Json (unsigned long in) | |
Json (long long in) | |
Json (unsigned long long in) | |
Json (const char *in) | |
Json (const std::string &in) | |
Json (const std::vector< double > &in) | |
void | clear () |
bool | contains (const std::string &key) const |
bool | containsObject (const std::string &key) const |
bool | containsArray (const std::string &key) const |
bool | containsString (const std::string &key) const |
bool | containsNumber (const std::string &key) const |
bool | containsBool (const std::string &key) const |
Json & | operator[] (const std::string &key) |
const Json & | operator[] (const std::string &key) const |
size_t | size () const |
Json & | operator[] (size_t index) |
const Json & | operator[] (size_t index) const |
const std::map< std::string, Json > & | object () const |
const std::vector< Json > & | array () const |
const std::string & | string () const |
double | number () const |
uint32_t | uint32 () const |
uint64_t | uint64 () const |
bool | typeObject () const |
bool | typeArray () const |
bool | typeString () const |
bool | typeNumber () const |
bool | typeTrue () const |
bool | typeFalse () const |
bool | typeNull () const |
std::string | serialize (size_t indent=DEFAULT_INDENT) const |
void | deserialize (const std::string &in) |
void | deserialize (const char *in, size_t n) |
void | read (const std::string &fileName) |
void | write (const std::string &fileName, size_t indent=DEFAULT_INDENT) |
Static Public Attributes | |
static const size_t | DEFAULT_INDENT = 2 |
Private Types | |
enum | Type { TYPE_OBJECT , TYPE_ARRAY , TYPE_STRING , TYPE_NUMBER , TYPE_TRUE , TYPE_FALSE , TYPE_NULL } |
Private Member Functions | |
void | createObject () |
void | createArray () |
void | createArray (const std::vector< double > &in) |
void | createString (const std::string &in) |
void | createNumber (double in) |
void | createType (Type t) |
void | serialize (std::ostringstream &out) const |
void | serialize (std::ostringstream &out, const std::string &indent, const std::string &indentPlus) const |
void | deserialize (Json &obj, const char *in, size_t n, size_t &i) |
Private Attributes | |
Type | type_ |
Data | data_ |
Friends | |
void | fromJson (bool &out, const Json &in) |
void | fromJson (int &out, const Json &in) |
void | fromJson (unsigned int &out, const Json &in) |
void | fromJson (double &out, const Json &in) |
void | fromJson (long &out, const Json &in) |
void | fromJson (unsigned long &out, const Json &in) |
void | fromJson (long long &out, const Json &in) |
void | fromJson (unsigned long long &out, const Json &in) |
void | fromJson (std::string &out, const Json &in) |
void | toJson (Json &out, bool in) |
void | toJson (Json &out, int in) |
void | toJson (Json &out, unsigned int in) |
void | toJson (Json &out, double in) |
void | toJson (Json &out, long in) |
void | toJson (Json &out, unsigned long in) |
void | toJson (Json &out, long long in) |
void | toJson (Json &out, unsigned long long in) |
void | toJson (Json &out, const std::string &in) |
example deserialize:
example number:
example string:
example array:
|
private |
JSON Data Type.
Enumerator | |
---|---|
TYPE_OBJECT | |
TYPE_ARRAY | |
TYPE_STRING | |
TYPE_NUMBER | |
TYPE_TRUE | |
TYPE_FALSE | |
TYPE_NULL |
|
inline |
Referenced by operator[]().
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Json::clear | ( | ) |
|
inline |
Referenced by Editor::openProject().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Referenced by createArray(), deserialize(), Json(), and operator[]().
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
Referenced by deserialize(), and operator[]().
|
inlineprivate |
Referenced by deserialize(), Json(), and Json().
|
inlineprivate |
Referenced by deserialize(), Json(), and Json().
void Json::deserialize | ( | const char * | in, |
size_t | n ) |
void Json::deserialize | ( | const std::string & | in | ) |
Referenced by deserialize(), deserialize(), deserialize(), and read().
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Json::read | ( | const std::string & | fileName | ) |
Referenced by Editor::openProject().
std::string Json::serialize | ( | size_t | indent = DEFAULT_INDENT | ) | const |
Referenced by serialize(), and write().
|
private |
|
private |
|
inline |
|
inline |
|
inline |
Referenced by array(), operator[](), operator[](), and size().
|
inline |
|
inline |
|
inline |
Referenced by contains(), containsArray(), containsBool(), containsNumber(), containsObject(), containsString(), object(), Editor::openProject(), operator[](), and operator[]().
|
inline |
Referenced by string().
|
inline |
|
inline |
|
inline |
void Json::write | ( | const std::string & | fileName, |
size_t | indent = DEFAULT_INDENT ) |
Referenced by Points::exportToFile(), and Editor::saveProject().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
Referenced by array(), clear(), contains(), containsArray(), containsBool(), containsNumber(), containsObject(), containsString(), createArray(), createArray(), createNumber(), createObject(), createString(), number(), object(), operator[](), operator[](), operator[](), operator[](), serialize(), serialize(), size(), string(), uint32(), and uint64().
|
static |
|
private |
Referenced by clear(), createArray(), createNumber(), createObject(), createString(), createType(), serialize(), and serialize().