#include <value.h>
Inheritance diagram for Value:

Public Types | |
| enum | ValueType { string, number, object, array, boolean, null } |
| Types of JSON values. More... | |
Public Member Functions | |
| virtual | ~Value () |
| Destructor is declared virtual, as it always should be. | |
| virtual ValueType | GetType () const=0 |
| Return this instance's type. | |
| virtual Value & | operator[] (unsigned int i) |
| Gets the subelement at the specified index. | |
| virtual Value & | operator[] (const Ustr &s) |
| Gets the subelement at the specified index. | |
| virtual Value & | operator[] (const std::string &s) |
| Gets the subelement at the specified index. | |
| virtual std::string | AsString () const |
| Gets the value as a string. | |
| virtual Ustr | AsUstr () const |
| Gets the value as a string. | |
| virtual long | AsInt () const |
| Gets the value as an int. | |
| virtual double | AsFloat () const |
| Gets the value as a float. | |
| virtual bool | AsBool () const |
| Gets the value as a bool. | |
| virtual bool | IsNull () const |
| Check if this value is null. | |
| virtual unsigned int | Size () const |
| Returns the number of sub values this value contains. | |
| virtual bool | Has (unsigned int i) const |
| Check if this value contains the specified sub value. | |
| virtual bool | Has (const Ustr s) const |
| Check if this value contains the specified sub value. | |
| virtual bool | Has (const std::string s) const |
| Check if this value contains the specified sub value. | |
Values as defined by JSON can be objects, arrays, strings, numbers, the boolean values true and false, or null. This is a base class that can represent any one of those types. To get useful information out of it you need to know its actual type. Often you will know what types of information to expect given the source of the JSON message. If you don't, you can check a Value's type with the GetType() method, which returns the type of the underlying Value as an enum.
Once you know the Value's type, you can get its data with the appropriate AsX() method, or access its members with the indexor operator.
This type is returned from the ParseJSON() function.
| enum Value::ValueType |
Types of JSON values.
| virtual Value::~Value | ( | ) | [inline, virtual] |
Destructor is declared virtual, as it always should be.
| virtual ValueType Value::GetType | ( | ) | const [pure virtual] |
Return this instance's type.
Implemented in StringValue, IntValue, FloatValue, BoolValue, NullValue, ObjectValue, and ArrayValue.
| virtual Value& Value::operator[] | ( | unsigned int | i | ) | [inline, virtual] |
| virtual Value& Value::operator[] | ( | const std::string & | s | ) | [inline, virtual] |
Gets the subelement at the specified index.
| virtual std::string Value::AsString | ( | ) | const [inline, virtual] |
| virtual Ustr Value::AsUstr | ( | ) | const [inline, virtual] |
| virtual long Value::AsInt | ( | ) | const [inline, virtual] |
| virtual double Value::AsFloat | ( | ) | const [inline, virtual] |
| virtual bool Value::AsBool | ( | ) | const [inline, virtual] |
| virtual bool Value::IsNull | ( | ) | const [inline, virtual] |
| virtual unsigned int Value::Size | ( | ) | const [inline, virtual] |
| virtual bool Value::Has | ( | unsigned int | i | ) | const [inline, virtual] |
| virtual bool Value::Has | ( | const Ustr | s | ) | const [inline, virtual] |
| virtual bool Value::Has | ( | const std::string | s | ) | const [inline, virtual] |
Check if this value contains the specified sub value.
1.5.2