- Timestamp:
- Aug 26, 2010, 2:06:16 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/command/CommandEvaluation.cc
r7203 r7221 67 67 } 68 68 69 bool CommandEvaluation::isValid() const70 {71 return (this->function_);72 }73 74 69 bool CommandEvaluation::execute() const 75 70 { … … 84 79 *success = false; 85 80 86 if (!this-> isValid())81 if (!this->function_ || !this->function_->isActive()) 87 82 return MT_Type::Null; 88 83 … … 92 87 *success = true; 93 88 COUT(6) << "CE_execute (evaluation): " << this->function_->getName() << ' ' << this->param_[0] << ' ' << this->param_[1] << ' ' << this->param_[2] << ' ' << this->param_[3] << ' ' << this->param_[4] << std::endl; 94 return (*this->function_ )(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]);89 return (*this->function_->getExecutor())(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]); 95 90 } 96 91 … … 101 96 unsigned int startindex = this->getStartindex(); 102 97 if (this->commandTokens_.size() > startindex) 103 return this->function_-> parse(removeSlashes(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter()), success);98 return this->function_->getExecutor()->parse(removeSlashes(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter()), success); 104 99 else 105 return this->function_-> parse(removeSlashes(this->additionalParameter_), success);100 return this->function_->getExecutor()->parse(removeSlashes(this->additionalParameter_), success); 106 101 } 107 102 … … 122 117 if (this->function_) 123 118 { 124 if (this->function_->get ParamCount() == 0)119 if (this->function_->getExecutor()->getParamCount() == 0) 125 120 return (this->command_ = this->function_->getName()); 126 121 else … … 133 128 if (this->function_) 134 129 { 135 if (this->function_->get ParamCount() == 0)130 if (this->function_->getExecutor()->getParamCount() == 0) 136 131 return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName()); 137 132 else … … 153 148 { 154 149 this->argument_ = this->possibleArgument_; 155 if (this->function_->get ParamCount() > (maxIndex + 1 - this->getStartindex()))150 if (this->function_->getExecutor()->getParamCount() > (maxIndex + 1 - this->getStartindex())) 156 151 whitespace = " "; 157 152 } … … 213 208 this->param_[i] = MT_Type::Null; 214 209 215 if (!this-> isValid())210 if (!this->function_) 216 211 return; 217 212 … … 220 215 if (this->commandTokens_.size() <= startindex) 221 216 { 222 if (this->function_-> evaluate(this->getAdditionalParameter(), this->param_, " "))217 if (this->function_->getBaseExecutor()->evaluate(this->getAdditionalParameter(), this->param_, " ")) 223 218 this->bEvaluatedParams_ = true; 224 219 } 225 220 else if (this->commandTokens_.size() > startindex) 226 221 { 227 if (this->function_-> evaluate(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter(), this->param_, " "))222 if (this->function_->getBaseExecutor()->evaluate(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter(), this->param_, " ")) 228 223 this->bEvaluatedParams_ = true; 229 224 } … … 280 275 } 281 276 282 std::string CommandEvaluation::dump(const ConsoleCommand* command)277 std::string CommandEvaluation::dump(const _ConsoleCommand* command) 283 278 { 284 279 std::string output = command->getName(); 285 if (command->get ParamCount() > 0)280 if (command->getExecutor()->getParamCount() > 0) 286 281 output += ": "; 287 282 288 for (unsigned int i = 0; i < command->get ParamCount(); i++)283 for (unsigned int i = 0; i < command->getExecutor()->getParamCount(); i++) 289 284 { 290 285 if (i != 0) 291 286 output += ' '; 292 287 293 if (command-> defaultValueSet(i))288 if (command->getExecutor()->defaultValueSet(i)) 294 289 output += '['; 295 290 else 296 291 output += '{'; 297 292 298 output += command->get TypenameParam(i);299 300 if (command-> defaultValueSet(i))301 output += '=' + command->get DefaultValue(i).getString() + ']';293 output += command->getExecutor()->getTypenameParam(i); 294 295 if (command->getExecutor()->defaultValueSet(i)) 296 output += '=' + command->getExecutor()->getDefaultValue(i).getString() + ']'; 302 297 else 303 298 output += '}';
Note: See TracChangeset
for help on using the changeset viewer.