浏览代码

Add XMLElement::GetInt64 & GetUInt64 for completeness.

Lasse Öörni 8 年之前
父节点
当前提交
00816efec2

+ 2 - 0
Source/Urho3D/AngelScript/ResourceAPI.cpp

@@ -507,6 +507,8 @@ static void RegisterXMLElement(asIScriptEngine* engine)
     engine->RegisterObjectMethod("XMLElement", "double GetDouble(const String&in) const", asMETHOD(XMLElement, GetDouble), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "uint GetUInt(const String&in) const", asMETHOD(XMLElement, GetUInt), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "int GetInt(const String&in) const", asMETHOD(XMLElement, GetInt), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XMLElement", "uint64 GetUInt64(const String&in) const", asMETHOD(XMLElement, GetUInt64), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XMLElement", "int64 GetInt64(const String&in) const", asMETHOD(XMLElement, GetInt64), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "IntRect GetIntRect(const String&in) const", asMETHOD(XMLElement, GetIntRect), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "IntVector2 GetIntVector2(const String&in) const", asMETHOD(XMLElement, GetIntVector2), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "IntVector3 GetIntVector3(const String&in) const", asMETHOD(XMLElement, GetIntVector3), asCALL_THISCALL);

+ 4 - 2
Source/Urho3D/LuaScript/pkgs/Resource/XMLElement.pkg

@@ -19,8 +19,8 @@ class XMLElement
     bool SetDouble(const String name, double value);
     bool SetUInt(const String name, unsigned value);
     bool SetInt(const String name, int value);
-    bool SetUInt64(const String name, unsigned long long int value);
-    bool SetInt64(const String name, long long int value);
+    bool SetUInt64(const String name, unsigned long long value);
+    bool SetInt64(const String name, long long value);
     bool SetIntRect(const String name, const IntRect& value);
     bool SetIntVector2(const String name, const IntVector2& value);
     bool SetIntVector3(const String name, const IntVector3& value);
@@ -63,6 +63,8 @@ class XMLElement
     double GetDouble(const String name) const;
     unsigned GetUInt(const String name) const;
     int GetInt(const String name) const;
+    unsigned long long GetUInt64(const String name) const;
+    long long GetInt64(const String name) const;
     IntRect GetIntRect(const String name) const;
     IntVector2 GetIntVector2(const String name) const;
     IntVector3 GetIntVector3(const String name) const;

+ 10 - 0
Source/Urho3D/Resource/XMLElement.cpp

@@ -789,6 +789,16 @@ int XMLElement::GetInt(const String& name) const
     return ToInt(GetAttribute(name));
 }
 
+unsigned long long XMLElement::GetUInt64(const String& name) const
+{
+    return ToUInt64(GetAttribute(name));
+}
+
+long long XMLElement::GetInt64(const String& name) const
+{
+    return ToInt64(GetAttribute(name));
+}
+
 IntRect XMLElement::GetIntRect(const String& name) const
 {
     return ToIntRect(GetAttribute(name));

+ 6 - 2
Source/Urho3D/Resource/XMLElement.h

@@ -124,9 +124,9 @@ public:
     bool SetUInt(const String& name, unsigned value);
     /// Set an integer attribute.
     bool SetInt(const String& name, int value);
-    /// Set an unsigned integer attribute.
+    /// Set an unsigned long long integer attribute.
     bool SetUInt64(const String& name, unsigned long long value);
-    /// Set an integer attribute.
+    /// Set a long long integer attribute.
     bool SetInt64(const String& name, long long value);
     /// Set an IntRect attribute.
     bool SetIntRect(const String& name, const IntRect& value);
@@ -233,6 +233,10 @@ public:
     unsigned GetUInt(const String& name) const;
     /// Return an integer attribute, or zero if missing.
     int GetInt(const String& name) const;
+    /// Return an unsigned long long integer attribute, or zero if missing.
+    unsigned long long GetUInt64(const String& name) const;
+    /// Return a long long integer attribute, or zero if missing.
+    long long GetInt64(const String& name) const;
     /// Return an IntRect attribute, or default if missing.
     IntRect GetIntRect(const String& name) const;
     /// Return an IntVector2 attribute, or default if missing.