Orxonox  0.0.5 Codename: Arcturus
Template.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Fabian 'x3n' Landau
24  * Co-authors:
25  * ...
26  *
27  */
28 
39 #ifndef _Template_H__
40 #define _Template_H__
41 
42 #include "CorePrereqs.h"
43 
44 #include <map>
45 #include <string>
46 #include "BaseObject.h"
47 
48 namespace orxonox
49 {
51  {
52  public:
53  Template(Context* context);
54  virtual ~Template();
55 
56  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
57  virtual void changedName() override;
58 
59  inline void setLink(const std::string& link)
60  { this->link_ = link; this->bIsLink_ = !link.empty(); }
61  inline const std::string& getLink() const
62  { return this->link_; }
63  inline bool isLink() const
64  { return this->bIsLink_; }
65 
66  inline void setLoadDefaults(bool bLoadDefaults)
67  { this->bLoadDefaults_ = bLoadDefaults; }
68  inline bool getLoadDefaults() const
69  { return this->bLoadDefaults_; }
70 
71  void setXMLElement(const TiXmlElement& xmlelement);
72  const TiXmlElement& getXMLElement();
73 
74  void setBaseclass(const std::string& baseclass);
75  inline const std::string& getBaseclass() const
76  { return this->baseclass_; }
78  { return this->baseclassIdentifier_; }
79 
80  void applyOn(BaseObject* object);
81 
82  static std::map<std::string, Template*>& getTemplateMap();
83  static Template* getTemplate(const std::string& name);
84  static void apply(const std::string& name, BaseObject* object);
85 
86  private:
91  bool bIsLink_;
94  };
95 }
96 
97 #endif /* _Template_H__ */
The BaseObject is the parent of all classes representing an instance in the game. ...
Definition: BaseObject.h:63
Identifier * getBaseclassIdentifier() const
Definition: Template.h:77
Identifier * baseclassIdentifier_
Definition: Template.h:90
Definition: Template.h:50
bool bIsLink_
Definition: Template.h:91
std::string baseclass_
Definition: Template.h:89
bool isLink() const
Definition: Template.h:63
void setLoadDefaults(bool bLoadDefaults)
Definition: Template.h:66
bool getLoadDefaults() const
Definition: Template.h:68
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
const std::string & getBaseclass() const
Definition: Template.h:75
const std::string & getLink() const
Definition: Template.h:61
std::string link_
Definition: Template.h:88
xmlelement
Definition: Super.h:519
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
Mode
Definition: CorePrereqs.h:102
The Identifier is used to identify the class of an object and to store information about the class...
Definition: Identifier.h:109
void setLink(const std::string &link)
Definition: Template.h:59
Declaration of BaseObject, the base class of all objects in Orxonox.
Definition: Context.h:45
bool bLoadDefaults_
Definition: Template.h:92
TiXmlElement * xmlelement_
Definition: Template.h:87
The element is a container class.
Definition: tinyxml.h:961
bool bIsReturningXMLElement_
Definition: Template.h:93