| 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 |  | 
|---|
| 29 | /** | 
|---|
| 30 | @defgroup Template Template | 
|---|
| 31 | @ingroup XML | 
|---|
| 32 | */ | 
|---|
| 33 |  | 
|---|
| 34 | /** | 
|---|
| 35 | @file | 
|---|
| 36 | @ingroup XML Template | 
|---|
| 37 | */ | 
|---|
| 38 |  | 
|---|
| 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 | { | 
|---|
| 50 | class _CoreExport Template : public BaseObject | 
|---|
| 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_; } | 
|---|
| 77 | inline Identifier* getBaseclassIdentifier() const | 
|---|
| 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: | 
|---|
| 87 | TiXmlElement* xmlelement_; | 
|---|
| 88 | std::string link_; | 
|---|
| 89 | std::string baseclass_; | 
|---|
| 90 | Identifier* baseclassIdentifier_; | 
|---|
| 91 | bool bIsLink_; | 
|---|
| 92 | bool bLoadDefaults_; | 
|---|
| 93 | mutable bool bIsReturningXMLElement_; | 
|---|
| 94 | }; | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | #endif /* _Template_H__ */ | 
|---|