Debian Codegraph @

src/gameproperty.h

raw
1 // Copyright © 2003 Rob Kaper <[email protected]>
2 // 2010-2015 Sylvain Rochet <[email protected]>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // version 2 as published by the Free Software Foundation.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; see the file COPYING. If not, see
15 // <http://www.gnu.org/licenses/>.
16
17 #ifndef ATLANTIC_GAMEPROPERTY_H
18 #define ATLANTIC_GAMEPROPERTY_H
19
20 #include <string>
21
22 class GameObject;
23
24 class GameProperty
25 {
26 public:
27 GameProperty(const std::string &key, GameObject *m_scope);
28 std::string key() const;
29 // void setScope(GameObject *scope);
30 GameObject *scope();
31 void setChanged(const bool &changed);
32 bool changed() const;
33
34 protected:
35 std::string m_key;
36 GameObject *m_scope;
37 bool m_changed;
38 };
39
40 class GameIntProperty : public GameProperty
41 {
42 public:
43 GameIntProperty(const std::string &key, int value, GameObject *scope);
44 bool setValue(int value);
45 int value();
46
47 private:
48 int m_value;
49 };
50
51 class GameStringProperty : public GameProperty
52 {
53 public:
54 GameStringProperty(const std::string &key, const std::string &value, GameObject *scope);
55 bool setValue(const std::string &value);
56 std::string value() const;
57
58 private:
59 std::string m_value;
60 };
61
62 class GameBoolProperty : public GameProperty
63 {
64 public:
65 GameBoolProperty(const std::string &key, const bool &value, GameObject *scope);
66 bool setValue(const bool &value);
67 bool value() const;
68
69 private:
70 bool m_value;
71 };
72
73 #endif