Changeset 1427 for code/branches/console/src/core/CommandEvaluation.cc
- Timestamp:
- May 26, 2008, 3:08:39 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/CommandEvaluation.cc
r1424 r1427 57 57 this->functionclass_ = 0; 58 58 this->function_ = 0; 59 this->possibleArgument_ = ""; 60 this->argument_ = ""; 59 61 60 62 this->errorMessage_ = ""; … … 97 99 if (!this->bNewCommand_) 98 100 { 99 std::cout << " ASDF" << std::endl;101 std::cout << "not new" << std::endl; 100 102 switch (this->state_) 101 103 { … … 106 108 case CS_ShortcutOrIdentifier: 107 109 if (this->function_) 108 return CommandExecutor::complete(this->function_->getName() + " "); 110 { 111 if (this->function_->getParamCount() == 0) 112 return /*CommandExecutor::complete*/(this->command_ = this->function_->getName()); 113 else 114 return /*CommandExecutor::complete*/(this->command_ = this->function_->getName() + " "); 115 } 109 116 else if (this->functionclass_) 110 return CommandExecutor::complete(this->functionclass_->getName() + " ");117 return /*CommandExecutor::complete*/(this->command_ = this->functionclass_->getName() + " "); 111 118 break; 112 119 case CS_Function: 113 120 if (this->function_) 114 return CommandExecutor::complete(this->functionclass_->getName() + " " + this->function_->getName() + " "); 115 break; 121 { 122 if (this->function_->getParamCount() == 0) 123 return /*CommandExecutor::complete*/(this->command_ = this->functionclass_->getName() + " " + this->function_->getName()); 124 else 125 return /*CommandExecutor::complete*/(this->command_ = this->functionclass_->getName() + " " + this->function_->getName() + " "); 126 } 127 break; 128 case CS_ParamPreparation: 116 129 case CS_Params: 117 break; 130 { 131 unsigned int maxIndex = this->commandTokens_.size(); 132 if (this->command_[this->command_.size() - 1] != ' ') 133 maxIndex -= 1; 134 std::string whitespace = ""; 135 if (this->function_->getParamCount() > (maxIndex + 1 - this->getStartindex())) 136 whitespace = " "; 137 138 if (this->possibleArgument_ != "") 139 { 140 maxIndex -= 1; 141 this->argument_ = this->possibleArgument_; 142 } 143 144 return /*CommandExecutor::complete*/(this->command_ = this->commandTokens_.subSet(0, maxIndex).join() + " " + this->argument_ + whitespace); 145 break; 146 } 118 147 case CS_Finished: 119 148 break; … … 144 173 return CommandEvaluation::dump(this->listOfPossibleFunctions_); 145 174 break; 175 case CS_ParamPreparation: 146 176 case CS_Params: 147 177 if (this->listOfPossibleArguments_.size() > 0) … … 241 271 std::string CommandEvaluation::dump(const ConsoleCommand* command) 242 272 { 243 std::string output = command->getName() + ": "; 273 std::string output = command->getName(); 274 if (command->getParamCount() > 0) 275 output += ": "; 276 244 277 for (unsigned int i = 0; i < command->getParamCount(); i++) 245 278 {
Note: See TracChangeset
for help on using the changeset viewer.