mirror of https://github.com/RPCS3/rpcs3.git
Merge pull request #1656 from mpm11011/master
Replace wx/xml with pugixml in rXML
This commit is contained in:
commit
8189577e8f
|
@ -53,7 +53,7 @@ before_install:
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- git submodule update --init asmjit 3rdparty/ffmpeg 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers
|
- git submodule update --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ..; else cmake .. -DLLVM_DIR=/usr/local/opt/llvm36/lib/llvm-3.6/share/llvm/cmake; fi
|
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ..; else cmake .. -DLLVM_DIR=/usr/local/opt/llvm36/lib/llvm-3.6/share/llvm/cmake; fi
|
||||||
|
|
|
@ -1,117 +1,120 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Utilities/rXml.h"
|
#include "Utilities/rXml.h"
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma message("TODO: remove wx dependency: <wx/xml/xml.h>")
|
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#include <wx/xml/xml.h>
|
#include <pugixml.hpp>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
rXmlNode::rXmlNode()
|
rXmlNode::rXmlNode()
|
||||||
{
|
{
|
||||||
ownPtr = true;
|
ownPtr = true;
|
||||||
handle = reinterpret_cast<void *>(new wxXmlNode());
|
handle = new pugi::xml_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
rXmlNode::rXmlNode(void *ptr)
|
rXmlNode::rXmlNode(pugi::xml_node *ptr)
|
||||||
{
|
{
|
||||||
ownPtr = false;
|
ownPtr = false;
|
||||||
handle = ptr;
|
handle = ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
rXmlNode::rXmlNode(const rXmlNode& other)
|
|
||||||
{
|
|
||||||
ownPtr = true;
|
|
||||||
handle = reinterpret_cast<void *>(new wxXmlNode(*reinterpret_cast<wxXmlNode*>(other.handle)));
|
|
||||||
}
|
|
||||||
|
|
||||||
rXmlNode &rXmlNode::operator=(const rXmlNode& other)
|
|
||||||
{
|
|
||||||
if (ownPtr)
|
|
||||||
{
|
|
||||||
delete reinterpret_cast<wxXmlNode*>(handle);
|
|
||||||
}
|
|
||||||
handle = reinterpret_cast<void *>(new wxXmlNode(*reinterpret_cast<wxXmlNode*>(other.handle)));
|
|
||||||
ownPtr = true;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
rXmlNode::~rXmlNode()
|
rXmlNode::~rXmlNode()
|
||||||
{
|
{
|
||||||
if (ownPtr)
|
if (ownPtr)
|
||||||
{
|
{
|
||||||
delete reinterpret_cast<wxXmlNode*>(handle);
|
delete handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rXmlNode::rXmlNode(const rXmlNode& other)
|
||||||
|
{
|
||||||
|
ownPtr = true;
|
||||||
|
handle = new pugi::xml_node(*other.handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
rXmlNode &rXmlNode::operator=(const rXmlNode& other)
|
||||||
|
{
|
||||||
|
if (ownPtr)
|
||||||
|
{
|
||||||
|
delete handle;
|
||||||
|
}
|
||||||
|
handle = new pugi::xml_node(*other.handle);
|
||||||
|
ownPtr = true;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<rXmlNode> rXmlNode::GetChildren()
|
std::shared_ptr<rXmlNode> rXmlNode::GetChildren()
|
||||||
{
|
{
|
||||||
wxXmlNode* result = reinterpret_cast<wxXmlNode*>(handle)->GetChildren();
|
// it.begin() returns node_iterator*, *it.begin() return node*.
|
||||||
if (result)
|
pugi::xml_object_range<pugi::xml_node_iterator> it = handle->children();
|
||||||
|
pugi::xml_node begin = *it.begin();
|
||||||
|
|
||||||
|
if (begin)
|
||||||
{
|
{
|
||||||
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(result));
|
return std::make_shared<rXmlNode>(&begin);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return std::shared_ptr<rXmlNode>(nullptr);
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<rXmlNode> rXmlNode::GetNext()
|
std::shared_ptr<rXmlNode> rXmlNode::GetNext()
|
||||||
{
|
{
|
||||||
wxXmlNode* result = reinterpret_cast<wxXmlNode*>(handle)->GetNext();
|
pugi::xml_node result = handle->next_sibling();
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(result));
|
return std::make_shared<rXmlNode>(&result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return std::shared_ptr<rXmlNode>(nullptr);
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rXmlNode::GetName()
|
std::string rXmlNode::GetName()
|
||||||
{
|
{
|
||||||
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetName());
|
return handle->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rXmlNode::GetAttribute(const std::string &name)
|
std::string rXmlNode::GetAttribute(const std::string &name)
|
||||||
{
|
{
|
||||||
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetAttribute(fmt::FromUTF8(name)));
|
auto pred = [&name](pugi::xml_attribute attr) { return (name == attr.name()); };
|
||||||
|
return handle->find_attribute(pred).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rXmlNode::GetNodeContent()
|
std::string rXmlNode::GetNodeContent()
|
||||||
{
|
{
|
||||||
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetNodeContent());
|
return handle->text().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void *rXmlNode::AsVoidPtr()
|
||||||
|
{
|
||||||
|
return static_cast<void*>(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
rXmlDocument::rXmlDocument()
|
rXmlDocument::rXmlDocument()
|
||||||
{
|
{
|
||||||
handle = reinterpret_cast<void *>(new wxXmlDocument());
|
handle = new pugi::xml_document;
|
||||||
}
|
|
||||||
|
|
||||||
rXmlDocument::rXmlDocument(const rXmlDocument& other)
|
|
||||||
{
|
|
||||||
handle = reinterpret_cast<void *>(new wxXmlDocument(*reinterpret_cast<wxXmlDocument*>(other.handle)));
|
|
||||||
}
|
|
||||||
|
|
||||||
rXmlDocument &rXmlDocument::operator = (const rXmlDocument& other)
|
|
||||||
{
|
|
||||||
delete reinterpret_cast<wxXmlDocument*>(handle);
|
|
||||||
handle = reinterpret_cast<void *>(new wxXmlDocument(*reinterpret_cast<wxXmlDocument*>(other.handle)));
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rXmlDocument::~rXmlDocument()
|
rXmlDocument::~rXmlDocument()
|
||||||
{
|
{
|
||||||
delete reinterpret_cast<wxXmlDocument*>(handle);
|
delete handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rXmlDocument::Load(const std::string & path)
|
void rXmlDocument::Load(const std::string & path)
|
||||||
{
|
{
|
||||||
reinterpret_cast<wxXmlDocument*>(handle)->Load(fmt::FromUTF8(path));
|
// TODO: Unsure of use of c_str.
|
||||||
|
handle->load_string(path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<rXmlNode> rXmlDocument::GetRoot()
|
std::shared_ptr<rXmlNode> rXmlDocument::GetRoot()
|
||||||
{
|
{
|
||||||
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(reinterpret_cast<wxXmlDocument*>(handle)->GetRoot()));
|
pugi::xml_node root = handle->root();
|
||||||
|
return std::make_shared<rXmlNode>(&root);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *rXmlDocument::AsVoidPtr()
|
||||||
|
{
|
||||||
|
return static_cast<void*>(handle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <pugixml.hpp>
|
||||||
|
|
||||||
struct rXmlNode
|
struct rXmlNode
|
||||||
{
|
{
|
||||||
rXmlNode();
|
rXmlNode();
|
||||||
rXmlNode(void *);
|
rXmlNode(pugi::xml_node *);
|
||||||
rXmlNode(const rXmlNode& other);
|
rXmlNode(const rXmlNode& other);
|
||||||
rXmlNode &operator=(const rXmlNode& other);
|
rXmlNode &operator=(const rXmlNode& other);
|
||||||
~rXmlNode();
|
~rXmlNode();
|
||||||
|
@ -12,19 +14,21 @@ struct rXmlNode
|
||||||
std::string GetName();
|
std::string GetName();
|
||||||
std::string GetAttribute( const std::string &name);
|
std::string GetAttribute( const std::string &name);
|
||||||
std::string GetNodeContent();
|
std::string GetNodeContent();
|
||||||
|
void *AsVoidPtr();
|
||||||
|
|
||||||
void *handle;
|
pugi::xml_node *handle;
|
||||||
bool ownPtr;
|
bool ownPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rXmlDocument
|
struct rXmlDocument
|
||||||
{
|
{
|
||||||
rXmlDocument();
|
rXmlDocument();
|
||||||
rXmlDocument(const rXmlDocument& other);
|
rXmlDocument(const rXmlDocument& other) = delete;
|
||||||
rXmlDocument &operator=(const rXmlDocument& other);
|
rXmlDocument &operator=(const rXmlDocument& other) = delete;
|
||||||
~rXmlDocument();
|
~rXmlDocument();
|
||||||
void Load(const std::string & path);
|
void Load(const std::string & path);
|
||||||
std::shared_ptr<rXmlNode> GetRoot();
|
std::shared_ptr<rXmlNode> GetRoot();
|
||||||
|
void *AsVoidPtr();
|
||||||
|
|
||||||
void *handle;
|
pugi::xml_document *handle;
|
||||||
};
|
};
|
|
@ -14,7 +14,7 @@ branches:
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
# until git for win 2.5 release with commit checkout
|
# until git for win 2.5 release with commit checkout
|
||||||
- git submodule update --init 3rdparty/ffmpeg asmjit rsx_program_decompiler 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers
|
- git submodule update --init 3rdparty/ffmpeg 3rdparty/pugixml asmjit rsx_program_decompiler 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers
|
||||||
- 7z x wxWidgets.7z -aos -oC:\rpcs3\wxWidgets > null
|
- 7z x wxWidgets.7z -aos -oC:\rpcs3\wxWidgets > null
|
||||||
- 7z x zlib.7z -aos -oC:\rpcs3\ > null
|
- 7z x zlib.7z -aos -oC:\rpcs3\ > null
|
||||||
- if %configuration%==Release (cmake -G "Visual Studio 14 Win64" -DZLIB_ROOT=C:/rpcs3/zlib/)
|
- if %configuration%==Release (cmake -G "Visual Studio 14 Win64" -DZLIB_ROOT=C:/rpcs3/zlib/)
|
||||||
|
|
|
@ -106,6 +106,7 @@ ${wxWidgets_INCLUDE_DIRS}
|
||||||
${ZLIB_INCLUDE_DIR}
|
${ZLIB_INCLUDE_DIR}
|
||||||
${OPENAL_INCLUDE_DIR}
|
${OPENAL_INCLUDE_DIR}
|
||||||
${LLVM_INCLUDE_DIRS}
|
${LLVM_INCLUDE_DIRS}
|
||||||
|
"${RPCS3_SRC_DIR}/../3rdparty/pugixml/src"
|
||||||
"${RPCS3_SRC_DIR}/../3rdparty/ffmpeg/${PLATFORM_ARCH}/include"
|
"${RPCS3_SRC_DIR}/../3rdparty/ffmpeg/${PLATFORM_ARCH}/include"
|
||||||
"${RPCS3_SRC_DIR}"
|
"${RPCS3_SRC_DIR}"
|
||||||
"${RPCS3_SRC_DIR}/Loader"
|
"${RPCS3_SRC_DIR}/Loader"
|
||||||
|
@ -164,6 +165,7 @@ endforeach()
|
||||||
file(
|
file(
|
||||||
GLOB_RECURSE
|
GLOB_RECURSE
|
||||||
RPCS3_SRC
|
RPCS3_SRC
|
||||||
|
"${RPCS3_SRC_DIR}/../3rdparty/pugixml/src/pugixml.cpp"
|
||||||
"${RPCS3_SRC_DIR}/rpcs3.cpp"
|
"${RPCS3_SRC_DIR}/rpcs3.cpp"
|
||||||
"${RPCS3_SRC_DIR}/config.cpp"
|
"${RPCS3_SRC_DIR}/config.cpp"
|
||||||
"${RPCS3_SRC_DIR}/stb_image.cpp"
|
"${RPCS3_SRC_DIR}/stb_image.cpp"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<ImportGroup Label="PropertySheets" />
|
<ImportGroup Label="PropertySheets" />
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;..\wxWidgets\src\zlib;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\glm;..\3rdparty\GSL\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include</IncludePath>
|
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;..\wxWidgets\src\zlib;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\glm;..\3rdparty\GSL\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src</IncludePath>
|
||||||
<OutDir>$(SolutionDir)lib\$(Configuration)-$(Platform)\</OutDir>
|
<OutDir>$(SolutionDir)lib\$(Configuration)-$(Platform)\</OutDir>
|
||||||
<LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
|
||||||
<IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\</IntDir>
|
<IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\</IntDir>
|
||||||
|
|
Loading…
Reference in New Issue