* Updated tinyXML to tinyXML2 v4.0.1 (GreyWolf)

This commit is contained in:
cyan06 2016-11-06 15:01:54 +00:00
parent 3a62520601
commit 6a2d30beb3
12 changed files with 4757 additions and 5434 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>3.0 r1262</version>
<release_date>20161019124305</release_date>
<version>3.0 r1263</version>
<release_date>20161106144602</release_date>
<!-- // remove this line to enable arguments
<arguments>
<arg>--ios=250</arg>

View File

@ -7,11 +7,13 @@
#include <stdlib.h>
#include <string.h>
#include "FileOperations/fileops.h"
#include "xml/tinyxml.h"
#include "xml/tinyxml2.h"
#include "gecko.h"
#include "HomebrewXML.h"
using namespace tinyxml2;
#define ENTRIE_SIZE 8192
/* qparam filename Filepath of the XML file */
@ -24,15 +26,15 @@ int HomebrewXML::LoadHomebrewXMLData(const char* filename)
LongDescription.clear();
Releasedate.clear();
TiXmlDocument xmlDoc(filename);
if(!xmlDoc.LoadFile())
XMLDocument xmlDoc;
if(xmlDoc.LoadFile(filename) != 0)
return false;
TiXmlElement *appNode = xmlDoc.FirstChildElement("app");
XMLElement *appNode = xmlDoc.FirstChildElement("app");
if(!appNode)
return false;
TiXmlElement *node = NULL;
XMLElement *node = NULL;
node = appNode->FirstChildElement("name");
if(node && node->FirstChild() && node->FirstChild()->Value())
@ -75,7 +77,7 @@ int HomebrewXML::LoadHomebrewXMLData(const char* filename)
if(!node)
return 1;
TiXmlElement *argNode = node->FirstChildElement("arg");
XMLElement *argNode = node->FirstChildElement("arg");
while(argNode)
{

View File

@ -26,9 +26,11 @@
#include "settings/CSettings.h"
#include "network/networkops.h"
#include "utils/StringTools.h"
#include "xml/tinyxml.h"
#include "xml/tinyxml2.h"
#include "gecko.h"
using namespace tinyxml2;
Wiinnertag::Wiinnertag(const string &filepath)
{
ReadXML(filepath);
@ -36,11 +38,11 @@ Wiinnertag::Wiinnertag(const string &filepath)
bool Wiinnertag::ReadXML(const string &filepath)
{
TiXmlDocument xmlDoc(filepath.c_str());
if(!xmlDoc.LoadFile())
XMLDocument xmlDoc;
if(xmlDoc.LoadFile(filepath.c_str()) != 0)
return false;
TiXmlElement * node = xmlDoc.FirstChildElement("Tag");
XMLElement * node = xmlDoc.FirstChildElement("Tag");
while(node != NULL)
{
@ -108,17 +110,17 @@ bool Wiinnertag::CreateExample(const string &filepath)
fullpath += '/';
fullpath += "Wiinnertag.xml";
TiXmlDocument xmlDoc;
XMLDocument xmlDoc;
TiXmlDeclaration declaration("1.0", "UTF-8", "");
XMLDeclaration * declaration = xmlDoc.NewDeclaration();
xmlDoc.InsertEndChild(declaration);
TiXmlElement Tag("Tag");
Tag.SetAttribute("URL", "http://www.wiinnertag.com/wiinnertag_scripts/update_sign.php?key={KEY}&game_id={ID6}");
Tag.SetAttribute("Key", "1234567890");
XMLElement *Tag = xmlDoc.NewElement("Tag");
Tag->SetAttribute("URL", "http://www.wiinnertag.com/wiinnertag_scripts/update_sign.php?key={KEY}&game_id={ID6}");
Tag->SetAttribute("Key", "1234567890");
xmlDoc.InsertEndChild(Tag);
xmlDoc.SaveFile(fullpath);
xmlDoc.SaveFile(fullpath.c_str());
return true;
}

View File

@ -35,6 +35,8 @@
#include "utils/StringTools.h"
#include "svnrev.h"
using namespace tinyxml2;
#define VALID_CONFIG_REV 1084
CGameCategories GameCategories;
@ -70,14 +72,14 @@ bool CGameCategories::Load(string filepath)
clear();
TiXmlDocument xmlDoc(filepath.c_str());
if(!xmlDoc.LoadFile())
XMLDocument xmlDoc;
if(xmlDoc.LoadFile(filepath.c_str()) != 0)
return false;
if(!ValidVersion(xmlDoc.FirstChildElement("Revision")))
return false;
TiXmlElement * node = xmlDoc.FirstChildElement("Categories");
XMLElement * node = xmlDoc.FirstChildElement("Categories");
if(!node)
return false;
@ -104,7 +106,7 @@ bool CGameCategories::Load(string filepath)
{
const char * gameID = node->Attribute("ID");
TiXmlElement * category = node->FirstChildElement("Category");
XMLElement * category = node->FirstChildElement("Category");
while(category != NULL)
{
@ -135,13 +137,13 @@ bool CGameCategories::Save()
CreateSubfolder(filepath);
StartProgress(tr("Generating GXGameCategories.xml"), tr("Please wait..."), 0, false, true);
TiXmlDocument xmlDoc;
XMLDocument xmlDoc;
TiXmlDeclaration declaration("1.0", "UTF-8", "");
XMLDeclaration *declaration = xmlDoc.NewDeclaration();
xmlDoc.InsertEndChild(declaration);
TiXmlElement Revision("Revision");
TiXmlText revText(GetRev());
Revision.InsertEndChild(revText);
XMLElement *Revision = xmlDoc.NewElement("Revision");
XMLText *revText = xmlDoc.NewText(GetRev());
Revision->InsertEndChild(revText);
xmlDoc.InsertEndChild(Revision);
int progressSize = CategoryList.size() + List.size();
@ -151,14 +153,14 @@ bool CGameCategories::Save()
{
//! On LinkEndChild TinyXML owns and deletes the elements allocated here.
//! This is more memory efficient than making another copy of the elements.
TiXmlElement *Categories = new TiXmlElement("Categories");
XMLElement *Categories = xmlDoc.NewElement("Categories");
CategoryList.goToFirst();
do
{
ShowProgress(progress, progressSize);
TiXmlElement *Category = new TiXmlElement("Category");
XMLElement *Category = xmlDoc.NewElement("Category");
Category->SetAttribute("ID", fmt("%02i", CategoryList.getCurrentID()));
Category->SetAttribute("Name", CategoryList.getCurrentName().c_str());
@ -175,13 +177,13 @@ bool CGameCategories::Save()
{
//! On LinkEndChild TinyXML owns and deletes the elements allocated here.
//! This is more memory efficient than making another copy of the elements.
TiXmlElement *GameCategories = new TiXmlElement("GameCategories");
XMLElement *GameCategories = xmlDoc.NewElement("GameCategories");
for(map<string, vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
{
ShowProgress(progress, progressSize);
TiXmlElement *Game = new TiXmlElement("Game");
XMLElement *Game = xmlDoc.NewElement("Game");
Game->SetAttribute("ID", itr->first.c_str());
Game->SetAttribute("Title", GameTitles.GetTitle(itr->first.c_str()));
@ -191,7 +193,7 @@ bool CGameCategories::Save()
if(!CatName)
CatName = "";
TiXmlElement *Category = new TiXmlElement("Category");
XMLElement *Category = xmlDoc.NewElement("Category");
Category->SetAttribute("ID", fmt("%02i", itr->second[i]));
Category->SetAttribute("Name", CatName);
@ -207,13 +209,13 @@ bool CGameCategories::Save()
ShowProgress(tr("Writing GXGameCategories.xml"), tr("Please wait..."), 0, progressSize, progressSize, false, true);
xmlDoc.SaveFile(configPath);
xmlDoc.SaveFile(configPath.c_str());
ProgressStop();
return true;
}
bool CGameCategories::ValidVersion(TiXmlElement *revisionNode)
bool CGameCategories::ValidVersion(XMLElement *revisionNode)
{
if(!revisionNode) return false;

View File

@ -28,9 +28,11 @@
#include <map>
#include <string>
#include <vector>
#include "xml/tinyxml.h"
#include "xml/tinyxml2.h"
#include "CCategoryList.hpp"
using namespace tinyxml2;
class CGameCategories
{
public:
@ -56,7 +58,7 @@ class CGameCategories
CCategoryList CategoryList;
protected:
bool ValidVersion(TiXmlElement *xmlfile);
bool ValidVersion(XMLElement *xmlfile);
string configPath;
const vector<unsigned int> defaultCategory;

View File

@ -31,7 +31,9 @@
#include "network/networkops.h"
#include "Theme_List.h"
#include "xml/tinyxml.h"
#include "xml/tinyxml2.h"
using namespace tinyxml2;
Theme_List::Theme_List(const char * url)
{
@ -64,23 +66,23 @@ Theme_List::~Theme_List()
bool Theme_List::ParseXML(const char * xmlfile)
{
TiXmlDocument xmlDoc;
XMLDocument xmlDoc;
if(!xmlDoc.Parse(xmlfile))
return false;
TiXmlElement *themesNode = xmlDoc.FirstChildElement("themes");
XMLElement *themesNode = xmlDoc.FirstChildElement("themes");
if (!themesNode)
return false;
TiXmlElement *theme = themesNode->FirstChildElement("theme");
XMLElement *theme = themesNode->FirstChildElement("theme");
while(theme)
{
int i = ThemesList.size();
ThemesList.resize(i+1);
TiXmlElement *node = NULL;
XMLElement *node = NULL;
node = theme->FirstChildElement("name");
if(node && node->FirstChild() && node->FirstChild()->Value())

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2536
source/xml/tinyxml2.cpp Normal file

File diff suppressed because it is too large Load Diff

2170
source/xml/tinyxml2.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,52 +0,0 @@
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "tinyxml.h"
// The goal of the seperate error file is to make the first
// step towards localization. tinyxml (currently) only supports
// english error messages, but the could now be translated.
//
// It also cleans up the code a bit.
//
const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
{
"No error",
"Error",
"Failed to open file",
"Error parsing Element.",
"Failed to read Element name",
"Error reading Element value.",
"Error reading Attributes.",
"Error: empty tag.",
"Error reading end tag.",
"Error parsing Unknown.",
"Error parsing Comment.",
"Error parsing Declaration.",
"Error document empty.",
"Error null (0) or unexpected EOF found in input stream.",
"Error parsing CDATA.",
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
};

File diff suppressed because it is too large Load Diff