Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/Template.h @ 8373

Last change on this file since 8373 was 7401, checked in by landauf, 14 years ago

merged doc branch back to trunk

  • Property svn:eol-style set to native
File size: 2.9 KB
RevLine 
[2072]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
[7401]29/**
30    @defgroup Template Template
31    @ingroup XML
32*/
33
34/**
35    @file
36    @ingroup XML Template
37*/
38
[2072]39#ifndef _Template_H__
40#define _Template_H__
41
42#include "CorePrereqs.h"
43
[3196]44#include <map>
45#include <string>
[2072]46#include "BaseObject.h"
47
48namespace orxonox
49{
50    class _CoreExport Template : public BaseObject
51    {
52        public:
53            Template(BaseObject* creator);
54            virtual ~Template();
55
56            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
57            virtual void changedName();
58
59            inline void setLink(const std::string& link)
[6417]60                { this->link_ = link; this->bIsLink_ = !link.empty(); }
[2072]61            inline const std::string& getLink() const
62                { return this->link_; }
[7163]63            inline bool isLink() const
64                { return this->bIsLink_; }
[2072]65
[2662]66            inline void setLoadDefaults(bool bLoadDefaults)
67                { this->bLoadDefaults_ = bLoadDefaults; }
68            inline bool getLoadDefaults() const
69                { return this->bLoadDefaults_; }
70
[3196]71            void setXMLElement(const TiXmlElement& xmlelement);
[7163]72            const TiXmlElement& getXMLElement();
[2072]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:
[3196]87            TiXmlElement* xmlelement_;
[2072]88            std::string link_;
89            std::string baseclass_;
90            Identifier* baseclassIdentifier_;
91            bool bIsLink_;
[2662]92            bool bLoadDefaults_;
[2072]93            mutable bool bIsReturningXMLElement_;
94    };
95}
96
97#endif /* _Template_H__ */
Note: See TracBrowser for help on using the repository browser.