JSON value class. More...

#include <JSONValue.h>

Collaboration diagram for Urho3D::JSONValue:
[legend]

Public Member Functions

 JSONValue ()
 Construct null value.
 
 JSONValue (JSONFile *file, rapidjson::Value *value)
 Construct with document and JSON value pointers.
 
 JSONValue (const JSONValue &rhs)
 Copy-construct from another value.
 
 ~JSONValue ()
 Destruct.
 
JSONValueoperator= (const JSONValue &rhs)
 Assignment operator.
 
bool IsNull () const
 Return whether does not refer to JSON value.
 
bool NotNull () const
 Return whether refers to JSON value.
 
 operator bool () const
 Return true if refers to JSON value.
 
JSONValue CreateChild (const String &name, JSONValueType valueType=JSON_OBJECT)
 Create a child value.
 
JSONValue GetChild (const String &name, JSONValueType valueType=JSON_ANY) const
 Return a child value by name. Return null if not exist.
 
void SetInt (const String &name, int value)
 Set int.
 
void SetBool (const String &name, bool value)
 Set bool.
 
void SetFloat (const String &name, float value)
 Set float.
 
void SetVector2 (const String &name, const Vector2 &value)
 Set vector2.
 
void SetVector3 (const String &name, const Vector3 &value)
 Set vector3.
 
void SetVector4 (const String &name, const Vector4 &value)
 Set vector4.
 
void SetVectorVariant (const String &name, const Variant &value)
 Set vector variant.
 
void SetQuaternion (const String &name, const Quaternion &value)
 Set quaternion.
 
void SetColor (const String &name, const Color &value)
 Set color.
 
void SetString (const String &name, const String &value)
 Set string.
 
void SetBuffer (const String &name, const void *data, unsigned size)
 Set buffer.
 
void SetBuffer (const String &name, const PODVector< unsigned char > &value)
 Set buffer.
 
void SetResourceRef (const String &name, const ResourceRef &value)
 Set resource ref.
 
void SetResourceRefList (const String &name, const ResourceRefList &value)
 Set resource ref list.
 
void SetIntRect (const String &name, const IntRect &value)
 Set int rect.
 
void SetIntVector2 (const String &name, const IntVector2 &value)
 Set int vector2.
 
void SetMatrix3 (const String &name, const Matrix3 &value)
 Set matrix3.
 
void SetMatrix3x4 (const String &name, const Matrix3x4 &value)
 Set matrix3x4.
 
void SetMatrix4 (const String &name, const Matrix4 &value)
 Set matrix4.
 
void SetVariant (const String &name, const Variant &value)
 Set variant (include type).
 
void SetVariantValue (const String &name, const Variant &value)
 Set variant value.
 
bool IsObject () const
 Is object type.
 
Vector< StringGetChildNames () const
 Return child names (only object and array child name).
 
Vector< StringGetValueNames () const
 Return member value names.
 
int GetInt (const String &name) const
 Return int.
 
bool GetBool (const String &name) const
 Return bool.
 
float GetFloat (const String &name) const
 Return float.
 
Vector2 GetVector2 (const String &name) const
 Return vector2.
 
Vector3 GetVector3 (const String &name) const
 Return vector3.
 
Vector4 GetVector4 (const String &name) const
 Return vector4.
 
Variant GetVectorVariant (const String &name) const
 Return vector variant.
 
Quaternion GetQuaternion (const String &name) const
 Return quaternion.
 
Color GetColor (const String &name) const
 Return color.
 
String GetString (const String &name) const
 Return string.
 
const char * GetCString (const String &name) const
 Return C string.
 
PODVector< unsigned char > GetBuffer (const String &name) const
 Return buffer.
 
bool GetBuffer (const String &name, void *dest, unsigned size) const
 Return buffer.
 
ResourceRef GetResourceRef (const String &name) const
 Return resource ref.
 
ResourceRefList GetResourceRefList (const String &name) const
 Return resource ref list.
 
IntRect GetIntRect (const String &name) const
 Return int rect.
 
IntVector2 GetIntVector2 (const String &name) const
 Return int vector2.
 
Matrix3 GetMatrix3 (const String &name) const
 Return matrix3.
 
Matrix3x4 GetMatrix3x4 (const String &name) const
 Return matrix3x4.
 
Matrix4 GetMatrix4 (const String &name) const
 Return matrix4.
 
