Changeset 1417
- Timestamp:
- May 25, 2008, 2:56:09 AM (17 years ago)
- Location:
- code/branches/console/src/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/CommandEvaluation.h
r1402 r1417 55 55 class _CoreExport CommandEvaluation 56 56 { 57 friend class CommandExecutor; 58 57 59 public: 58 60 CommandEvaluation(); … … 66 68 67 69 bool isValid() const; 68 69 inline Identifier* getIdentifier() const70 { return this->functionclass_; }71 inline void setIdentifier(Identifier* identifier)72 { this->functionclass_ = identifier; }73 inline ConsoleCommand* getFunction() const74 { return this->function_; }75 inline void setFunction(ConsoleCommand* command)76 { this->function_ = command; }77 78 inline const std::string& getOriginalCommand() const79 { return this->originalCommand_; }80 inline const std::string& getCommand() const81 { return this->command_; }82 inline void setCommand(const std::string& command)83 { this->command_ = command; }84 inline const CommandState& getState() const85 { return this->state_; }86 inline void setState(CommandState state)87 { this->state_ = state; }88 inline SubString& getTokens()89 { return this->commandTokens_; }90 inline void setTokens(const std::string& command)91 { this->commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0'); }92 inline const std::string& getError() const93 { return this->errorMessage_; }94 inline void setError(const std::string& error)95 { this->errorMessage_ = error; }96 inline bool isNewCommand() const97 { return this->bNewCommand_; }98 inline void setNewCommand(bool bNewCommand)99 { this->bNewCommand_ = bNewCommand; }100 101 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleIdentifiers()102 { return this->listOfPossibleIdentifiers_; }103 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleFunctions()104 { return this->listOfPossibleFunctions_; }105 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleArguments()106 { return this->listOfPossibleArguments_; }107 70 108 71 inline void setAdditionalParameter(const std::string& param) -
code/branches/console/src/core/CommandExecutor.cc
r1416 r1417 109 109 CommandExecutor::parseIfNeeded(command); 110 110 111 if (!CommandExecutor::getEvaluation(). isNewCommand())112 CommandExecutor::parse(CommandExecutor::getEvaluation(). getCommand(), false);113 else 114 CommandExecutor::getEvaluation(). setNewCommand(false);111 if (!CommandExecutor::getEvaluation().bNewCommand_) 112 CommandExecutor::parse(CommandExecutor::getEvaluation().command_, false); 113 else 114 CommandExecutor::getEvaluation().bNewCommand_ = false; 115 115 116 116 return CommandExecutor::getEvaluation().complete(); … … 132 132 void CommandExecutor::parseIfNeeded(const std::string& command) 133 133 { 134 if ((CommandExecutor::getEvaluation(). getOriginalCommand() != command) || (CommandExecutor::getEvaluation().getState()== CS_Uninitialized))134 if ((CommandExecutor::getEvaluation().originalCommand_ != command) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized)) 135 135 CommandExecutor::parse(command); 136 136 } … … 142 142 CommandExecutor::getEvaluation().initialize(command); 143 143 144 CommandExecutor::getEvaluation(). setTokens(command);145 CommandExecutor::getEvaluation(). setCommand(command);146 147 switch (CommandExecutor::getEvaluation(). getState())144 CommandExecutor::getEvaluation().commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0'); 145 CommandExecutor::getEvaluation().command_ = command; 146 147 switch (CommandExecutor::getEvaluation().state_) 148 148 { 149 149 case CS_Uninitialized: … … 161 161 if (CommandExecutor::argumentsGiven() > 0) 162 162 { 163 CommandExecutor::getEvaluation().s etState(CS_ShortcutOrIdentifier);163 CommandExecutor::getEvaluation().state_ = CS_ShortcutOrIdentifier; 164 164 CommandExecutor::parse(command, false); 165 165 return; … … 170 170 { 171 171 std::cout << "parse: state: CS_ShortcutOrIdentifier" << std::endl; 172 if (CommandExecutor::argumentsFinished() > 0 || !CommandExecutor::getEvaluation(). isNewCommand())172 if (CommandExecutor::argumentsFinished() > 0 || !CommandExecutor::getEvaluation().bNewCommand_) 173 173 { 174 174 // There's already a finished first argument - check if it's function or a classname 175 CommandExecutor::getEvaluation(). setIdentifier(CommandExecutor::getPossibleIdentifier(CommandExecutor::getArgument(0)));176 CommandExecutor::getEvaluation(). setFunction(CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(0)));177 178 if (CommandExecutor::getEvaluation(). getFunction())175 CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getPossibleIdentifier(CommandExecutor::getArgument(0)); 176 CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(0)); 177 178 if (CommandExecutor::getEvaluation().function_) 179 179 { 180 180 // It's a shortcut - continue parsing 181 CommandExecutor::getEvaluation().s etState(CS_Shortcut_Params);181 CommandExecutor::getEvaluation().state_ = CS_Shortcut_Params; 182 182 if (CommandExecutor::argumentsFinished() > 0 ) 183 183 CommandExecutor::parse(command, false); … … 186 186 return; 187 187 } 188 else if (CommandExecutor::getEvaluation(). getIdentifier())188 else if (CommandExecutor::getEvaluation().functionclass_) 189 189 { 190 190 // It's a classname - continue parsing 191 CommandExecutor::getEvaluation().s etState(CS_Function);191 CommandExecutor::getEvaluation().state_ = CS_Function; 192 192 if (CommandExecutor::argumentsFinished() > 0 ) 193 193 CommandExecutor::parse(command, false); … … 198 198 } 199 199 200 unsigned int numIdentifiers = CommandExecutor::getEvaluation(). getListOfPossibleIdentifiers().size();201 unsigned int numCommands = CommandExecutor::getEvaluation(). getListOfPossibleFunctions().size();200 unsigned int numIdentifiers = CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.size(); 201 unsigned int numCommands = CommandExecutor::getEvaluation().listOfPossibleFunctions_.size(); 202 202 203 203 if (CommandExecutor::argumentsFinished() == 0) … … 207 207 { 208 208 // It must be this command 209 const std::string* possibleCommand = (*CommandExecutor::getEvaluation(). getListOfPossibleFunctions().begin()).second;210 CommandExecutor::getEvaluation().s etState(CS_Shortcut_Params);211 CommandExecutor::getEvaluation(). setFunction(CommandExecutor::getPossibleCommand(*possibleCommand));209 const std::string* possibleCommand = (*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).second; 210 CommandExecutor::getEvaluation().state_ = CS_Shortcut_Params; 211 CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(*possibleCommand); 212 212 CommandExecutor::parse(*possibleCommand + " ", false); 213 213 return; … … 216 216 { 217 217 // It must be this classname 218 const std::string* possibleIdentifier = (*CommandExecutor::getEvaluation(). getListOfPossibleIdentifiers().begin()).second;219 CommandExecutor::getEvaluation().s etState(CS_Function);220 CommandExecutor::getEvaluation(). setIdentifier(CommandExecutor::getPossibleIdentifier(*possibleIdentifier));218 const std::string* possibleIdentifier = (*CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()).second; 219 CommandExecutor::getEvaluation().state_ = CS_Function; 220 CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getPossibleIdentifier(*possibleIdentifier); 221 221 CommandExecutor::parse(*possibleIdentifier + " ", false); 222 222 return; … … 227 227 { 228 228 // It's not a shortcut nor a classname 229 CommandExecutor::getEvaluation().s etState(CS_Error);229 CommandExecutor::getEvaluation().state_ = CS_Error; 230 230 AddLanguageEntry("commandexecutorunknownfirstargument", "is not a shortcut nor a classname"); 231 CommandExecutor::getEvaluation(). setError("Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + ".");231 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + "."; 232 232 } 233 233 break; … … 236 236 std::cout << "parse: state: CS_Function" << std::endl; 237 237 { 238 if (CommandExecutor::getEvaluation(). getIdentifier()&& CommandExecutor::argumentsGiven() > 0)239 { 240 if (CommandExecutor::argumentsFinished() > 1 || !CommandExecutor::getEvaluation(). isNewCommand())238 if (CommandExecutor::getEvaluation().functionclass_ && CommandExecutor::argumentsGiven() > 0) 239 { 240 if (CommandExecutor::argumentsFinished() > 1 || !CommandExecutor::getEvaluation().bNewCommand_) 241 241 { 242 242 // There is already a second argument - check if it's a valid function 243 CommandExecutor::getEvaluation(). setFunction(CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().getIdentifier()));244 245 if (CommandExecutor::getEvaluation(). getFunction())243 CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().functionclass_); 244 245 if (CommandExecutor::getEvaluation().function_) 246 246 { 247 247 // It's a shortcut - continue parsing 248 CommandExecutor::getEvaluation().s etState(CS_Function_Params);248 CommandExecutor::getEvaluation().state_ = CS_Function_Params; 249 249 if (CommandExecutor::argumentsFinished() > 1 ) 250 250 CommandExecutor::parse(command, false); … … 257 257 // It's not a function 258 258 AddLanguageEntry("commandexecutorunknowncommand", "is not a valid commandname"); 259 CommandExecutor::getEvaluation(). setError("Error: " + CommandExecutor::getArgument(1) + " " + GetLocalisation("commandexecutorunknowncommand") + ".");260 CommandExecutor::getEvaluation().s etState(CS_Error);261 } 262 } 263 264 CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation(). getIdentifier());259 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(1) + " " + GetLocalisation("commandexecutorunknowncommand") + "."; 260 CommandExecutor::getEvaluation().state_ = CS_Error; 261 } 262 } 263 264 CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().functionclass_); 265 265 266 266 if (CommandExecutor::argumentsFinished() <= 1) 267 267 { 268 268 // There is no finished second argument 269 unsigned int numFunctions = CommandExecutor::getEvaluation(). getListOfPossibleFunctions().size();269 unsigned int numFunctions = CommandExecutor::getEvaluation().listOfPossibleFunctions_.size(); 270 270 271 271 if (numFunctions == 1) 272 272 { 273 273 // It must be this command 274 const std::string* possibleCommand = (*CommandExecutor::getEvaluation(). getListOfPossibleFunctions().begin()).second;275 CommandExecutor::getEvaluation().s etState(CS_Function_Params);276 CommandExecutor::getEvaluation(). setFunction(CommandExecutor::getPossibleCommand(*possibleCommand, CommandExecutor::getEvaluation().getIdentifier()));274 const std::string* possibleCommand = (*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).second; 275 CommandExecutor::getEvaluation().state_ = CS_Function_Params; 276 CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(*possibleCommand, CommandExecutor::getEvaluation().functionclass_); 277 277 CommandExecutor::parse(CommandExecutor::getArgument(0) + " " + *possibleCommand + " ", false); 278 278 return; … … 282 282 // It's not a function 283 283 AddLanguageEntry("commandexecutorunknowncommand", "is not a valid commandname"); 284 CommandExecutor::getEvaluation(). setError("Error: " + CommandExecutor::getArgument(1) + " " + GetLocalisation("commandexecutorunknowncommand") + ".");285 CommandExecutor::getEvaluation().s etState(CS_Error);284 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(1) + " " + GetLocalisation("commandexecutorunknowncommand") + "."; 285 CommandExecutor::getEvaluation().state_ = CS_Error; 286 286 } 287 287 } … … 292 292 293 293 // Bad state 294 CommandExecutor::getEvaluation().s etState(CS_Error);294 CommandExecutor::getEvaluation().state_ = CS_Error; 295 295 break; 296 296 } … … 300 300 { 301 301 std::cout << "parse: state: CS_Function_Params" << std::endl; 302 if (CommandExecutor::getEvaluation(). getFunction())302 if (CommandExecutor::getEvaluation().function_) 303 303 { 304 304 unsigned int startindex = 0; 305 if (CommandExecutor::getEvaluation(). getState()== CS_Shortcut_Params)305 if (CommandExecutor::getEvaluation().state_ == CS_Shortcut_Params) 306 306 startindex = 1; 307 else if (CommandExecutor::getEvaluation(). getState()== CS_Function_Params)307 else if (CommandExecutor::getEvaluation().state_ == CS_Function_Params) 308 308 startindex = 2; 309 309 310 310 if (CommandExecutor::argumentsGiven() >= startindex) 311 311 { 312 if ((CommandExecutor::argumentsGiven() == CommandExecutor::argumentsFinished() || !CommandExecutor::getEvaluation(). isNewCommand()) && CommandExecutor::enoughArgumentsGiven(CommandExecutor::getEvaluation().getFunction()))313 { 314 if (CommandExecutor::getEvaluation(). getState()== CS_Shortcut_Params)315 CommandExecutor::getEvaluation().s etState(CS_Shortcut_Finished);316 else if (CommandExecutor::getEvaluation(). getState()== CS_Function_Params)317 CommandExecutor::getEvaluation().s etState(CS_Function_Finished);312 if ((CommandExecutor::argumentsGiven() == CommandExecutor::argumentsFinished() || !CommandExecutor::getEvaluation().bNewCommand_) && CommandExecutor::enoughArgumentsGiven(CommandExecutor::getEvaluation().function_)) 313 { 314 if (CommandExecutor::getEvaluation().state_ == CS_Shortcut_Params) 315 CommandExecutor::getEvaluation().state_ = CS_Shortcut_Finished; 316 else if (CommandExecutor::getEvaluation().state_ == CS_Function_Params) 317 CommandExecutor::getEvaluation().state_ = CS_Function_Finished; 318 318 319 319 return; … … 321 321 else 322 322 { 323 CommandExecutor::createListOfPossibleArguments(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation(). getFunction(), CommandExecutor::getEvaluation().getTokens().size() - startindex);324 unsigned int numArguments = CommandExecutor::getEvaluation(). getListOfPossibleArguments().size();323 CommandExecutor::createListOfPossibleArguments(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, CommandExecutor::getEvaluation().commandTokens_.size() - startindex); 324 unsigned int numArguments = CommandExecutor::getEvaluation().listOfPossibleArguments_.size(); 325 325 326 326 if (numArguments == 1) 327 327 { 328 328 // There is exactly one possible argument 329 const std::string* possibleArgument = (*CommandExecutor::getEvaluation(). getListOfPossibleArguments().begin()).second;329 const std::string* possibleArgument = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).second; 330 330 if (CommandExecutor::argumentsGiven() > CommandExecutor::argumentsFinished()) 331 CommandExecutor::parse(CommandExecutor::getEvaluation(). getTokens().subSet(0, CommandExecutor::getEvaluation().getTokens().size() - 1).join() + " " + (*possibleArgument) + " ", false);331 CommandExecutor::parse(CommandExecutor::getEvaluation().commandTokens_.subSet(0, CommandExecutor::getEvaluation().commandTokens_.size() - 1).join() + " " + (*possibleArgument) + " ", false); 332 332 else 333 CommandExecutor::parse(CommandExecutor::getEvaluation(). getTokens().subSet(0, CommandExecutor::getEvaluation().getTokens().size()).join() + " " + (*possibleArgument) + " ", false);333 CommandExecutor::parse(CommandExecutor::getEvaluation().commandTokens_.subSet(0, CommandExecutor::getEvaluation().commandTokens_.size()).join() + " " + (*possibleArgument) + " ", false); 334 334 335 335 return; 336 336 } 337 337 338 if ((CommandExecutor::argumentsGiven() > CommandExecutor::argumentsFinished()) && (!CommandExecutor::getEvaluation(). isNewCommand()))338 if ((CommandExecutor::argumentsGiven() > CommandExecutor::argumentsFinished()) && (!CommandExecutor::getEvaluation().bNewCommand_)) 339 339 { 340 340 // There is more than one argument, but the user wants to use this - check if there is a perfect match 341 const std::string* possibleArgument = CommandExecutor::getPossibleArgument(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation(). getFunction(), CommandExecutor::getEvaluation().getTokens().size() - startindex);341 const std::string* possibleArgument = CommandExecutor::getPossibleArgument(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, CommandExecutor::getEvaluation().commandTokens_.size() - startindex); 342 342 if (possibleArgument) 343 343 { … … 355 355 356 356 // Bad state 357 CommandExecutor::getEvaluation().s etState(CS_Error);357 CommandExecutor::getEvaluation().state_ = CS_Error; 358 358 break; 359 359 } … … 372 372 unsigned int CommandExecutor::argumentsFinished() 373 373 { 374 if (CommandExecutor::getEvaluation(). getCommand().size() > 0)375 { 376 if (CommandExecutor::getEvaluation(). getCommand()[CommandExecutor::getEvaluation().getCommand().size() - 1] == ' ')377 return CommandExecutor::getEvaluation(). getTokens().size();378 else if (CommandExecutor::getEvaluation(). getTokens().size() > 0)379 return CommandExecutor::getEvaluation(). getTokens().size() - 1;374 if (CommandExecutor::getEvaluation().command_.size() > 0) 375 { 376 if (CommandExecutor::getEvaluation().command_[CommandExecutor::getEvaluation().command_.size() - 1] == ' ') 377 return CommandExecutor::getEvaluation().commandTokens_.size(); 378 else if (CommandExecutor::getEvaluation().commandTokens_.size() > 0) 379 return CommandExecutor::getEvaluation().commandTokens_.size() - 1; 380 380 } 381 381 return 0; … … 384 384 unsigned int CommandExecutor::argumentsGiven() 385 385 { 386 return CommandExecutor::getEvaluation(). getTokens().size();386 return CommandExecutor::getEvaluation().commandTokens_.size(); 387 387 } 388 388 389 389 bool CommandExecutor::enoughArgumentsGiven(ConsoleCommand* command) 390 390 { 391 if (CommandExecutor::getEvaluation(). getIdentifier())391 if (CommandExecutor::getEvaluation().functionclass_) 392 392 return (CommandExecutor::argumentsGiven() >= (2 + command->getParamCount())); 393 393 else … … 397 397 std::string CommandExecutor::getArgument(unsigned int index) 398 398 { 399 if ((index >= 0) && index < (CommandExecutor::getEvaluation(). getTokens().size()))400 return CommandExecutor::getEvaluation(). getTokens()[index];399 if ((index >= 0) && index < (CommandExecutor::getEvaluation().commandTokens_.size())) 400 return CommandExecutor::getEvaluation().commandTokens_[index]; 401 401 else 402 402 return ""; … … 405 405 std::string CommandExecutor::getLastArgument() 406 406 { 407 if (CommandExecutor::getEvaluation(). getTokens().size() > 0)408 if (CommandExecutor::getEvaluation(). getCommand().size() > 0 && CommandExecutor::getEvaluation().getCommand()[CommandExecutor::getEvaluation().getCommand().size() - 1] != ' ')409 return CommandExecutor::getEvaluation(). getTokens()[CommandExecutor::getEvaluation().getTokens().size() - 1];407 if (CommandExecutor::getEvaluation().commandTokens_.size() > 0) 408 if (CommandExecutor::getEvaluation().commandTokens_.size() > 0 && CommandExecutor::getEvaluation().command_[CommandExecutor::getEvaluation().command_.size() - 1] != ' ') 409 return CommandExecutor::getEvaluation().commandTokens_[CommandExecutor::getEvaluation().commandTokens_.size() - 1]; 410 410 411 411 return ""; … … 414 414 void CommandExecutor::createListOfPossibleIdentifiers(const std::string& fragment) 415 415 { 416 CommandExecutor::getEvaluation(). getListOfPossibleIdentifiers().clear();416 CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.clear(); 417 417 std::string lowercase = getLowercase(fragment); 418 418 for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseIdentifierMapBegin(); it != Identifier::getLowercaseIdentifierMapEnd(); ++it) 419 419 if ((*it).second->hasConsoleCommands()) 420 420 if ((*it).first.find(lowercase) == 0 || fragment == "") 421 CommandExecutor::getEvaluation(). getListOfPossibleIdentifiers().push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));422 423 CommandExecutor::getEvaluation(). getListOfPossibleIdentifiers().sort(CommandExecutor::compareStringsInList);421 CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 422 423 CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.sort(CommandExecutor::compareStringsInList); 424 424 } 425 425 426 426 void CommandExecutor::createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier) 427 427 { 428 CommandExecutor::getEvaluation(). getListOfPossibleFunctions().clear();428 CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear(); 429 429 std::string lowercase = getLowercase(fragment); 430 430 if (!identifier) … … 432 432 for (std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin(); it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd(); ++it) 433 433 if ((*it).first.find(lowercase) == 0 || fragment == "") 434 CommandExecutor::getEvaluation(). getListOfPossibleFunctions().push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));434 CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 435 435 } 436 436 else … … 438 438 for (std::map<std::string, ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMapBegin(); it != identifier->getLowercaseConsoleCommandMapEnd(); ++it) 439 439 if ((*it).first.find(lowercase) == 0 || fragment == "") 440 CommandExecutor::getEvaluation(). getListOfPossibleFunctions().push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));441 } 442 443 CommandExecutor::getEvaluation(). getListOfPossibleFunctions().sort(CommandExecutor::compareStringsInList);440 CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 441 } 442 443 CommandExecutor::getEvaluation().listOfPossibleFunctions_.sort(CommandExecutor::compareStringsInList); 444 444 } 445 445 446 446 void CommandExecutor::createListOfPossibleArguments(const std::string& fragment, ConsoleCommand* command, unsigned int param) 447 447 { 448 CommandExecutor::getEvaluation(). getListOfPossibleArguments().clear();448 CommandExecutor::getEvaluation().listOfPossibleArguments_.clear(); 449 449 std::string lowercase = getLowercase(fragment); 450 450 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(param); it != command->getArgumentCompletionListEnd(param); ++it) 451 451 if ((*it).first.find(lowercase) == 0 || fragment == "") 452 CommandExecutor::getEvaluation(). getListOfPossibleArguments().push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second));453 454 CommandExecutor::getEvaluation(). getListOfPossibleArguments().sort(CommandExecutor::compareStringsInList);452 CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second)); 453 454 CommandExecutor::getEvaluation().listOfPossibleArguments_.sort(CommandExecutor::compareStringsInList); 455 455 } 456 456
Note: See TracChangeset
for help on using the changeset viewer.