summaryrefslogtreecommitdiff
path: root/library/processXml.h
blob: e359e7b04c98d28962b8cca659d854d7cde400eb (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef PROCESSXML_H_INCLUDED
#define PROCESSXML_H_INCLUDED

#include "../FreeFileSync.h"
#include "tinyxml/tinyxml.h"
#include <wx/intl.h>

using namespace FreeFileSync;


namespace xmlAccess
{
    enum XmlType
    {
        XML_GUI_CONFIG,
        XML_BATCH_CONFIG,
        XML_GLOBAL_SETTINGS,
        XML_OTHER
    };

    XmlType getXmlType(const wxString& filename);


    struct XmlGuiConfig
    {
        XmlGuiConfig() : hideFilteredElements(false) {} //initialize values

        MainConfiguration mainCfg;
        vector<FolderPair> directoryPairs;

        bool hideFilteredElements;
    };


    struct XmlBatchConfig
    {
        XmlBatchConfig() :  silent(false) {}

        MainConfiguration mainCfg;
        vector<FolderPair> directoryPairs;

        bool silent;
    };


    struct XmlGlobalSettings
    {
        struct _Global
        {
            _Global() :
                    programLanguage(wxLocale::GetSystemLanguage()),
#ifdef FFS_WIN
                    dstCheckActive(true),
#endif
                    folderDependCheckActive(true) {}

            int programLanguage;
#ifdef FFS_WIN
            bool dstCheckActive;
#endif
            bool folderDependCheckActive;
        } global;

        struct _Gui
        {
            _Gui() :
                    widthNotMaximized(wxDefaultCoord),
                    heightNotMaximized(wxDefaultCoord),
                    posXNotMaximized(wxDefaultCoord),
                    posYNotMaximized(wxDefaultCoord),
                    isMaximized(false) {}

            int widthNotMaximized;
            int heightNotMaximized;
            int posXNotMaximized;
            int posYNotMaximized;
            bool isMaximized;
            vector<int> columnWidthLeft;
            vector<int> columnWidthRight;
        } gui;

        //struct _Batch
    };


    XmlGuiConfig readGuiConfig(const wxString& filename);
    XmlBatchConfig readBatchConfig(const wxString& filename);
    XmlGlobalSettings readGlobalSettings();   //used for both GUI and batch mode, independent from configuration instance

    void writeGuiConfig(const wxString& filename, const XmlGuiConfig& inputCfg);
    void writeBatchConfig(const wxString& filename, const XmlBatchConfig& inputCfg);
    void writeGlobalSettings(const XmlGlobalSettings& inputCfg);

}


#endif // PROCESSXML_H_INCLUDED
bgstack15