| 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 "multi_type.h" |
|---|
| 11 | #include <vector> |
|---|
| 12 | |
|---|
| 13 | // FORWARD DECLARATION |
|---|
| 14 | namespace OrxGui |
|---|
| 15 | { |
|---|
| 16 | //! A class for ... |
|---|
| 17 | class Saveable : public BaseObject |
|---|
| 18 | { |
|---|
| 19 | public: |
|---|
| 20 | virtual ~Saveable(); |
|---|
| 21 | |
|---|
| 22 | void makeSaveable(); |
|---|
| 23 | |
|---|
| 24 | virtual void load(const MultiType& value) = 0; |
|---|
| 25 | virtual const MultiType& save() = 0; |
|---|
| 26 | |
|---|
| 27 | MultiType& getValue() { return this->value; }; |
|---|
| 28 | const MultiType& getValue() const { return this->value; }; |
|---|
| 29 | bool isSaveable() const { return this->bSaveable; }; |
|---|
| 30 | |
|---|
| 31 | protected: |
|---|
| 32 | Saveable(const std::string& optionName); |
|---|
| 33 | virtual void makingElementSaveable() {}; |
|---|
| 34 | |
|---|
| 35 | private: |
|---|
| 36 | MultiType value; |
|---|
| 37 | bool bSaveable; |
|---|
| 38 | }; |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | class SaveableGroup : public Saveable |
|---|
| 43 | { |
|---|
| 44 | public: |
|---|
| 45 | virtual ~SaveableGroup(); |
|---|
| 46 | |
|---|
| 47 | void addSaveable(Saveable* saveable); |
|---|
| 48 | void removeSaveable(Saveable* saveable); |
|---|
| 49 | |
|---|
| 50 | protected: |
|---|
| 51 | SaveableGroup(const std::string& name); |
|---|
| 52 | virtual void makingElementSaveable(); |
|---|
| 53 | |
|---|
| 54 | private: |
|---|
| 55 | std::vector<Saveable*> saveables; |
|---|
| 56 | static std::vector<SaveableGroup*> saveableGroups; |
|---|
| 57 | }; |
|---|
| 58 | |
|---|
| 59 | } |
|---|
| 60 | #endif /* _GUI_SAVEABLE_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.