| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2008 by Eran Ifrah |
| 5 |
// file name : serialized_object.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 SERIALIZED_OBJECT_H |
| 26 |
#define SERIALIZED_OBJECT_H |
| 27 |
|
| 28 |
#include "archive.h" |
| 29 |
|
| 30 |
/** |
| 31 |
* \class SerializedObject |
| 32 |
* \brief an interface to the serialized object, every class who whishes to be |
| 33 |
* serialized and to be read/write from an xml file, must implement this interface |
| 34 |
* \author Eran |
| 35 |
* \date 07/20/07 |
| 36 |
*/ |
| 37 |
class SerializedObject |
| 38 |
{ |
| 39 |
wxString m_version; |
| 40 |
|
| 41 |
public: |
| 42 |
SerializedObject() {} |
| 43 |
virtual ~SerializedObject() {} |
| 44 |
virtual void Serialize(Archive &arch) = 0; |
| 45 |
virtual void DeSerialize(Archive &arch) = 0; |
| 46 |
|
| 47 |
virtual void SetVersion(const wxString& version) { |
| 48 |
this->m_version = version; |
| 49 |
} |
| 50 |
virtual const wxString& GetVersion() const { |
| 51 |
return m_version; |
| 52 |
} |
| 53 |
}; |
| 54 |
|
| 55 |
|
| 56 |
class WXDLLIMPEXP_CL TabInfo : public SerializedObject |
| 57 |
{ |
| 58 |
wxString m_fileName; |
| 59 |
int m_firstVisibleLine; |
| 60 |
int m_currentLine; |
| 61 |
wxArrayString m_bookmarks; |
| 62 |
std::vector<int> m_folds; |
| 63 |
public: |
| 64 |
// setters |
| 65 |
void SetFileName(const wxString& _fileName) { |
| 66 |
this->m_fileName = _fileName; |
| 67 |
} |
| 68 |
void SetFirstVisibleLine(const int& _firstVisibleLine) { |
| 69 |
this->m_firstVisibleLine = _firstVisibleLine; |
| 70 |
} |
| 71 |
void SetCurrentLine(const int& _currentLine) { |
| 72 |
this->m_currentLine = _currentLine; |
| 73 |
} |
| 74 |
void SetBookmarks(const wxArrayString& _bookmarks) { |
| 75 |
this->m_bookmarks = _bookmarks; |
| 76 |
} |
| 77 |
void SetCollapsedFolds(const std::vector<int>& folds) { |
| 78 |
m_folds = folds; |
| 79 |
} |
| 80 |
//getters |
| 81 |
const wxString& GetFileName() const { |
| 82 |
return this->m_fileName; |
| 83 |
} |
| 84 |
const int& GetFirstVisibleLine() const { |
| 85 |
return this->m_firstVisibleLine; |
| 86 |
} |
| 87 |
const int& GetCurrentLine() const { |
| 88 |
return this->m_currentLine; |
| 89 |
} |
| 90 |
const wxArrayString& GetBookmarks() const { |
| 91 |
return this->m_bookmarks; |
| 92 |
} |
| 93 |
const std::vector<int>& GetCollapsedFolds() const { |
| 94 |
return m_folds; |
| 95 |
} |
| 96 |
|
| 97 |
TabInfo(); |
| 98 |
virtual ~TabInfo(); |
| 99 |
|
| 100 |
void Serialize(Archive &arch); |
| 101 |
void DeSerialize(Archive &arch); |
| 102 |
}; |
| 103 |
|
| 104 |
|
| 105 |
#endif //SERIALIZED_OBJECT_H |