1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-19 12:07:13 +01:00

Compare commits

..

No commits in common. "8dc0ca18f52e4d5e990f65be6a109a1d664fd9e3" and "d749250e1bc327b3fa68db112a33ff649e90c951" have entirely different histories.

2 changed files with 53 additions and 57 deletions

View File

@ -138,10 +138,9 @@ SQInteger XmlAttribute::GetLong() const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
XmlAttribute & XmlAttribute::SetLong(SQInteger value) void XmlAttribute::SetLong(SQInteger value)
{ {
m_Attr = value; m_Attr = value;
return *this;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -151,10 +150,9 @@ SQInteger XmlAttribute::GetUlong() const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
XmlAttribute & XmlAttribute::SetUlong(SQInteger value) void XmlAttribute::SetUlong(SQInteger value)
{ {
m_Attr = static_cast< uint64_t >(value); m_Attr = static_cast< uint64_t >(value);
return *this;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -188,10 +186,9 @@ SQInteger XmlText::GetLong() const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
XmlText & XmlText::SetLong(SQInteger value) void XmlText::SetLong(SQInteger value)
{ {
m_Text = value; m_Text = value;
return *this;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -201,10 +198,9 @@ SQInteger XmlText::GetUlong() const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
XmlText & XmlText::SetUlong(SQInteger value) void XmlText::SetUlong(SQInteger value)
{ {
m_Text = static_cast< uint64_t >(value); m_Text = static_cast< uint64_t >(value);
return *this;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -263,8 +259,8 @@ void Register_XML(HSQUIRRELVM vm)
.Prop(_SC("Next"), &XmlAttribute::NextAttribute) .Prop(_SC("Next"), &XmlAttribute::NextAttribute)
.Prop(_SC("Prev"), &XmlAttribute::PrevAttribute) .Prop(_SC("Prev"), &XmlAttribute::PrevAttribute)
// Member Methods // Member Methods
.FmtFunc(_SC("SetName"), &XmlAttribute::SetName) .Func(_SC("SetName"), &XmlAttribute::ApplyName)
.FmtFunc(_SC("SetValue"), &XmlAttribute::ApplyValue) .Func(_SC("SetValue"), &XmlAttribute::ApplyValue)
.Func(_SC("AsString"), &XmlAttribute::AsString) .Func(_SC("AsString"), &XmlAttribute::AsString)
.Func(_SC("AsInt"), &XmlAttribute::AsInt) .Func(_SC("AsInt"), &XmlAttribute::AsInt)
.Func(_SC("AsUint"), &XmlAttribute::AsUint) .Func(_SC("AsUint"), &XmlAttribute::AsUint)
@ -354,8 +350,8 @@ void Register_XML(HSQUIRRELVM vm)
.Overload(_SC("AppendBuffer"), &XmlNode::AppendBuffer1) .Overload(_SC("AppendBuffer"), &XmlNode::AppendBuffer1)
.Overload(_SC("AppendBuffer"), &XmlNode::AppendBuffer2) .Overload(_SC("AppendBuffer"), &XmlNode::AppendBuffer2)
.Overload(_SC("AppendBuffer"), &XmlNode::AppendBuffer3) .Overload(_SC("AppendBuffer"), &XmlNode::AppendBuffer3)
.FmtFunc(_SC("SetName"), &XmlNode::SetName) .Func(_SC("SetName"), &XmlNode::ApplyName)
.FmtFunc(_SC("SetValue"), &XmlNode::ApplyValue) .Func(_SC("SetValue"), &XmlNode::ApplyValue)
.Func(_SC("GetChild"), &XmlNode::Child) .Func(_SC("GetChild"), &XmlNode::Child)
.Func(_SC("GetAttr"), &XmlNode::GetAttribute) .Func(_SC("GetAttr"), &XmlNode::GetAttribute)
.Func(_SC("GetAttribute"), &XmlNode::GetAttribute) .Func(_SC("GetAttribute"), &XmlNode::GetAttribute)
@ -372,8 +368,8 @@ void Register_XML(HSQUIRRELVM vm)
.Func(_SC("PrependAttrCopy"), &XmlNode::PrependAttrCopy) .Func(_SC("PrependAttrCopy"), &XmlNode::PrependAttrCopy)
.Func(_SC("InsertAttrCopyAfter"), &XmlNode::InsertAttrCopyAfter) .Func(_SC("InsertAttrCopyAfter"), &XmlNode::InsertAttrCopyAfter)
.Func(_SC("InsertAttrCopyBefore"), &XmlNode::InsertAttrCopyBefore) .Func(_SC("InsertAttrCopyBefore"), &XmlNode::InsertAttrCopyBefore)
.FmtFunc(_SC("AppendChild"), &XmlNode::AppendChild) .Func(_SC("AppendChild"), &XmlNode::AppendChild)
.FmtFunc(_SC("PrependChild"), &XmlNode::PrependChild) .Func(_SC("PrependChild"), &XmlNode::PrependChild)
.Func(_SC("AppendChildNode"), &XmlNode::AppendChildNode) .Func(_SC("AppendChildNode"), &XmlNode::AppendChildNode)
.Func(_SC("PrependChildNode"), &XmlNode::PrependChildNode) .Func(_SC("PrependChildNode"), &XmlNode::PrependChildNode)
.Func(_SC("AppendChildType"), &XmlNode::AppendChildType) .Func(_SC("AppendChildType"), &XmlNode::AppendChildType)
@ -390,9 +386,9 @@ void Register_XML(HSQUIRRELVM vm)
.Func(_SC("PrependMove"), &XmlNode::PrependMove) .Func(_SC("PrependMove"), &XmlNode::PrependMove)
.Func(_SC("InsertMoveAfter"), &XmlNode::InsertMoveAfter) .Func(_SC("InsertMoveAfter"), &XmlNode::InsertMoveAfter)
.Func(_SC("InsertMoveBefore"), &XmlNode::InsertMoveBefore) .Func(_SC("InsertMoveBefore"), &XmlNode::InsertMoveBefore)
.FmtFunc(_SC("RemoveAttr"), &XmlNode::RemoveAttr) .Func(_SC("RemoveAttr"), &XmlNode::RemoveAttr)
.Func(_SC("RemoveAttrInst"), &XmlNode::RemoveAttrInst) .Func(_SC("RemoveAttrInst"), &XmlNode::RemoveAttrInst)
.FmtFunc(_SC("RemoveChild"), &XmlNode::RemoveChild) .Func(_SC("RemoveChild"), &XmlNode::RemoveChild)
.Func(_SC("RemoveChildInst"), &XmlNode::RemoveChildInst) .Func(_SC("RemoveChildInst"), &XmlNode::RemoveChildInst)
.Overload(_SC("FindChildByAttr"), &XmlNode::FindChildByAttr2) .Overload(_SC("FindChildByAttr"), &XmlNode::FindChildByAttr2)
.Overload(_SC("FindChildByAttr"), &XmlNode::FindChildByAttr3) .Overload(_SC("FindChildByAttr"), &XmlNode::FindChildByAttr3)
@ -425,7 +421,7 @@ void Register_XML(HSQUIRRELVM vm)
.Overload(_SC("SaveFile"), &XmlDocument::SaveFile4) .Overload(_SC("SaveFile"), &XmlDocument::SaveFile4)
); );
RootTable(vm).Bind(_SC("SqXML"), xmlns); RootTable(vm).Bind(_SC("SqXml"), xmlns);
ConstTable(vm).Enum(_SC("SqXmlNodeType"), Enumeration(vm) ConstTable(vm).Enum(_SC("SqXmlNodeType"), Enumeration(vm)
.Const(_SC("Null"), static_cast< int32_t >(node_null)) .Const(_SC("Null"), static_cast< int32_t >(node_null))

View File

@ -663,7 +663,7 @@ protected:
* Explicit constructor. * Explicit constructor.
*/ */
XmlNode(DocumentRef doc, const Type & node) XmlNode(DocumentRef doc, const Type & node)
: m_Node(node), m_Doc(std::move(doc)) : m_Doc(std::move(doc)), m_Node(node)
{ {
/* ... */ /* ... */
} }
@ -671,8 +671,8 @@ protected:
private: private:
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
Type m_Node{}; // The managed document node.
DocumentRef m_Doc{}; // The main xml document instance. DocumentRef m_Doc{}; // The main xml document instance.
Type m_Node{}; // The managed document node.
public: public:
@ -777,13 +777,20 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify node name. * Modify node name.
*/ */
XmlNode & SetName(StackStrF & name) void SetName(StackStrF & name)
{ {
if (!m_Node.set_name(name.mPtr)) if (!m_Node.set_name(name.mPtr))
{ {
STHROWF("Unable to set XML node name `{}`", name.ToStr()); STHROWF("Unable to set XML node name");
} }
return *this; }
/* --------------------------------------------------------------------------------------------
* Modify the node name.
*/
bool ApplyName(StackStrF & name)
{
return m_Node.set_name(name.mPtr);
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -797,13 +804,12 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify node value. * Modify node value.
*/ */
XmlNode & SetValue(StackStrF & name) void SetValue(StackStrF & name)
{ {
if (!m_Node.set_value(name.mPtr)) if (!m_Node.set_value(name.mPtr))
{ {
STHROWF("Unable to set XML node value"); STHROWF("Unable to set XML node value");
} }
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1325,13 +1331,20 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve attribute name. * Retrieve attribute name.
*/ */
XmlAttribute & SetName(StackStrF & name) void SetName(StackStrF & name)
{ {
if (!m_Attr.set_name(name.mPtr)) if (!m_Attr.set_name(name.mPtr))
{ {
STHROWF("Unable to set XML attribute name `{}`", name.ToStr()); STHROWF("Unable to set XML attribute name");
} }
return *this; }
/* --------------------------------------------------------------------------------------------
* Modify the attribute name.
*/
bool ApplyName(StackStrF & name)
{
return m_Attr.set_name(name.mPtr);
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1345,13 +1358,12 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve attribute value. * Retrieve attribute value.
*/ */
XmlAttribute SetValue(StackStrF & name) void SetValue(StackStrF & name)
{ {
if (!m_Attr.set_value(name.mPtr)) if (!m_Attr.set_value(name.mPtr))
{ {
STHROWF("Unable to set XML attribute value"); STHROWF("Unable to set XML attribute value");
} }
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1489,10 +1501,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a string. * Modify the value as a string.
*/ */
XmlAttribute & SetString(StackStrF & value) void SetString(StackStrF & value)
{ {
m_Attr = value.mPtr; m_Attr = value.mPtr;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1506,10 +1517,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a integer. * Modify the value as a integer.
*/ */
XmlAttribute & SetInt(int32_t value) void SetInt(int32_t value)
{ {
m_Attr = value; m_Attr = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1523,10 +1533,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a unsigned integer. * Modify the value as a unsigned integer.
*/ */
XmlAttribute & SetUint(uint32_t value) void SetUint(uint32_t value)
{ {
m_Attr = value; m_Attr = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1540,10 +1549,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a floating point. * Modify the value as a floating point.
*/ */
XmlAttribute & SetFloat(SQFloat value) void SetFloat(SQFloat value)
{ {
m_Attr = value; m_Attr = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1557,10 +1565,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a double floating point. * Modify the value as a double floating point.
*/ */
XmlAttribute & SetDouble(SQFloat value) void SetDouble(SQFloat value)
{ {
m_Attr = value; m_Attr = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1571,7 +1578,7 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a long integer. * Modify the value as a long integer.
*/ */
XmlAttribute & SetLong(SQInteger value); void SetLong(SQInteger value);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the value as a unsigned long integer. * Retrieve the value as a unsigned long integer.
@ -1581,7 +1588,7 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a unsigned long integer. * Modify the value as a unsigned long integer.
*/ */
XmlAttribute & SetUlong(SQInteger value); void SetUlong(SQInteger value);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the value as a boolean. * Retrieve the value as a boolean.
@ -1594,10 +1601,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a boolean. * Modify the value as a boolean.
*/ */
XmlAttribute & SetBool(bool value) void SetBool(bool value)
{ {
m_Attr = value; m_Attr = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1847,10 +1853,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a string. * Modify the value as a string.
*/ */
XmlText & SetString(StackStrF & value) void SetString(StackStrF & value)
{ {
m_Text = value.mPtr; m_Text = value.mPtr;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1864,10 +1869,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a integer. * Modify the value as a integer.
*/ */
XmlText & SetInt(int32_t value) void SetInt(int32_t value)
{ {
m_Text = value; m_Text = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1881,10 +1885,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a unsigned integer. * Modify the value as a unsigned integer.
*/ */
XmlText & SetUint(uint32_t value) void SetUint(uint32_t value)
{ {
m_Text = value; m_Text = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1898,10 +1901,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a floating point. * Modify the value as a floating point.
*/ */
XmlText & SetFloat(SQFloat value) void SetFloat(SQFloat value)
{ {
m_Text = value; m_Text = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1915,10 +1917,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a double floating point. * Modify the value as a double floating point.
*/ */
XmlText & SetDouble(SQFloat value) void SetDouble(SQFloat value)
{ {
m_Text = value; m_Text = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -1929,7 +1930,7 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a long integer. * Modify the value as a long integer.
*/ */
XmlText & SetLong(SQInteger value); void SetLong(SQInteger value);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the value as a unsigned long integer. * Retrieve the value as a unsigned long integer.
@ -1939,7 +1940,7 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a unsigned long integer. * Modify the value as a unsigned long integer.
*/ */
XmlText & SetUlong(SQInteger value); void SetUlong(SQInteger value);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the value as a boolean. * Retrieve the value as a boolean.
@ -1952,10 +1953,9 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Modify the value as a boolean. * Modify the value as a boolean.
*/ */
XmlText & SetBool(bool value) void SetBool(bool value)
{ {
m_Text = value; m_Text = value;
return *this;
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------