summaryrefslogtreecommitdiff
path: root/lib/xml_base.h
blob: ceaf609b34f484c14bd015660f12688e6bc0d569 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// **************************************************************************
// * 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        *
// **************************************************************************

#ifndef XMLBASE_H_INCLUDED
#define XMLBASE_H_INCLUDED

#include <zenxml/xml.h>
#include <zen/zstring.h>
#include <zen/file_error.h>

//bind zenxml and zen file handling together

namespace xmlAccess
{
class FfsXmlError //Exception class
{
public:
    enum Severity
    {
        WARNING = 77,
        FATAL
    };

    explicit FfsXmlError(const std::wstring& message, Severity sev = FATAL) : errorMessage(message), m_severity(sev) {}

    const std::wstring& toString() const { return errorMessage; }
    Severity getSeverity() const { return m_severity; }
private:
    const std::wstring errorMessage;
    const Severity m_severity;
};

void saveXmlDocument(const zen::XmlDoc& doc, const Zstring& filename); //throw FfsXmlError
void loadXmlDocument(const Zstring& filename, zen::XmlDoc& doc); //throw FfsXmlError

const std::wstring getErrorMessageFormatted(const std::vector<std::wstring>& failedElements);
}

#endif // XMLBASE_H_INCLUDED
bgstack15