Mercurial > fife-parpg
comparison engine/core/model/metamodel/object.h @ 306:6177cdf72489
- added new method to object class: getActionIds()
- cleanup to *.i file (replaced redundant code by including header file)
FEATURES:
- objects can now provide a list of action ids of all actions they were set up with
author | chewie@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 08 Aug 2009 14:24:35 +0000 |
parents | 8eec4c078223 |
children | 671e22a1cc8d |
comparison
equal
deleted
inserted
replaced
305:e25cfb3fe58e | 306:6177cdf72489 |
---|---|
23 #define FIFE_PROTOTYPE_H | 23 #define FIFE_PROTOTYPE_H |
24 | 24 |
25 // Standard C++ library includes | 25 // Standard C++ library includes |
26 #include <string> | 26 #include <string> |
27 #include <map> | 27 #include <map> |
28 #include <list> | |
28 | 29 |
29 // 3rd party library includes | 30 // 3rd party library includes |
30 | 31 |
31 // FIFE includes | 32 // FIFE includes |
32 // These includes are split up in two parts, separated by one empty line | 33 // These includes are split up in two parts, separated by one empty line |
62 Object(const std::string& identifier, const std::string& name_space, Object* inherited=NULL); | 63 Object(const std::string& identifier, const std::string& name_space, Object* inherited=NULL); |
63 | 64 |
64 /** Destructor | 65 /** Destructor |
65 */ | 66 */ |
66 ~Object(); | 67 ~Object(); |
67 | 68 |
68 const std::string& getId() const { return m_id; } | 69 const std::string& getId() const { return m_id; } |
69 const std::string& getNamespace() const { return m_namespace; } | 70 const std::string& getNamespace() const { return m_namespace; } |
70 | 71 |
71 /** Adds new action with given id. In case there is action already | 72 /** Adds new action with given id. In case there is action already |
72 * with given id, returns it instead of new object | 73 * with given id, returns it instead of new object |
80 Action* createAction(const std::string& identifier, bool is_default=false); | 81 Action* createAction(const std::string& identifier, bool is_default=false); |
81 | 82 |
82 /** Gets action with given id. If not found, returns NULL | 83 /** Gets action with given id. If not found, returns NULL |
83 */ | 84 */ |
84 Action* getAction(const std::string& identifier) const; | 85 Action* getAction(const std::string& identifier) const; |
86 | |
87 /** Gets all available action ids of the object and packs them into a list | |
88 */ | |
89 std::list<std::string> getActionIds() const; | |
85 | 90 |
86 /** Gets default action assigned to this object. If none available, returns NULL | 91 /** Gets default action assigned to this object. If none available, returns NULL |
87 */ | 92 */ |
88 Action* getDefaultAction() const { return m_defaultaction; } | 93 Action* getDefaultAction() const { return m_defaultaction; } |
89 | 94 |
124 */ | 129 */ |
125 bool isStatic() const; | 130 bool isStatic() const; |
126 | 131 |
127 bool operator==(const Object& obj) const; | 132 bool operator==(const Object& obj) const; |
128 bool operator!=(const Object& obj) const; | 133 bool operator!=(const Object& obj) const; |
129 | 134 |
130 private: | 135 private: |
131 std::string m_id; | 136 std::string m_id; |
132 std::string m_namespace; | 137 std::string m_namespace; |
133 Object* m_inherited; | 138 Object* m_inherited; |
134 std::map<std::string, Action*>* m_actions; | 139 std::map<std::string, Action*>* m_actions; |