Variant GetVariant (const String &name) const
 Return variant.
 
Variant GetVariantValue (const String &name, VariantType type) const
 Return variant value.
 
JSONValue CreateChild (JSONValueType valueType=JSON_OBJECT)
 Create a child value in array.
 
JSONValue GetChild (unsigned index, JSONValueType valueType=JSON_ANY) const
 Remove a child value in array. Return null if not exist.
 
void AddInt (int value)
 Add int.
 
void AddBool (bool value)
 Add bool.
 
void AddFloat (float value)
 Add float.
 
void AddVector2 (const Vector2 &value)
 Add vector2.
 
void AddVector3 (const Vector3 &value)
 Add vector3.
 
void AddVector4 (const Vector4 &value)
 Add vector4.
 
void AddVectorVariant (const Variant &value)
 Add vector variant.
 
void AddQuaternion (const Quaternion &value)
 Add quaternion.
 
void AddColor (const Color &value)
 Add color.
 
void AddString (const String &value)
 Add string.
 
void AddBuffer (const PODVector< unsigned char > &value)
 Add buffer.
 
void AddBuffer (const void *data, unsigned size)
 Add buffer.
 
void AddResourceRef (const ResourceRef &value)
 Add resource ref.
 
void AddResourceRefList (const ResourceRefList &value)
 Add resource ref list.
 
void AddIntRect (const IntRect &value)
 Add int rect.
 
void AddIntVector2 (const IntVector2 &value)
 Add int vector2.
 
void AddMatrix3 (const Matrix3 &value)
 Add matrix3.
 
void AddMatrix3x4 (const Matrix3x4 &value)
 Add matrix3x4.
 
void AddMatrix4 (const Matrix4 &value)
 Add matrix4.
 
void AddVariant (const Variant &value)
 Add variant.
 
void AddVariantValue (const Variant &value)
 Add variant value.
 
bool IsArray () const
 Is array type.
 
unsigned GetSize () const
 Return array size.
 
int GetInt (unsigned index) const
 Return int.
 
bool GetBool (unsigned index) const
 Return bool.
 
float GetFloat (unsigned index) const
 Return float.
 
Vector2 GetVector2 (unsigned index) const
 Return vector2.
 
Vector3 GetVector3 (unsigned index) const
 Return vector3.
 
Vector4 GetVector4 (unsigned index) const
 Return vector4.
 
Variant GetVectorVariant (unsigned index) const
 Return vector variant.
 
Quaternion GetQuaternion (unsigned index) const
 Return quaternion.
 
Color GetColor (unsigned index) const
 Return color.
 
String GetString (unsigned index) const
 Return string.
 
const char * GetCString (unsigned index) const
 Return C string.
 
PODVector< unsigned char > GetBuffer (unsigned index) const
 Return buffer.
 
bool GetBuffer (unsigned index, void *dest, unsigned size) const
 Return buffer.
 
ResourceRef GetResourceRef (unsigned index) const
 Return resource ref.
 
ResourceRefList GetResourceRefList (unsigned index) const
 Return resource ref list.
 
IntRect GetIntRect (unsigned index) const
 Return int rect.
 
IntVector2 GetIntVector2 (unsigned index) const
 Return int vector2.
 
Matrix3 GetMatrix3 (unsigned index) const
 Return matrix3.
 
Matrix3x4 GetMatrix3x4 (unsigned index) const
 Return matrix3x4.
 
Matrix4 GetMatrix4 (unsigned index) const
 Return matrix4.
 
Variant GetVariant (unsigned index) const
 Return variant.
 
Variant GetVariantValue (unsigned index, VariantType type) const
 Return variant.
 

Static Public Attributes

static const JSONValue EMPTY
 Empty JSONValue.
 

Private Member Functions

void AddMember (const String &name, rapidjson::Value &jsonValue)
 Set JSON value for object type.
 
rapidjson::ValueGetMember (const String &name) const
 Return JSON value by name for object type.
 
void AddMember (rapidjson::Value &jsonValue)
 Add JSON value to array type.
 
rapidjson::ValueGetMember (unsigned index) const
 Return JSON value by index for array type.
 

Private Attributes

WeakPtr< JSONFilefile_
 JSON file.
 
rapidjson::Valuevalue_
 Rapid JSON value.
 

Detailed Description

JSON value class.


The documentation for this class was generated from the following files:
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Resource/JSONValue.h
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Resource/JSONValue.cpp