Line | |
---|
1 | /*! |
---|
2 | * @file gui_saveable.h |
---|
3 | * @brief Definition of ... |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _GUI_SAVEABLE_H |
---|
7 | #define _GUI_SAVEABLE_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | #include "lib/util/multi_type.h" |
---|
11 | #include <vector> |
---|
12 | |
---|
13 | // FORWARD DECLARATION |
---|
14 | namespace OrxGui |
---|
15 | { |
---|
16 | class Gui; |
---|
17 | |
---|
18 | //! A class for ... |
---|
19 | class Saveable : public BaseObject |
---|
20 | { |
---|
21 | public: |
---|
22 | virtual ~Saveable(); |
---|
23 | |
---|
24 | void makeSaveable(); |
---|
25 | |
---|
26 | virtual void load(const MultiType& value) {}; |
---|
27 | virtual const MultiType& save() {}; |
---|
28 | |
---|
29 | MultiType& value() { return this->_value; }; |
---|
30 | const MultiType& value() const { return this->_value; }; |
---|
31 | bool isSaveable() const { return this->bSaveable; }; |
---|
32 | |
---|
33 | protected: |
---|
34 | Saveable(const std::string& optionName); |
---|
35 | virtual void makingElementSaveable() {}; |
---|
36 | |
---|
37 | private: |
---|
38 | MultiType _value; |
---|
39 | bool bSaveable; |
---|
40 | }; |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | class SaveableGroup : public Saveable |
---|
45 | { |
---|
46 | public: |
---|
47 | virtual ~SaveableGroup(); |
---|
48 | |
---|
49 | void addSaveable(Saveable* saveable); |
---|
50 | void removeSaveable(Saveable* saveable); |
---|
51 | |
---|
52 | virtual void load(const MultiType& value); |
---|
53 | virtual const MultiType& save(); |
---|
54 | |
---|
55 | protected: |
---|
56 | SaveableGroup(const std::string& name, OrxGui::Gui* gui); |
---|
57 | virtual void makingElementSaveable(); |
---|
58 | |
---|
59 | private: |
---|
60 | std::vector<Saveable*> saveables; |
---|
61 | static std::vector<SaveableGroup*> saveableGroups; |
---|
62 | }; |
---|
63 | |
---|
64 | } |
---|
65 | #endif /* _GUI_SAVEABLE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.