Browse Source

Added AngelScript & Lua property accessors for the XMLElement's value.
Added setters for Lua XMLElement.
Updated scripting documentation.

Lasse Öörni 12 years ago
parent
commit
cb45be26ef

+ 6 - 1
Docs/AngelScriptAPI.h

@@ -1570,6 +1570,7 @@ XMLElement SelectSingle(const String&);
 XMLElement SelectSinglePrepared(const XPathQuery&);
 XPathResultSet Select(const String&);
 XPathResultSet SelectPrepared(const XPathQuery&);
+bool SetValue(const String&);
 bool SetAttribute(const String&, const String&);
 bool SetAttribute(const String&);
 bool SetBool(const String&, bool);
@@ -1589,6 +1590,7 @@ bool SetVector3(const String&, const Vector3&);
 bool SetVector4(const String&, const Vector4&);
 bool SetVectorVariant(const String&, const Variant&);
 bool HasAttribute(const String&) const;
+String GetValue() const;
 String GetAttribute(const String& = String ( )) const;
 String GetAttributeLower(const String&) const;
 String GetAttributeUpper(const String&) const;
@@ -1614,6 +1616,7 @@ Vector4 GetVector4(const String&) const;
 Variant GetVectorVariant(const String&) const;
 
 // Properties:
+String value;
 /* (readonly) */
 String name;
 /* (readonly) */
@@ -4042,6 +4045,8 @@ String typeName;
 /* (readonly) */
 String category;
 String windowTitle;
+/* (writeonly) */
+Image windowIcon;
 IntVector2 windowPosition;
 bool sRGB;
 bool flushGPU;
@@ -8312,7 +8317,7 @@ float Atan(float);
 float Atan2(float, float);
 float Abs(float);
 float Sqrt(float);
-float Pow(float);
+float Pow(float, float);
 float Min(float, float);
 int Min(int, int);
 float Max(float, float);

+ 29 - 0
Docs/LuaScriptAPI.dox

@@ -929,6 +929,7 @@ Properties:
 Methods:
 
 - void SetWindowTitle(const String windowTitle)
+- void SetWindowIcon(Image* windowIcon)
 - void SetWindowPosition(const IntVector2& position)
 - void SetWindowPosition(int x, int y)
 - bool SetMode(int width, int height, bool fullscreen, bool resizable, bool vsync, bool tripleBuffer, int multiSample)
@@ -3576,6 +3577,32 @@ Properties:
 
 Methods:
 
+- XMLElement CreateChild(const String name)
+- bool RemoveChild(const XMLElement& element)
+- bool RemoveChild(const String name)
+- bool RemoveChildren(const String name = String::EMPTY)
+- bool RemoveAttribute(const String name = String::EMPTY)
+- bool SetValue(const String value)
+- bool SetAttribute(const String name, const String value)
+- bool SetBool(const String name, bool value)
+- bool SetBoundingBox(const BoundingBox& value)
+- bool SetColor(const String name, const Color& value)
+- bool SetFloat(const String name, float value)
+- bool SetUInt(const String name, unsigned value)
+- bool SetInt(const String name, int value)
+- bool SetIntRect(const String name, const IntRect& value)
+- bool SetIntVector2(const String name, const IntVector2& value)
+- bool SetRect(const String name, const Rect& value)
+- bool SetQuaternion(const String name, const Quaternion& value)
+- bool SetString(const String name, const String value)
+- bool SetVariant(const Variant& value)
+- bool SetVariantValue(const Variant& value)
+- bool SetResourceRef(const ResourceRef& value)
+- bool SetResourceRefList(const ResourceRefList& value)
+- bool SetVector2(const String name, const Vector2& value)
+- bool SetVector3(const String name, const Vector3& value)
+- bool SetVector4(const String name, const Vector4& value)
+- bool SetVectorVariant(const String name, const Variant& value)
 - bool IsNull() const
 - bool NotNull() const
 - operator bool () const
@@ -3588,6 +3615,7 @@ Methods:
 - bool HasAttribute(const String name) const
 - bool GetBool(const String name) const
 - BoundingBox GetBoundingBox() const
+- String GetValue() const
 - Color GetColor(const String name) const
 - float GetFloat(const String name) const
 - unsigned GetUInt(const String name) const
@@ -3612,6 +3640,7 @@ Properties:
 - static const XMLElement EMPTY
 - bool null (readonly)
 - String name (readonly)
+- String value (readonly)
 - XMLElement parent (readonly)
 - unsigned numAttributes (readonly)
 - XMLFile* file (readonly)

+ 5 - 1
Docs/ScriptAPI.dox

@@ -1486,6 +1486,7 @@ Methods:
 - XMLElement SelectSinglePrepared(const XPathQuery&)
 - XPathResultSet Select(const String&)
 - XPathResultSet SelectPrepared(const XPathQuery&)
+- bool SetValue(const String&)
 - bool SetAttribute(const String&, const String&)
 - bool SetAttribute(const String&)
 - bool SetBool(const String&, bool)
@@ -1505,6 +1506,7 @@ Methods:
 - bool SetVector4(const String&, const Vector4&)
 - bool SetVectorVariant(const String&, const Variant&)
 - bool HasAttribute(const String&) const
