diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:29:28 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:29:28 +0200 |
commit | 75c07011b7c4d06acd7b45dabdcd60ab9d80f385 (patch) | |
tree | 8853c3978dd152ef377e652239448b1352320206 /RealtimeSync/xml_proc.cpp | |
parent | 5.22 (diff) | |
download | FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.gz FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.bz2 FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.zip |
5.23
Diffstat (limited to 'RealtimeSync/xml_proc.cpp')
-rw-r--r-- | RealtimeSync/xml_proc.cpp | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/RealtimeSync/xml_proc.cpp b/RealtimeSync/xml_proc.cpp deleted file mode 100644 index db235ecb..00000000 --- a/RealtimeSync/xml_proc.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// ************************************************************************** - -#include "xml_proc.h" -#include <wx/filefn.h> -#include <zen/file_handling.h> -#include <wx+/string_conv.h> - -using namespace zen; -using namespace xmlAccess; - - -namespace -{ -void readConfig(const XmlIn& in, XmlRealConfig& config) -{ - in["Directories"](config.directories); - in["Delay" ](config.delay); - in["Commandline"](config.commandline); -} - - -bool isXmlTypeRTS(const XmlDoc& doc) //throw() -{ - if (doc.root().getNameAs<std::string>() == "FreeFileSync") - { - std::string type; - if (doc.root().getAttribute("XmlType", type)) - return type == "REAL"; - } - return false; -} -} - - -void xmlAccess::readRealConfig(const Zstring& filename, XmlRealConfig& config) -{ - XmlDoc doc = loadXmlDocument(filename); //throw FfsXmlError - - if (!isXmlTypeRTS(doc)) - throw FfsXmlError(replaceCpy(_("File %x does not contain a valid configuration."), L"%x", fmtFileName(filename))); - - XmlIn in(doc); - ::readConfig(in, config); - - if (in.errorsOccured()) - throw FfsXmlError(replaceCpy(_("Configuration file %x loaded partially only."), L"%x", fmtFileName(filename)) + L"\n\n" + - getErrorMessageFormatted(in.getErrorsAs<std::wstring>()), FfsXmlError::WARNING); -} - - -namespace -{ -void writeConfig(const XmlRealConfig& config, XmlOut& out) -{ - out["Directories"](config.directories); - out["Delay" ](config.delay); - out["Commandline"](config.commandline); -} -} - - -void xmlAccess::writeRealConfig(const XmlRealConfig& config, const Zstring& filename) -{ - XmlDoc doc("FreeFileSync"); - doc.root().setAttribute("XmlType", "REAL"); - - XmlOut out(doc); - writeConfig(config, out); - - saveXmlDocument(doc, filename); //throw FfsXmlError -} |