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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2008 by Eran Ifrah
// file name : archive.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef ARCHIVE_H
#define ARCHIVE_H
#include "wx/string.h"
#include "wx/hashmap.h"
#include <wx/arrstr.h>
#include "wx/filename.h"
#if wxUSE_GUI
#include <wx/gdicmn.h>
#include <wx/font.h>
#endif
#include <vector>
#include <map>
#include <set>
#include "codelite_exports.h"
#include "macros.h"
class wxXmlNode;
class SerializedObject;
class TabInfo;
class clDebuggerBreakpoint;
WX_DECLARE_STRING_HASH_MAP(wxString, StringMap);
/**
* \class Archive
* \brief an auxulariy class which serializes variables into XML format
* \author Eran
* \date 07/20/07
*/
class WXDLLIMPEXP_CL Archive
{
wxXmlNode* m_root;
public:
Archive();
virtual ~Archive();
/**
* \brief set a root node for this Archive object, all Write operations will append their nodes
* to this node
* \param node wxXmlNode to act as the root
*/
void SetXmlNode(wxXmlNode* node);
//--------------------
// Write API
//--------------------
bool Write(const wxString& name, SerializedObject* obj);
bool Write(const wxString& name, int value);
bool Write(const wxString& name, bool value);
bool Write(const wxString& name, long value);
bool Write(const wxString& name, const wxString& str);
bool Write(const wxString& name, const wxArrayString& arr);
bool Write(const wxString& name, const wxFileName& fileName);
bool Write(const wxString& name, size_t value);
#if wxUSE_GUI
bool Write(const wxString& name, wxSize size);
bool Write(const wxString& name, wxPoint pt);
bool Write(const wxString& name, const wxFont& font);
bool Write(const wxString& name, const wxColour& colour);
#endif
bool Write(const wxString& name, const StringMap& str_map);
bool Write(const wxString& name, std::vector<TabInfo>& _vTabInfoArr);
bool Write(const wxString& name, std::vector<int>& _vInt);
bool Write(const wxString& name, const wxStringMap_t& strinMap);
bool Write(const wxString& name, const wxStringSet_t& s);
bool WriteCData(const wxString& name, const wxString& value);
//--------------------
// Read API
//--------------------
bool Read(const wxString& name, int& value);
bool Read(const wxString& name, bool& value);
bool Read(const wxString& name, long& value);
bool Read(const wxString& name, wxString& value);
bool Read(const wxString& name, wxArrayString& arr);
bool Read(const wxString& name, wxFileName& fileName);
bool Read(const wxString& name, size_t& value);
#if wxUSE_GUI
bool Read(const wxString& name, wxPoint& pt);
bool Read(const wxString& name, wxSize& size);
bool Read(const wxString& name, wxColour& colour);
bool Read(const wxString& name, wxFont& font, const wxFont& defaultFont = wxNullFont);
#endif
bool Read(const wxString& name, StringMap& str_map);
bool Read(const wxString& name, SerializedObject* obj);
bool Read(const wxString& name, std::vector<TabInfo>& _vTabInfoArr);
bool Read(const wxString& name, std::vector<int>& _vInt);
bool Read(const wxString& name, wxStringMap_t& strinMap);
bool Read(const wxString& name, wxStringSet_t& s);
bool ReadCData(const wxString& name, wxString& value);
private:
bool WriteSimple(long value, const wxString& typeName, const wxString& name);
bool ReadSimple(long& value, const wxString& typeName, const wxString& name);
};
#endif // ARCHIVE_H
|