mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-07 07:25:26 +00:00
split rpcs3 and hle libraries
merge rpcs3 utilities
This commit is contained in:
parent
b33e2662b6
commit
62ad27d1e2
1233 changed files with 7004 additions and 3819 deletions
106
rpcs3/util/rXml.cpp
Normal file
106
rpcs3/util/rXml.cpp
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
#include "stdafx.h"
|
||||
#include "util/rXml.h"
|
||||
|
||||
rXmlNode::rXmlNode()
|
||||
{
|
||||
}
|
||||
|
||||
rXmlNode::rXmlNode(const pugi::xml_node& node)
|
||||
{
|
||||
handle = node;
|
||||
}
|
||||
|
||||
std::shared_ptr<rXmlNode> rXmlNode::GetChildren()
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
if (const pugi::xml_node child = handle.first_child())
|
||||
{
|
||||
return std::make_shared<rXmlNode>(child);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<rXmlNode> rXmlNode::GetNext()
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
if (const pugi::xml_node result = handle.next_sibling())
|
||||
{
|
||||
return std::make_shared<rXmlNode>(result);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string rXmlNode::GetName()
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
if (const pugi::char_t* name = handle.name())
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string rXmlNode::GetAttribute(std::string_view name)
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
if (const pugi::xml_attribute attr = handle.attribute(name))
|
||||
{
|
||||
if (const pugi::char_t* value = attr.value())
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string rXmlNode::GetNodeContent()
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
if (const pugi::xml_text text = handle.text())
|
||||
{
|
||||
if (const pugi::char_t* value = text.get())
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
rXmlDocument::rXmlDocument()
|
||||
{
|
||||
}
|
||||
|
||||
pugi::xml_parse_result rXmlDocument::Read(std::string_view data)
|
||||
{
|
||||
if (handle)
|
||||
{
|
||||
return handle.load_buffer(data.data(), data.size());
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::shared_ptr<rXmlNode> rXmlDocument::GetRoot()
|
||||
{
|
||||
if (const pugi::xml_node root = handle.root())
|
||||
{
|
||||
return std::make_shared<rXmlNode>(root);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue