| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- $#include "JSONValue.h"
- enum JSONValueType
- {
- JSON_ANY = 0,
- JSON_OBJECT,
- JSON_ARRAY
- };
- class JSONValue
- {
- bool IsNull() const;
- bool NotNull() const;
- operator bool () const;
- JSONValue CreateChild(const String name, JSONValueType valueType = JSON_OBJECT);
- JSONValue GetChild(const String name, JSONValueType valueType = JSON_ANY) const;
- void SetInt(const String name, int value);
- void SetBool(const String name, bool value);
- void SetFloat(const String name, float value);
- void SetVector2(const String name, const Vector2& value);
- void SetVector3(const String name, const Vector3& value);
- void SetVector4(const String name, const Vector4& value);
- void SetVectorVariant(const String name, const Variant& value);
- void SetQuaternion(const String name, const Quaternion& value);
- void SetColor(const String name, const Color& value);
- void SetString(const String name, const String value);
- // void SetBuffer(const String name, const void* data, unsigned size);
- // void SetBuffer(const String name, const PODVector<unsigned char>& value);
- void SetResourceRef(const String name, const ResourceRef& value);
- void SetResourceRefList(const String name, const ResourceRefList& value);
- void SetIntRect(const String name, const IntRect& value);
- void SetIntVector2(const String name, const IntVector2& value);
- void SetMatrix3(const String name, const Matrix3& value);
- void SetMatrix3x4(const String name, const Matrix3x4& value);
- void SetMatrix4(const String name, const Matrix4& value);
- void SetVariant(const String name, const Variant& value);
- void SetVariantValue(const String name, const Variant& value);
- bool IsObject() const;
- Vector<String> GetChildNames() const;
- Vector<String> GetValueNames() const;
- int GetInt(const String name) const;
- bool GetBool(const String name) const;
- float GetFloat(const String name) const;
- Vector2 GetVector2(const String name) const;
- Vector3 GetVector3(const String name) const;
- Vector4 GetVector4(const String name) const;
- Variant GetVectorVariant(const String name) const;
- Quaternion GetQuaternion(const String name) const;
- Color GetColor(const String name) const;
- String GetString(const String name) const;
- const char* GetCString(const String name) const;
- // PODVector<unsigned char> GetBuffer(const String name) const;
- // bool GetBuffer(const String name, void* dest, unsigned size) const;
- ResourceRef GetResourceRef(const String name) const;
- ResourceRefList GetResourceRefList(const String name) const;
- IntRect GetIntRect(const String name) const;
- IntVector2 GetIntVector2(const String name) const;
- Matrix3 GetMatrix3(const String name) const;
- Matrix3x4 GetMatrix3x4(const String name) const;
- Matrix4 GetMatrix4(const String name) const;
- Variant GetVariant(const String name) const;
- Variant GetVariantValue(const String name, VariantType type) const;
- JSONValue CreateChild(JSONValueType valueType = JSON_OBJECT);
- JSONValue GetChild(unsigned index, JSONValueType valueType = JSON_ANY) const;
- void AddInt(int value);
- void AddBool(bool value);
- void AddFloat(float value);
- void AddVector2(const Vector2& value);
- void AddVector3(const Vector3& value);
- void AddVector4(const Vector4& value);
- void AddVectorVariant(const Variant& value);
- void AddQuaternion(const Quaternion& value);
- void AddColor(const Color& value);
- void AddString(const String value);
- // void AddBuffer(const PODVector<unsigned char>& value);
- // void AddBuffer(const void* data, unsigned size);
- void AddResourceRef(const ResourceRef& value);
- void AddResourceRefList(const ResourceRefList& value);
- void AddIntRect(const IntRect& value);
- void AddIntVector2(const IntVector2& value);
- void AddMatrix3(const Matrix3& value);
- void AddMatrix3x4(const Matrix3x4& value);
- void AddMatrix4(const Matrix4& value);
- void AddVariant(const Variant& value);
- void AddVariantValue(const Variant& value);
- bool IsArray() const;
- unsigned GetSize() const;
- int GetInt(unsigned index) const;
- bool GetBool(unsigned index) const;
- float GetFloat(unsigned index) const;
- Vector2 GetVector2(unsigned index) const;
- Vector3 GetVector3(unsigned index) const;
- Vector4 GetVector4(unsigned index) const;
- Variant GetVectorVariant(unsigned index) const;
- Quaternion GetQuaternion(unsigned index) const;
- Color GetColor(unsigned index) const;
- String GetString(unsigned index) const;
- const char* GetCString(unsigned index) const;
- // PODVector<unsigned char> GetBuffer(unsigned index) const;
- // bool GetBuffer(unsigned index, void* dest, unsigned size) const;
- ResourceRef GetResourceRef(unsigned index) const;
- ResourceRefList GetResourceRefList(unsigned index) const;
- IntRect GetIntRect(unsigned index) const;
- IntVector2 GetIntVector2(unsigned index) const;
- Matrix3 GetMatrix3(unsigned index) const;
- Matrix3x4 GetMatrix3x4(unsigned index) const;
- Matrix4 GetMatrix4(unsigned index) const;
- Variant GetVariant(unsigned index) const;
- Variant GetVariantValue(unsigned index, VariantType type) const;
- static const JSONValue EMPTY;
- tolua_readonly tolua_property__is_set bool null;
- tolua_readonly tolua_property__is_set bool object;
- tolua_readonly tolua_property__is_set bool array;
- };
|