Debian Codegraph @

CodeLite/archive.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2008 by Eran Ifrah
5 // file name : archive.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
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.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25 #ifndef ARCHIVE_H
26 #define ARCHIVE_H
27
28 #include "wx/string.h"
29 #include "wx/hashmap.h"
30 #include <wx/arrstr.h>
31 #include "wx/filename.h"
32 #if wxUSE_GUI
33 #include <wx/gdicmn.h>
34 #include <wx/font.h>
35 #endif
36 #include <vector>
37 #include <map>
38 #include <set>
39 #include "codelite_exports.h"
40 #include "macros.h"
41
42 class wxXmlNode;
43 class SerializedObject;
44 class TabInfo;
45 class clDebuggerBreakpoint;
46
47 WX_DECLARE_STRING_HASH_MAP(wxString, StringMap);
48
49 /**
50 * \class Archive
51 * \brief an auxulariy class which serializes variables into XML format
52 * \author Eran
53 * \date 07/20/07
54 */
55 class WXDLLIMPEXP_CL Archive
56 {
57 wxXmlNode* m_root;
58
59 public:
60 Archive();
61 virtual ~Archive();
62
63 /**
64 * \brief set a root node for this Archive object, all Write operations will append their nodes
65 * to this node
66 * \param node wxXmlNode to act as the root
67 */
68 void SetXmlNode(wxXmlNode* node);
69
70 //--------------------
71 // Write API
72 //--------------------
73 bool Write(const wxString& name, SerializedObject* obj);
74 bool Write(const wxString& name, int value);
75 bool Write(const wxString& name, bool value);
76 bool Write(const wxString& name, long value);
77 bool Write(const wxString& name, const wxString& str);
78 bool Write(const wxString& name, const wxArrayString& arr);
79 bool Write(const wxString& name, const wxFileName& fileName);
80 bool Write(const wxString& name, size_t value);
81 #if wxUSE_GUI
82 bool Write(const wxString& name, wxSize size);
83 bool Write(const wxString& name, wxPoint pt);
84 bool Write(const wxString& name, const wxFont& font);
85 bool Write(const wxString& name, const wxColour& colour);
86 #endif
87 bool Write(const wxString& name, const StringMap& str_map);
88 bool Write(const wxString& name, std::vector<TabInfo>& _vTabInfoArr);
89 bool Write(const wxString& name, std::vector<int>& _vInt);
90 bool Write(const wxString& name, const wxStringMap_t& strinMap);
91 bool Write(const wxString& name, const wxStringSet_t& s);
92 bool WriteCData(const wxString& name, const wxString& value);
93
94 //--------------------
95 // Read API
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 #if wxUSE_GUI
105 bool Read(const wxString& name, wxPoint& pt);
106 bool Read(const wxString& name, wxSize& size);
107 bool Read(const wxString& name, wxColour& colour);
108 bool Read(const wxString& name, wxFont& font, const wxFont& defaultFont = wxNullFont);
109 #endif
110 bool Read(const wxString& name, StringMap& str_map);
111 bool Read(const wxString& name, SerializedObject* obj);
112 bool Read(const wxString& name, std::vector<TabInfo>& _vTabInfoArr);
113 bool Read(const wxString& name, std::vector<int>& _vInt);
114 bool Read(const wxString& name, wxStringMap_t& strinMap);
115 bool Read(const wxString& name, wxStringSet_t& s);
116 bool ReadCData(const wxString& name, wxString& value);
117
118 private:
119 bool WriteSimple(long value, const wxString& typeName, const wxString& name);
120 bool ReadSimple(long& value, const wxString& typeName, const wxString& name);
121 };
122
123 #endif // ARCHIVE_H