JSON

class JSON

Public Types

enum Type

Values:

enumerator NULL_VALUE
enumerator INT
enumerator FLOAT
enumerator BOOLEAN
enumerator STRING
enumerator ARRAY
enumerator OBJECT

Public Functions

JSON()
JSON(Type type)
JSON(const int n)
JSON(const double x)
JSON(const bool b)
JSON(const std::string &s)
JSON(const std::vector<JSON*> &a)
JSON(const std::map<std::string, JSON*> &o)
JSON(const JSON &other)
JSON(const JSON *other)
~JSON()
inline Type type() const
inline int getInt() const
inline int &getInt()
inline double getFloat() const
inline double &getFloat()
inline bool getBool() const
inline bool &getBool()
inline const std::string &getString() const
inline std::string &getString()
inline std::vector<JSON*> &getArray()
inline const std::vector<JSON*> &getArray() const
inline JSON *get(const int index)
inline const std::map<std::string, JSON*> &getObject() const
inline std::map<std::string, JSON*> &getObject()
inline JSON *get(const std::string &key)
std::string toString() const

Convert the JSON object to a string.

void fromString(const std::string &s)

Parse a JSON string.

Public Members

int m_int
double m_float
bool m_bool
std::string m_string
std::vector<JSON*> m_array
std::map<std::string, JSON*> m_object

Public Static Functions

static JSON *createOfType(Type)

Returns an empty JSON object of a given type.

Private Functions

void addToString(std::string &s) const
int fromString(const std::string &s, int i)
int skipWhitespaces(const std::string &s, int i) const
std::pair<std::string, int> readString(const std::string &s, int i) const

Private Members

Type m_type
union JSON::[anonymous] [anonymous]