1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-19 12:07:13 +01:00
SqMod/module/Library/XML/Document.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

38 lines
1.3 KiB
C++

// ------------------------------------------------------------------------------------------------
#include "Library/XML/Document.hpp"
#include "Library/XML/Node.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQInteger XmlDocument::Typename(HSQUIRRELVM vm)
{
static const SQChar name[] = _SC("SqXmlDocument");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
// ------------------------------------------------------------------------------------------------
void XmlDocument::CanLoad() const
{
// Is the document even valid?
m_Doc.Validate();
// Are there any other references?
if (m_Doc.Count() > 1)
{
// To load new values now, would mean to cause undefined behavior in existing references
STHROWF("Loading is disabled while document is referenced");
}
}
// ------------------------------------------------------------------------------------------------
XmlNode XmlDocument::GetNode() const
{
// Validate the document handle
m_Doc.Validate();
// Return the requested information
return XmlNode(m_Doc, m_Doc->document_element());
}
} // Namespace:: SqMod