Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/core/Executor.cc @ 952

Last change on this file since 952 was 871, checked in by landauf, 17 years ago

merged core branch to trunk

File size: 3.7 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program; if not, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Fabian 'x3n' Landau
23 *   Co-authors:
24 *      ...
25 *
26 *   Inspiration: Executor by Benjamin Grauer
27 */
28
29#include "Executor.h"
30#include "Language.h"
31#include "util/String.h"
32
33namespace orxonox
34{
35    Executor::Executor(Functor* functor, const std::string& name)
36    {
37        this->functor_ = functor;
38        this->name_ = name;
39        this->bAddedDescription_ = false;
40        this->bAddedDescriptionReturnvalue_ = false;
41        this->bAddedDescriptionParam_[0] = false;
42        this->bAddedDescriptionParam_[1] = false;
43        this->bAddedDescriptionParam_[2] = false;
44        this->bAddedDescriptionParam_[3] = false;
45        this->bAddedDescriptionParam_[4] = false;
46    }
47
48    Executor::~Executor()
49    {
50    }
51
52    void Executor::setName(const std::string name)
53    {
54        this->name_ = name;
55    }
56
57    const std::string& Executor::getName() const
58    {
59        return this->name_;
60    }
61
62    void Executor::description(const std::string& description)
63    {
64        if (!this->bAddedDescription_)
65        {
66            this->description_ = std::string("ExecutorDescription::" + this->name_ + "::function");
67            AddLanguageEntry(this->description_, description);
68            this->bAddedDescription_ = true;
69        }
70    }
71
72    const std::string& Executor::getDescription() const
73    {
74        return GetLocalisation(this->description_);
75    }
76
77    void Executor::descriptionParam(int param, const std::string& description)
78    {
79        if (param > 0 && param <= 5)
80        {
81            if (!this->bAddedDescriptionParam_[param])
82            {
83                std::string paramnumber;
84                if (!Convert::ToString(&paramnumber, param))
85                    return;
86
87                this->descriptionParam_[param] = std::string("ExecutorDescription::" + this->name_ + "::param" + paramnumber);
88                AddLanguageEntry(this->descriptionParam_[param], description);
89                this->bAddedDescriptionParam_[param] = true;
90            }
91        }
92    }
93
94    const std::string& Executor::getDescriptionParam(int param) const
95    {
96        if (param > 0 && param <= 5)
97        {
98            return GetLocalisation(this->descriptionParam_[param]);
99        }
100
101        return this->descriptionParam_[0];
102    }
103
104    void Executor::descriptionReturnvalue(const std::string& description)
105    {
106        if (!this->bAddedDescriptionReturnvalue_)
107        {
108            this->descriptionReturnvalue_ = std::string("ExecutorDescription::" + this->name_ + "::returnvalue");
109            AddLanguageEntry(this->descriptionReturnvalue_, description);
110            this->bAddedDescriptionReturnvalue_ = true;
111        }
112    }
113
114    const std::string& Executor::getDescriptionReturnvalue(int param) const
115    {
116        return GetLocalisation(this->descriptionReturnvalue_);
117    }
118}
Note: See TracBrowser for help on using the repository browser.