- Timestamp:
- Aug 19, 2010, 2:14:54 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/Executor.cc
r7163 r7186 36 36 #include "util/StringUtils.h" 37 37 #include "util/SubString.h" 38 #include "Language.h"39 38 40 39 namespace orxonox … … 44 43 this->functor_ = functor; 45 44 this->name_ = name; 46 47 this->bAddedDescription_ = false;48 this->bAddedDescriptionReturnvalue_ = false;49 50 this->bAddedDescriptionParam_[0] = false;51 this->bAddedDescriptionParam_[1] = false;52 this->bAddedDescriptionParam_[2] = false;53 this->bAddedDescriptionParam_[3] = false;54 this->bAddedDescriptionParam_[4] = false;55 45 56 46 this->bAddedDefaultValue_[0] = false; … … 69 59 { 70 60 unsigned int paramCount = this->functor_->getParamCount(); 71 61 72 62 if (paramCount == 0) 73 63 { … … 97 87 { 98 88 SubString tokens(params, delimiter, SubString::WhiteSpaces, false, '\\', true, '"', true, '(', ')', true, '\0'); 99 89 100 90 for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) 101 91 { … … 106 96 } 107 97 } 108 98 109 99 MultiType param[MAX_FUNCTOR_ARGUMENTS]; 110 100 COUT(5) << "Calling Executor " << this->name_ << " through parser with " << paramCount << " parameters, using " << tokens.size() << " tokens ("; … … 129 119 } 130 120 COUT(5) << ")." << std::endl; 131 121 132 122 if ((tokens.size() > paramCount) && (this->functor_->getTypenameParam(paramCount - 1) == "string")) 133 123 param[paramCount - 1] = tokens.subSet(paramCount - 1).join(); 134 124 135 125 switch(paramCount) 136 126 { … … 198 188 return true; 199 189 } 200 }201 202 Executor& Executor::setDescription(const std::string& description)203 {204 if (!this->bAddedDescription_)205 {206 this->description_ = std::string("ExecutorDescription::" + this->name_ + "::function");207 AddLanguageEntry(this->description_, description);208 this->bAddedDescription_ = true;209 }210 return (*this);211 }212 213 const std::string& Executor::getDescription() const214 {215 return GetLocalisation(this->description_);216 }217 218 Executor& Executor::setDescriptionParam(unsigned int param, const std::string& description)219 {220 if (param < MAX_FUNCTOR_ARGUMENTS)221 {222 if (!this->bAddedDescriptionParam_[param])223 {224 std::string paramnumber;225 if (!convertValue(¶mnumber, param))226 return (*this);227 228 this->descriptionParam_[param] = std::string("ExecutorDescription::" + this->name_ + "::param" + paramnumber);229 AddLanguageEntry(this->descriptionParam_[param], description);230 this->bAddedDescriptionParam_[param] = true;231 }232 }233 return (*this);234 }235 236 const std::string& Executor::getDescriptionParam(unsigned int param) const237 {238 if (param < MAX_FUNCTOR_ARGUMENTS)239 return GetLocalisation(this->descriptionParam_[param]);240 241 return this->descriptionParam_[0];242 }243 244 Executor& Executor::setDescriptionReturnvalue(const std::string& description)245 {246 if (!this->bAddedDescriptionReturnvalue_)247 {248 this->descriptionReturnvalue_ = std::string("ExecutorDescription::" + this->name_ + "::returnvalue");249 AddLanguageEntry(this->descriptionReturnvalue_, description);250 this->bAddedDescriptionReturnvalue_ = true;251 }252 return (*this);253 }254 255 const std::string& Executor::getDescriptionReturnvalue(int param) const256 {257 return GetLocalisation(this->descriptionReturnvalue_);258 190 } 259 191
Note: See TracChangeset
for help on using the changeset viewer.