103 int size ()
const {
return this->_value.size(); }
115 std::map<std::string, Value *> _value;
124 int length ()
const {
return static_cast<int>(this->_value.size()); }
132 std::vector<Value *> _value;
140 double value ()
const {
return this->_value; }
153 std::string
value ()
const {
return this->_value; }
166 bool value ()
const {
return this->_value; }
185 #endif // !_JSON_HXX_
object consisting of name-value pairs
Definition: json.hxx:22
Type _ty
Definition: json.hxx:86
std::ostream & operator<<(std::ostream &s, Value *v)
Definition: json.hxx:91
virtual std::string toString()=0
int length() const
Definition: json.hxx:124
bool isNumber() const
return true if this value is a number
Definition: json.hxx:55
Value * operator[](std::string key) const
bool isBool() const
return true if this value is a boolean
Definition: json.hxx:61
double value() const
Definition: json.hxx:140
JSON arrays.
Definition: json.hxx:119
booleans
Definition: json.hxx:26
void add(Value *v)
Definition: json.hxx:125
bool isString() const
return true if this value is a string
Definition: json.hxx:58
int size() const
return the number of fields in the object
Definition: json.hxx:103
bool isNull() const
return true if this value is the null value
Definition: json.hxx:64
Value * operator[](int idx) const
Definition: json.hxx:127
strings
Definition: json.hxx:25
void insert(std::string key, Value *val)
insert a key-value pair into the object
bool value() const
Definition: json.hxx:166
const String * asString() const
dynamic cast to JSON object
std::string value() const
Definition: json.hxx:153
arrays of JSON values
Definition: json.hxx:23
const Object * asObject() const
dynamic cast to JSON object
bool isArray() const
return true if this value is an array
Definition: json.hxx:52
const Array * asArray() const
dynamic cast to JSON object
bool isObject() const
return true if this value is an object
Definition: json.hxx:49
Type
the types of JSON values
Definition: json.hxx:21
Value * ParseFile(std::string filename)
const Number * asNumber() const
dynamic cast to JSON object
the null value
Definition: json.hxx:27
numbers (represented as doubles)
Definition: json.hxx:24
const Bool * asBool() const
dynamic cast to JSON object
Type type() const
return the type of this JSON value
Definition: json.hxx:46
Value(Type ty)
Definition: json.hxx:86
JSON objects.
Definition: json.hxx:97