summaryrefslogtreecommitdiff
path: root/src/configuration.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-07 20:38:10 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-24 00:08:35 +0300
commitd1590377de1141144d59ca1160de2822177f6f2a (patch)
treea368b251dedc7164cadbfe459de4cf5c983acf98 /src/configuration.cpp
parent65422e722cfe0616c65498c71aa0651857dcc49a (diff)
downloadplus-d1590377de1141144d59ca1160de2822177f6f2a.tar.gz
plus-d1590377de1141144d59ca1160de2822177f6f2a.tar.bz2
plus-d1590377de1141144d59ca1160de2822177f6f2a.tar.xz
plus-d1590377de1141144d59ca1160de2822177f6f2a.zip
Add support for tinyxml2 for reading / writing xml files.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r--src/configuration.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 40d701e76..cabd2ddfa 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -703,7 +703,7 @@ bool Configuration::resetBoolValue(const std::string &key)
}
-void ConfigurationObject::initFromXML(const XmlNodePtrConst parentNode)
+void ConfigurationObject::initFromXML(XmlNodeConstPtrConst parentNode)
{
clear();
@@ -773,7 +773,7 @@ void Configuration::init(const std::string &filename,
return;
}
- const XmlNodePtrConst rootNode = doc.rootNode();
+ XmlNodeConstPtrConst rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "configuration"))
{
@@ -793,7 +793,7 @@ void Configuration::reInit()
return;
}
- const XmlNodePtrConst rootNode = doc.rootNode();
+ XmlNodeConstPtrConst rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "configuration"))
{
@@ -804,7 +804,7 @@ void Configuration::reInit()
initFromXML(rootNode);
}
-void ConfigurationObject::writeToXML(const XmlTextWriterPtr writer)
+void ConfigurationObject::writeToXML(XmlTextWriterPtr writer A_UNUSED)
{
FOR_EACH (Options::const_iterator, i, mOptions)
{
@@ -874,7 +874,7 @@ void Configuration::write()
fclose(testFile);
}
- const XmlTextWriterPtr writer = XmlNewTextWriterFilename(
+ XmlTextWriterPtr writer = XmlNewTextWriterFilename(
mConfigPath.c_str(), 0);
if (!writer)
@@ -889,11 +889,13 @@ void Configuration::write()
XmlTextWriterSetIndent(writer, 1);
XmlTextWriterStartDocument(writer, nullptr, nullptr, nullptr);
// xmlTextWriterStartDocument(writer, nullptr, "utf8", nullptr);
- XmlTextWriterStartElement(writer, "configuration");
+ XmlTextWriterStartRootElement(writer, "configuration");
writeToXML(writer);
XmlTextWriterEndDocument(writer);
+ XmlSaveTextWriterFilename(writer,
+ mConfigPath.c_str());
XmlFreeTextWriter(writer);
BLOCK_END("Configuration::write")
}