summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-12 01:02:51 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-12 01:02:51 +0300
commit07c62ac076c698cb7d6a4f8ceed616d982421f14 (patch)
treefe5b5b2115f1287608dd6c6a0850d36fd7760c12
parentd5a00a320043f5782ebc489285c89943b667e094 (diff)
downloadplus-07c62ac076c698cb7d6a4f8ceed616d982421f14.tar.gz
plus-07c62ac076c698cb7d6a4f8ceed616d982421f14.tar.bz2
plus-07c62ac076c698cb7d6a4f8ceed616d982421f14.tar.xz
plus-07c62ac076c698cb7d6a4f8ceed616d982421f14.zip
Add skipError parameter into xmlutils.
-rw-r--r--src/resources/db/badgesdb.cpp12
-rw-r--r--src/resources/db/weaponsdb.cpp6
-rw-r--r--src/utils/xmlutils.cpp30
-rw-r--r--src/utils/xmlutils.h8
4 files changed, 38 insertions, 18 deletions
diff --git a/src/resources/db/badgesdb.cpp b/src/resources/db/badgesdb.cpp
index 059a22112..6ee66f180 100644
--- a/src/resources/db/badgesdb.cpp
+++ b/src/resources/db/badgesdb.cpp
@@ -37,7 +37,8 @@ namespace
static void loadXmlFile(const std::string &file,
const std::string &name,
- BadgesInfos &arr)
+ BadgesInfos &arr,
+ const SkipError skipError)
{
readXmlStringMap(file,
"badges",
@@ -45,21 +46,22 @@ static void loadXmlFile(const std::string &file,
"badge",
"name",
"image",
- arr);
+ arr,
+ skipError);
}
static void loadDB(const std::string &name, BadgesInfos &arr)
{
loadXmlFile(paths.getStringValue("badgesFile"),
- name, arr);
+ name, arr, SkipError_false);
loadXmlFile(paths.getStringValue("badgesPatchFile"),
- name, arr);
+ name, arr, SkipError_true);
StringVect listVect;
Files::getFilesInDir(paths.getStringValue(
"badgesPatchDir"), listVect, ".xml");
FOR_EACH (StringVectCIter, itVect, listVect)
- loadXmlFile(*itVect, name, arr);
+ loadXmlFile(*itVect, name, arr, SkipError_true);
}
void BadgesDB::load()
diff --git a/src/resources/db/weaponsdb.cpp b/src/resources/db/weaponsdb.cpp
index 3b7860ffd..475b5970e 100644
--- a/src/resources/db/weaponsdb.cpp
+++ b/src/resources/db/weaponsdb.cpp
@@ -34,14 +34,16 @@ namespace
bool mLoaded = false;
}
-static void loadDB(const std::string &name, WeaponsInfos &arr)
+static void loadDB(const std::string &name,
+ WeaponsInfos &arr)
{
readXmlIntVector(paths.getStringValue("weaponsFile"),
"weapons",
name,
"item",
"id",
- arr);
+ arr,
+ SkipError_false);
}
void WeaponsDB::load()
diff --git a/src/utils/xmlutils.cpp b/src/utils/xmlutils.cpp
index 001e46919..fdcc272ec 100644
--- a/src/utils/xmlutils.cpp
+++ b/src/utils/xmlutils.cpp
@@ -31,10 +31,11 @@ void readXmlIntVector(const std::string &fileName,
const std::string &sectionName,
const std::string &itemName,
const std::string &attributeName,
- std::vector<int> &arr)
+ std::vector<int> &arr,
+ const SkipError skipError)
{
arr.clear();
- XML::Document doc(fileName, UseResman_true, SkipError_false);
+ XML::Document doc(fileName, UseResman_true, skipError);
const XmlNodePtrConst rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, rootName.c_str()))
@@ -63,8 +64,13 @@ void readXmlIntVector(const std::string &fileName,
childNode, "name", "");
if (!name.empty())
{
- readXmlIntVector(name, rootName, sectionName, itemName,
- attributeName, arr);
+ readXmlIntVector(name,
+ rootName,
+ sectionName,
+ itemName,
+ attributeName,
+ arr,
+ skipError);
}
}
}
@@ -77,9 +83,10 @@ void readXmlStringMap(const std::string &fileName,
const std::string &itemName,
const std::string &attributeKeyName,
const std::string &attributeValueName,
- std::map<std::string, std::string> &arr)
+ std::map<std::string, std::string> &arr,
+ const SkipError skipError)
{
- XML::Document doc(fileName, UseResman_true, SkipError_false);
+ XML::Document doc(fileName, UseResman_true, skipError);
const XmlNodePtrConst rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, rootName.c_str()))
@@ -110,9 +117,14 @@ void readXmlStringMap(const std::string &fileName,
childNode, "name", "");
if (!name.empty())
{
- readXmlStringMap(name, rootName, sectionName, itemName,
- attributeKeyName, attributeValueName,
- arr);
+ readXmlStringMap(name,
+ rootName,
+ sectionName,
+ itemName,
+ attributeKeyName,
+ attributeValueName,
+ arr,
+ skipError);
}
}
}
diff --git a/src/utils/xmlutils.h b/src/utils/xmlutils.h
index 95ae1e562..928519267 100644
--- a/src/utils/xmlutils.h
+++ b/src/utils/xmlutils.h
@@ -21,6 +21,8 @@
#ifndef UTILS_XMLUTILS_H
#define UTILS_XMLUTILS_H
+#include "enums/simpletypes/skiperror.h"
+
#include <string>
#include <map>
#include <vector>
@@ -30,7 +32,8 @@ void readXmlIntVector(const std::string &fileName,
const std::string &sectionName,
const std::string &itemName,
const std::string &attributeName,
- std::vector<int> &arr);
+ std::vector<int> &arr,
+ const SkipError skipError);
void readXmlStringMap(const std::string &fileName,
const std::string &rootName,
@@ -38,6 +41,7 @@ void readXmlStringMap(const std::string &fileName,
const std::string &itemName,
const std::string &attributeKeyName,
const std::string &attributeValueName,
- std::map<std::string, std::string> &arr);
+ std::map<std::string, std::string> &arr,
+ const SkipError skipError);
#endif // UTILS_XMLUTILS_H