FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
object.h
1 /***************************************************************************
2  * Copyright (C) 2006-2011 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_PROTOTYPE_H
23 #define FIFE_PROTOTYPE_H
24 
25 // Standard C++ library includes
26 #include <string>
27 #include <map>
28 #include <list>
29 
30 // 3rd party library includes
31 
32 // FIFE includes
33 // These includes are split up in two parts, separated by one empty line
34 // First block: files included from the FIFE root src directory
35 // Second block: files included from the same folder
36 #include "util/resource/resource.h"
37 #include "util/math/angles.h"
38 
39 namespace FIFE {
40 
41  class Action;
42  class IPather;
43  class IVisual;
44 
51  class Object {
52  public:
62  Object(const std::string& identifier, const std::string& name_space, Object* inherited=NULL);
63 
66  ~Object();
67 
68  const std::string& getId() const { return m_id; }
69  const std::string& getNamespace() const { return m_namespace; }
70 
73  void setId(const std::string& id) { m_id = id; }
74 
84  Action* createAction(const std::string& identifier, bool is_default=false);
85 
88  Action* getAction(const std::string& identifier) const;
89 
92  std::list<std::string> getActionIds() const;
93 
96  Action* getDefaultAction() const { return m_defaultaction; }
97 
100  void setPather(IPather* pather);
101 
104  IPather* getPather() const { return m_pather; }
105 
109  Object* getInherited() const { return m_inherited; }
110 
113  void adoptVisual(IVisual* visual) { m_visual = visual; }
114 
117  template<typename T> T* getVisual() const { return reinterpret_cast<T*>(m_visual); }
118 
121  void setBlocking(bool blocking) { m_blocking = blocking; }
122 
125  bool isBlocking() const;
126 
129  void setStatic(bool stat) { m_static = stat; }
130 
133  bool isStatic() const;
134 
135  void setFilename(const std::string& file) { m_filename = file; }
136  const std::string& getFilename() const { return m_filename; }
137 
138  bool operator==(const Object& obj) const;
139  bool operator!=(const Object& obj) const;
140 
141  private:
142  std::string m_id;
143  std::string m_namespace;
144  std::string m_filename;
145  Object* m_inherited;
146  std::map<std::string, Action*>* m_actions;
147  bool m_blocking;
148  bool m_static;
149  IPather* m_pather;
150  IVisual* m_visual;
151  Action* m_defaultaction;
152  };
153 
154 } //FIFE
155 #endif
156