diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-07 20:38:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-24 00:08:35 +0300 |
commit | d1590377de1141144d59ca1160de2822177f6f2a (patch) | |
tree | a368b251dedc7164cadbfe459de4cf5c983acf98 /src/configuration.cpp | |
parent | 65422e722cfe0616c65498c71aa0651857dcc49a (diff) | |
download | manaplus-d1590377de1141144d59ca1160de2822177f6f2a.tar.gz manaplus-d1590377de1141144d59ca1160de2822177f6f2a.tar.bz2 manaplus-d1590377de1141144d59ca1160de2822177f6f2a.tar.xz manaplus-d1590377de1141144d59ca1160de2822177f6f2a.zip |
Add support for tinyxml2 for reading / writing xml files.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r-- | src/configuration.cpp | 14 |
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") } |