1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-19 03:57:14 +01:00
SqMod/module/Library/XML/Node.cpp
Sandu Liviu Catalin 39d6af7687 Integrate XML module.
Integrate the XML module into the host plugin and get it to compile.
2020-03-22 01:33:11 +02:00

102 lines
3.8 KiB
C++

// ------------------------------------------------------------------------------------------------
#include "Library/XML/Node.hpp"
#include "Library/XML/Attribute.hpp"
#include "Library/XML/Text.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQInteger XmlNode::Typename(HSQUIRRELVM vm)
{
static const SQChar name[] = _SC("SqXmlNode");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::GetFirstAttr() const
{
return XmlAttribute(m_Doc, m_Node.first_attribute());
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::GetLastAttr() const
{
return XmlAttribute(m_Doc, m_Node.last_attribute());
}
// ------------------------------------------------------------------------------------------------
XmlText XmlNode::GetText() const
{
return XmlText(m_Doc, m_Node.text());
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::GetAttribute(CSStr name) const
{
return XmlAttribute(m_Doc, m_Node.attribute(name));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::AttributeFrom(CSStr name, XmlAttribute & attr) const
{
return XmlAttribute(m_Doc, m_Node.attribute(name, attr.m_Attr));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::AppendAttr(CSStr name)
{
return XmlAttribute(m_Doc, m_Node.append_attribute(name));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::PrependAttr(CSStr name)
{
return XmlAttribute(m_Doc, m_Node.prepend_attribute(name));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::InsertAttrAfter(CSStr name, const XmlAttribute & attr)
{
return XmlAttribute(m_Doc, m_Node.insert_attribute_after(name, attr.m_Attr));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::InsertAttrBefore(CSStr name, const XmlAttribute & attr)
{
return XmlAttribute(m_Doc, m_Node.insert_attribute_before(name, attr.m_Attr));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::AppendAttrCopy(const XmlAttribute & proto)
{
return XmlAttribute(m_Doc, m_Node.append_copy(proto.m_Attr));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::PrependAttrCopy(const XmlAttribute & proto)
{
return XmlAttribute(m_Doc, m_Node.prepend_copy(proto.m_Attr));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::InsertAttrCopyAfter(const XmlAttribute & proto, const XmlAttribute & attr)
{
return XmlAttribute(m_Doc, m_Node.insert_copy_after(proto.m_Attr, attr.m_Attr));
}
// ------------------------------------------------------------------------------------------------
XmlAttribute XmlNode::InsertAttrCopyBefore(const XmlAttribute & proto, const XmlAttribute & attr)
{
return XmlAttribute(m_Doc, m_Node.insert_copy_before(proto.m_Attr, attr.m_Attr));
}
// ------------------------------------------------------------------------------------------------
bool XmlNode::RemoveAttrInst(const XmlAttribute & attr)
{
return m_Node.remove_attribute(attr.m_Attr);
}
} // Namespace:: SqMod