1
//////////////////////////////////////////////////////////////////////////////
2
//////////////////////////////////////////////////////////////////////////////
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : archive.h
7
// -------------------------------------------------------------------------
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
23
//////////////////////////////////////////////////////////////////////////////
24
//////////////////////////////////////////////////////////////////////////////
28
#include "wx/string.h"
29
#include "wx/hashmap.h"
30
#include <wx/arrstr.h>
31
#include "wx/filename.h"
32
#include <wx/gdicmn.h>
38
#ifndef WXDLLIMPEXP_CL
39
#ifdef WXMAKINGDLL_CODELITE
40
# define WXDLLIMPEXP_CL WXEXPORT
41
#elif defined(WXUSINGDLL_CODELITE)
42
# define WXDLLIMPEXP_CL WXIMPORT
43
#else /* not making nor using FNB as DLL */
44
# define WXDLLIMPEXP_CL
45
#endif // WXMAKINGDLL_CODELITE
46
#endif // WXDLLIMPEXP_CL
48
class SerializedObject;
51
WX_DECLARE_STRING_HASH_MAP( wxString, StringMap );
55
* \brief an auxulariy class which serializes variables into XML format
59
class WXDLLIMPEXP_CL Archive
68
* \brief set a root node for this Archive object, all Write operations will append their nodes
70
* \param node wxXmlNode to act as the root
72
void SetXmlNode(wxXmlNode *node);
74
//--------------------
76
//--------------------
77
bool Write(const wxString &name, SerializedObject *obj);
78
bool Write(const wxString &name, int value);
79
bool Write(const wxString &name, bool value);
80
bool Write(const wxString &name, long value);
81
bool Write(const wxString &name, const wxString &str);
82
bool Write(const wxString &name, const wxArrayString &arr);
83
bool Write(const wxString &name, const wxFileName &fileName);
84
bool Write(const wxString &name, size_t value);
85
bool Write(const wxString &name, wxSize size);
86
bool Write(const wxString &name, wxPoint pt);
87
bool Write(const wxString &name, const StringMap &str_map);
88
bool Write(const wxString &name, const wxColour &colour);
89
bool Write(const wxString &name, std::vector<TabInfo>& _vTabInfoArr);
90
bool Write(const wxString &name, const std::map<wxString, wxString> &strinMap);
92
//--------------------
94
//--------------------
95
bool Read(const wxString &name, int &value);
96
bool Read(const wxString &name, bool &value);
97
bool Read(const wxString &name, long &value);
98
bool Read(const wxString &name, wxString &value);
99
bool Read(const wxString &name, wxArrayString &arr);
100
bool Read(const wxString &name, wxFileName &fileName);
101
bool Read(const wxString &name, size_t &value);
102
bool Read(const wxString &name, wxSize &size);
103
bool Read(const wxString &name, wxPoint &pt);
104
bool Read(const wxString &name, StringMap &str_map);
105
bool Read(const wxString &name, SerializedObject *obj);
106
bool Read(const wxString &name, wxColour &colour);
107
bool Read(const wxString &name, std::vector<TabInfo>& _vTabInfoArr);
108
bool Read(const wxString &name, std::map<wxString, wxString> &strinMap);
111
bool WriteSimple(long value, const wxString &typeName, const wxString &name);
112
bool ReadSimple(long &value, const wxString &typeName, const wxString &name);
1
//////////////////////////////////////////////////////////////////////////////
2
//////////////////////////////////////////////////////////////////////////////
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : archive.h
7
// -------------------------------------------------------------------------
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
23
//////////////////////////////////////////////////////////////////////////////
24
//////////////////////////////////////////////////////////////////////////////
28
#include "wx/string.h"
29
#include "wx/hashmap.h"
30
#include <wx/arrstr.h>
31
#include "wx/filename.h"
32
#include <wx/gdicmn.h>
38
#ifndef WXDLLIMPEXP_CL
39
#ifdef WXMAKINGDLL_CODELITE
40
# define WXDLLIMPEXP_CL WXEXPORT
41
#elif defined(WXUSINGDLL_CODELITE)
42
# define WXDLLIMPEXP_CL WXIMPORT
43
#else /* not making nor using FNB as DLL */
44
# define WXDLLIMPEXP_CL
45
#endif // WXMAKINGDLL_CODELITE
46
#endif // WXDLLIMPEXP_CL
48
class SerializedObject;
52
WX_DECLARE_STRING_HASH_MAP( wxString, StringMap );
56
* \brief an auxulariy class which serializes variables into XML format
60
class WXDLLIMPEXP_CL Archive
69
* \brief set a root node for this Archive object, all Write operations will append their nodes
71
* \param node wxXmlNode to act as the root
73
void SetXmlNode(wxXmlNode *node);
75
//--------------------
77
//--------------------
78
bool Write(const wxString &name, SerializedObject *obj);
79
bool Write(const wxString &name, int value);
80
bool Write(const wxString &name, bool value);
81
bool Write(const wxString &name, long value);
82
bool Write(const wxString &name, const wxString &str);
83
bool Write(const wxString &name, const wxArrayString &arr);
84
bool Write(const wxString &name, const wxFileName &fileName);
85
bool Write(const wxString &name, size_t value);
86
bool Write(const wxString &name, wxSize size);
87
bool Write(const wxString &name, wxPoint pt);
88
bool Write(const wxString &name, const StringMap &str_map);
89
bool Write(const wxString &name, const wxColour &colour);
90
bool Write(const wxString &name, std::vector<TabInfo>& _vTabInfoArr);
91
bool Write(const wxString &name, const std::map<wxString, wxString> &strinMap);
94
//--------------------
96
//--------------------
97
bool Read(const wxString &name, int &value);
98
bool Read(const wxString &name, bool &value);
99
bool Read(const wxString &name, long &value);
100
bool Read(const wxString &name, wxString &value);
101
bool Read(const wxString &name, wxArrayString &arr);
102
bool Read(const wxString &name, wxFileName &fileName);
103
bool Read(const wxString &name, size_t &value);
104
bool Read(const wxString &name, wxSize &size);
105
bool Read(const wxString &name, wxPoint &pt);
106
bool Read(const wxString &name, StringMap &str_map);
107
bool Read(const wxString &name, SerializedObject *obj);
108
bool Read(const wxString &name, wxColour &colour);
109
bool Read(const wxString &name, std::vector<TabInfo>& _vTabInfoArr);
110
bool Read(const wxString &name, std::map<wxString, wxString> &strinMap);
113
bool WriteSimple(long value, const wxString &typeName, const wxString &name);
114
bool ReadSimple(long &value, const wxString &typeName, const wxString &name);