+- String GetValue() const
 - String GetAttribute(const String& = String ( )) const
 - String GetAttributeLower(const String&) const
 - String GetAttributeUpper(const String&) const
@@ -1531,6 +1533,7 @@ Methods:
 
 Properties:
 
+- String value
 - String name (readonly)
 - uint numAttributes (readonly)
 - bool isNull (readonly)
@@ -3518,6 +3521,7 @@ Properties:
 - String typeName (readonly)
 - String category (readonly)
 - String windowTitle
+- Image@ windowIcon (writeonly)
 - IntVector2 windowPosition
 - bool sRGB
 - bool flushGPU
@@ -7049,7 +7053,7 @@ Properties:
 - float Atan2(float, float)
 - float Abs(float)
 - float Sqrt(float)
-- float Pow(float)
+- float Pow(float, float)
 - float Min(float, float)
 - int Min(int, int)
 - float Max(float, float)

+ 35 - 7
Source/Engine/LuaScript/pkgs/Resource/XMLElement.pkg

@@ -2,25 +2,52 @@ $#include "XMLElement.h"
 
 class XMLElement
 {
+    XMLElement CreateChild(const String name);
+    bool RemoveChild(const XMLElement& element);
+    bool RemoveChild(const String name);
+    bool RemoveChildren(const String name = String::EMPTY);
+    bool RemoveAttribute(const String name = String::EMPTY);
+    bool SetValue(const String value);
+    bool SetAttribute(const String name, const String value);
+    bool SetBool(const String name, bool value);
+    bool SetBoundingBox(const BoundingBox& value);
+    bool SetColor(const String name, const Color& value);
+    bool SetFloat(const String name, float value);
+    bool SetUInt(const String name, unsigned value);
+    bool SetInt(const String name, int value);
+    bool SetIntRect(const String name, const IntRect& value);
+    bool SetIntVector2(const String name, const IntVector2& value);
+    bool SetRect(const String name, const Rect& value);
+    bool SetQuaternion(const String name, const Quaternion& value);
+    bool SetString(const String name, const String value);
+    bool SetVariant(const Variant& value);
+    bool SetVariantValue(const Variant& value);
+    bool SetResourceRef(const ResourceRef& value);
+    bool SetResourceRefList(const ResourceRefList& value);
+    bool SetVector2(const String name, const Vector2& value);
+    bool SetVector3(const String name, const Vector3& value);
+    bool SetVector4(const String name, const Vector4& value);
+    bool SetVectorVariant(const String name, const Variant& value);
+
     bool IsNull() const;
     bool NotNull() const;
     operator bool () const;
     String GetName() const;
-    
+
     bool HasChild(const String name) const;
     XMLElement GetChild(const String name = String::EMPTY) const;
     XMLElement GetNext(const String name = String::EMPTY) const;
-    
+
     XMLElement GetParent() const;
-    
+
     unsigned GetNumAttributes() const;
     bool HasAttribute(const String name) const;
-    
+
     bool GetBool(const String name) const;
-    
+
     BoundingBox GetBoundingBox() const;
-    
-	String GetValue() const;
+
+    String GetValue() const;
     Color GetColor(const String name) const;
     float GetFloat(const String name) const;
     unsigned GetUInt(const String name) const;
@@ -48,6 +75,7 @@ class XMLElement
     
     tolua_readonly tolua_property__is_set bool null;
     tolua_readonly tolua_property__get_set String name;
+    tolua_readonly tolua_property__get_set String value;
     tolua_readonly tolua_property__get_set XMLElement parent;
     tolua_readonly tolua_property__get_set unsigned numAttributes;
     tolua_readonly tolua_property__get_set XMLFile* file;

+ 1 - 2
Source/Engine/Resource/XMLElement.h

@@ -90,8 +90,7 @@ public:
 
     /// Set the value for an inner node in the following format <node>value</node>.
     bool SetValue(const String& value);
-    /// Set the value for an inner node in the following format
-    /// <node>value</node>. Must be used on the <node> element.
+    /// Set the value for an inner node in the following format <node>value</node>. Must be used on the <node> element.
     bool SetValue(const char* value);
     /// Set an attribute.
     bool SetAttribute(const String& name, const String& value);

+ 2 - 0
Source/Engine/Script/ResourceAPI.cpp

@@ -269,6 +269,8 @@ static void RegisterXMLElement(asIScriptEngine* engine)
     engine->RegisterObjectMethod("XMLElement", "Vector3 GetVector3(const String&in) const", asMETHOD(XMLElement, GetVector3), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "Vector4 GetVector4(const String&in) const", asMETHOD(XMLElement, GetVector4), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "Variant GetVectorVariant(const String&in) const", asMETHOD(XMLElement, GetVectorVariant), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XMLElement", "bool set_value(const String&in)", asMETHODPR(XMLElement, SetValue, (const String&), bool), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XMLElement", "String get_value() const", asMETHOD(XMLElement, GetValue), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "String get_name() const", asMETHOD(XMLElement, GetName), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "uint get_numAttributes() const", asMETHOD(XMLElement, GetNumAttributes), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "bool get_isNull() const", asMETHOD(XMLElement, IsNull), asCALL_THISCALL);