Changeset 1390 for code/branches/console/src
- Timestamp:
- May 23, 2008, 2:10:52 AM (16 years ago)
- Location:
- code/branches/console/src/core
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/CMakeLists.txt
r1341 r1390 20 20 CommandExecutor.cc 21 21 CommandEvaluation.cc 22 ConsoleCommand.cc 23 ArgumentCompletionFunctions.cc 22 24 ConsoleCommandCompilation.cc 23 25 Language.cc -
code/branches/console/src/core/CommandEvaluation.cc
r1351 r1390 52 52 this->bEvaluatedParams_ = false; 53 53 54 this->listOfPossible FunctionClasses_.clear();54 this->listOfPossibleIdentifiers_.clear(); 55 55 this->listOfPossibleFunctions_.clear(); 56 56 … … 64 64 bool CommandEvaluation::isValid() const 65 65 { 66 if (this->state_ == CS_Shortcut_Params || this->state_ == CS_Shortcut_Finished) 67 { 68 return this->function_; 69 } 70 else if (this->state_ == CS_Function_Params || this->state_ == CS_Function_Finished) 71 { 72 return (this->functionclass_ && this->function_); 73 } 74 else 75 { 76 return false; 77 } 66 return (this->function_); 78 67 } 79 68 … … 94 83 unsigned int startindex = this->getStartindex(); 95 84 if (this->originalCommandTokens_.size() > startindex) 96 return evaluation.shortcut_->parse(removeSlashes(this->originalCommandTokens_.subSet(startindex).join() + evaluation.getAdditionalParameter()));85 return this->function_->parse(removeSlashes(this->originalCommandTokens_.subSet(startindex).join() + this->getAdditionalParameter())); 97 86 else 98 return evaluation.shortcut_->parse(removeSlashes(evaluation.additionalParameter_));87 return this->function_->parse(removeSlashes(this->additionalParameter_)); 99 88 } 100 89 … … 103 92 switch (this->state_) 104 93 { 94 case CS_Uninitialized: 105 95 case CS_Empty: 106 std::list<std::pair<const std::string*, const std::string*> > temp; 107 if (evaluation.state_ == CS_Empty) 108 { 109 temp.insert(temp.end(), this->listOfPossibleFunctions_.begin(), this->listOfPossibleFunctions_.end()); 110 temp.insert(temp.end(), this->listOfPossibleFunctionClasses_.begin(), this->listOfPossibleFunctionClasses_.end()); 111 } 112 return (CommandEvaluation::getCommonBegin(temp)); 96 case CS_ShortcutOrIdentifier: 97 { 98 std::list<std::pair<const std::string*, const std::string*> > temp; 99 if (this->state_ == CS_Empty) 100 { 101 temp.insert(temp.end(), this->listOfPossibleFunctions_.begin(), this->listOfPossibleFunctions_.end()); 102 temp.insert(temp.end(), this->listOfPossibleIdentifiers_.begin(), this->listOfPossibleIdentifiers_.end()); 103 } 104 return (CommandEvaluation::getCommonBegin(temp)); 105 } 113 106 break; 114 107 case CS_Shortcut_Params: 115 108 if (this->function_) 116 return (this->function_->getName() + " "); 109 { 110 if (this->commandTokens_.size() > 1) 111 return (this->function_->getName() + " " + this->commandTokens_.subSet(1, this->commandTokens_.size() - 1).join() + " " + CommandEvaluation::getCommonBegin(this->listOfPossibleArguments_)); 112 else 113 return (this->function_->getName() + " "); 114 } 117 115 break; 118 116 case CS_Shortcut_Finished: 119 117 if (this->function_) 120 118 { 121 if (this->function_->getParamCount() == 0) 119 if (this->commandTokens_.size() > 1) 120 return (this->function_->getName() + " " + this->originalCommandTokens_.subSet(1, this->originalCommandTokens_.size() - 1).join()); 121 else 122 122 return (this->function_->getName()); 123 else if (this->originalCommandTokens_.size() > 1)124 return (this->function_->getName() + " " + this->originalCommandTokens_.subSet(1).join());125 123 } 126 124 break; … … 131 129 case CS_Function_Params: 132 130 if (this->functionclass_ && this->function_) 133 return (this->functionclass_->getName() + " " + this->function_->getName() + " "); 131 { 132 if (this->commandTokens_.size() > 2) 133 return (this->functionclass_->getName() + " " + this->function_->getName() + " " + this->commandTokens_.subSet(2, this->commandTokens_.size() - 1).join() + " " + CommandEvaluation::getCommonBegin(this->listOfPossibleArguments_)); 134 else 135 return (this->functionclass_->getName() + " " + this->function_->getName() + " "); 136 } 134 137 break; 135 138 case CS_Function_Finished: 136 139 if (this->functionclass_ && this->function_) 137 140 { 138 if (this->function_->getParamCount() == 0) 139 return (this->functionclass_->getName() + " " + this->unction_->getName()); 140 else if (this->originalCommandTokens_.size() > 2) 141 return (this->functionclass_->getName() + " " + this->function_->getName() + " " + this->originalCommandTokens_.subSet(2).join()); 142 } 141 if (this->commandTokens_.size() > 2) 142 return (this->functionclass_->getName() + " " + this->function_->getName() + " " + this->originalCommandTokens_.subSet(2, this->originalCommandTokens_.size() - 1).join()); 143 else 144 return (this->functionclass_->getName() + " " + this->function_->getName()); 145 } 146 break; 147 case CS_Error: 143 148 break; 144 149 } … … 151 156 switch (this->state_) 152 157 { 158 case CS_Uninitialized: 159 break; 153 160 case CS_Empty: 154 return (CommandEvaluation::dump(this->listOfPossibleFunctions_) + "\n" + CommandExecutor::dump(this->listOfPossibleFunctionClasses_)); 161 case CS_ShortcutOrIdentifier: 162 return (CommandEvaluation::dump(this->listOfPossibleFunctions_) + "\n" + CommandEvaluation::dump(this->listOfPossibleIdentifiers_)); 155 163 break; 156 164 case CS_Function: … … 158 166 break; 159 167 case CS_Shortcut_Params: 168 case CS_Function_Params: 169 return CommandEvaluation::dump(this->listOfPossibleArguments_); 160 170 case CS_Shortcut_Finished: 161 case CS_Function_Params:162 171 case CS_Function_Finished: 163 172 if (this->function_) … … 175 184 { 176 185 this->bEvaluatedParams_ = false; 177 this->evaluatedExecutor_ = 0;178 186 179 187 for (unsigned int i = 0; i < MAX_FUNCTOR_ARGUMENTS; i++) … … 188 196 { 189 197 if (this->function_->evaluate(this->getAdditionalParameter(), this->param_, " ")) 190 {191 198 this->bEvaluatedParams_ = true; 192 this->evaluatedExecutor_ = this->function_;193 }194 199 } 195 200 else if (this->originalCommandTokens_.size() > startindex) 196 201 { 197 202 if (this->function_->evaluate(this->originalCommandTokens_.subSet(startindex).join() + this->getAdditionalParameter(), this->param_, " ")) 198 {199 203 this->bEvaluatedParams_ = true; 200 this->evaluatedExecutor_ = this->function_;201 }202 204 } 203 205 } … … 238 240 if (this->state_ == CS_Shortcut_Params || this->state_ == CS_Shortcut_Finished) 239 241 return 1; 240 else if (this->state_ == CS_Function _Params || this->state_ == CS_Function_Finished)242 else if (this->state_ == CS_Function || this->state_ == CS_Function_Params || this->state_ == CS_Function_Finished) 241 243 return 2; 242 244 else -
code/branches/console/src/core/CommandEvaluation.h
r1351 r1390 44 44 CS_Uninitialized, 45 45 CS_Empty, 46 CS_ FunctionClass_Or_Shortcut,46 CS_ShortcutOrIdentifier, 47 47 CS_Shortcut_Params, 48 48 CS_Shortcut_Finished, … … 60 60 void initialize(const std::string& command); 61 61 62 voidexecute() const;62 bool execute() const; 63 63 std::string complete() const; 64 64 std::string hint() const; … … 101 101 { this->bNewCommand_ = bNewCommand; } 102 102 103 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossible FunctionClasses()104 { return this->listOfPossible FunctionClasses_; }103 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleIdentifiers() 104 { return this->listOfPossibleIdentifiers_; } 105 105 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleFunctions() 106 106 { return this->listOfPossibleFunctions_; } 107 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleArguments() 108 { return this->listOfPossibleArguments_; } 107 109 108 110 inline void setAdditionalParameter(const std::string& param) … … 132 134 std::string additionalParameter_; 133 135 134 std::list<std::pair<const std::string*, const std::string*> > listOfPossible FunctionClasses_;136 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleIdentifiers_; 135 137 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctions_; 138 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleArguments_; 136 139 137 140 Identifier* functionclass_; -
code/branches/console/src/core/CommandExecutor.cc
r1351 r1390 56 56 ConsoleCommand& CommandExecutor::addConsoleCommandShortcut(ConsoleCommand* command) 57 57 { 58 std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_.find(command->getName()); 59 if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end()) 60 { 61 COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << "." << std::endl; 62 } 63 64 58 65 CommandExecutor::getInstance().consoleCommandShortcuts_[command->getName()] = command; 59 66 CommandExecutor::getInstance().consoleCommandShortcuts_LC_[getLowercase(command->getName())] = command; … … 135 142 switch (CommandExecutor::getEvaluation().getState()) 136 143 { 137 } 138 } 139 140 bool CommandExecutor::argumentsFinished(unsigned int num) 141 { 142 return (CommandExecutor::argumentsFinished() >= num); 144 case CS_Uninitialized: 145 // Impossible 146 break; 147 case CS_Empty: 148 CommandExecutor::createListOfPossibleIdentifiers(CommandExecutor::getArgument(0)); 149 CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getArgument(0)); 150 151 if (CommandExecutor::argumentsGiven() > 0) 152 { 153 CommandExecutor::getEvaluation().setState(CS_ShortcutOrIdentifier); 154 CommandExecutor::parse(command, false); 155 return; 156 } 157 break; 158 case CS_ShortcutOrIdentifier: 159 if (CommandExecutor::argumentsFinished() > 0 || !CommandExecutor::getEvaluation().isNewCommand()) 160 { 161 // There's already a finished first argument - check if it's function or a classname 162 CommandExecutor::getEvaluation().setIdentifier(CommandExecutor::getPossibleIdentifier(CommandExecutor::getArgument(0))); 163 CommandExecutor::getEvaluation().setFunction(CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(0))); 164 165 if (CommandExecutor::getEvaluation().getFunction()) 166 { 167 // It's a shortcut - continue parsing 168 CommandExecutor::getEvaluation().setState(CS_Shortcut_Params); 169 if (CommandExecutor::argumentsFinished() > 0 ) 170 CommandExecutor::parse(command, false); 171 else 172 CommandExecutor::parse(command + " ", false); 173 return; 174 } 175 else if (CommandExecutor::getEvaluation().getIdentifier()) 176 { 177 // It's a classname - continue parsing 178 CommandExecutor::getEvaluation().setState(CS_Function); 179 if (CommandExecutor::argumentsFinished() > 0 ) 180 CommandExecutor::parse(command, false); 181 else 182 CommandExecutor::parse(command + " ", false); 183 return; 184 } 185 } 186 187 if (CommandExecutor::argumentsFinished() == 0) 188 { 189 // There is no finished first argument 190 unsigned int numIdentifiers = CommandExecutor::getEvaluation().getListOfPossibleIdentifiers().size(); 191 unsigned int numCommands = CommandExecutor::getEvaluation().getListOfPossibleFunctions().size(); 192 193 if (numCommands == 1 && numIdentifiers == 0) 194 { 195 // It must be this command 196 const std::string* possibleCommand = (*CommandExecutor::getEvaluation().getListOfPossibleFunctions().begin()).second; 197 CommandExecutor::getEvaluation().setState(CS_Shortcut_Params); 198 CommandExecutor::getEvaluation().setFunction(CommandExecutor::getPossibleCommand(*possibleCommand)); 199 CommandExecutor::parse(*possibleCommand + " ", false); 200 return; 201 } 202 else if (numIdentifiers == 1 && numCommands == 0) 203 { 204 // It must be this classname 205 const std::string* possibleIdentifier = (*CommandExecutor::getEvaluation().getListOfPossibleIdentifiers().begin()).second; 206 CommandExecutor::getEvaluation().setState(CS_Function); 207 CommandExecutor::getEvaluation().setIdentifier(CommandExecutor::getPossibleIdentifier(*possibleIdentifier)); 208 CommandExecutor::parse(*possibleIdentifier + " ", false); 209 return; 210 } 211 } 212 213 // It's not a shortcut nor a classname 214 CommandExecutor::getEvaluation().setState(CS_Error); 215 AddLanguageEntry("commandexecutorunknownfirstargument", "is not a shortcut nor a classname"); 216 CommandExecutor::getEvaluation().setError("Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + "."); 217 break; 218 case CS_Function: 219 if (CommandExecutor::getEvaluation().getIdentifier() && CommandExecutor::argumentsGiven() > 1) 220 { 221 if (CommandExecutor::argumentsFinished() > 1 || !CommandExecutor::getEvaluation().isNewCommand()) 222 { 223 // There is already a second argument - check if it's a valid function 224 CommandExecutor::getEvaluation().setFunction(CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().getIdentifier())); 225 226 if (CommandExecutor::getEvaluation().getFunction()) 227 { 228 // It's a shortcut - continue parsing 229 CommandExecutor::getEvaluation().setState(CS_Function_Params); 230 if (CommandExecutor::argumentsFinished() > 1 ) 231 CommandExecutor::parse(command, false); 232 else 233 CommandExecutor::parse(command + " ", false); 234 return; 235 } 236 } 237 238 if (CommandExecutor::argumentsFinished() <= 1) 239 { 240 // There is no finished second argument 241 CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getArgument(0), CommandExecutor::getEvaluation().getIdentifier()); 242 unsigned int numFunctions = CommandExecutor::getEvaluation().getListOfPossibleFunctions().size(); 243 244 if (numFunctions == 1) 245 { 246 // It must be this command 247 const std::string* possibleCommand = (*CommandExecutor::getEvaluation().getListOfPossibleFunctions().begin()).second; 248 CommandExecutor::getEvaluation().setState(CS_Function_Params); 249 CommandExecutor::getEvaluation().setFunction(CommandExecutor::getPossibleCommand(*possibleCommand)); 250 CommandExecutor::parse(*possibleCommand + " ", false); 251 return; 252 } 253 } 254 255 // It's not a function 256 AddLanguageEntry("commandexecutorunknowncommand", "is not a valid commandname"); 257 CommandExecutor::getEvaluation().setError("Error: " + CommandExecutor::getArgument(1) + " " + GetLocalisation("commandexecutorunknowncommand") + "."); 258 } 259 260 // Bad state 261 CommandExecutor::getEvaluation().setState(CS_Error); 262 break; 263 case CS_Shortcut_Params: 264 case CS_Function_Params: 265 if (CommandExecutor::getEvaluation().getFunction()) 266 { 267 unsigned int startindex = 0; 268 if (CommandExecutor::getEvaluation().getState() == CS_Shortcut_Params) 269 startindex = 1; 270 else if (CommandExecutor::getEvaluation().getState() == CS_Function_Params) 271 startindex = 2; 272 273 if (CommandExecutor::argumentsGiven() >= startindex) 274 { 275 if (CommandExecutor::enoughArgumentsGiven(CommandExecutor::getEvaluation().getFunction())) 276 { 277 if (CommandExecutor::getEvaluation().getState() == CS_Shortcut_Params) 278 CommandExecutor::getEvaluation().setState(CS_Shortcut_Finished); 279 else if (CommandExecutor::getEvaluation().getState() == CS_Function_Params) 280 CommandExecutor::getEvaluation().setState(CS_Function_Finished); 281 return; 282 } 283 else 284 { 285 CommandExecutor::createListOfPossibleArguments(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().getFunction(), CommandExecutor::getEvaluation().getOriginalTokens().size() - startindex); 286 unsigned int numArguments = CommandExecutor::getEvaluation().getListOfPossibleArguments().size(); 287 288 if (numArguments == 1) 289 { 290 // There is exactly one possible argument 291 const std::string* possibleArgument = (*CommandExecutor::getEvaluation().getListOfPossibleArguments().begin()).second; 292 CommandExecutor::parse(CommandExecutor::getEvaluation().getTokens().subSet(0, CommandExecutor::getEvaluation().getTokens().size() - 1 - startindex).join() + " " + (*possibleArgument) + " "); 293 return; 294 } 295 296 if (!CommandExecutor::getEvaluation().isNewCommand()) 297 { 298 // There is more than one argument, but the user wants to use this - check if there is a perfect match 299 const std::string* possibleArgument = CommandExecutor::getPossibleArgument(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().getFunction(), CommandExecutor::getEvaluation().getOriginalTokens().size() - startindex); 300 if (possibleArgument) 301 { 302 // There is such an argument - use it 303 CommandExecutor::parse(command + " ", false); 304 return; 305 } 306 } 307 } 308 } 309 } 310 311 // Bad state 312 CommandExecutor::getEvaluation().setState(CS_Error); 313 break; 314 case CS_Shortcut_Finished: 315 case CS_Function_Finished: 316 case CS_Error: 317 break; 318 } 143 319 } 144 320 … … 152 328 } 153 329 154 std::string CommandExecutor::getToken(unsigned int index) 330 unsigned int CommandExecutor::argumentsGiven() 331 { 332 return CommandExecutor::getEvaluation().getOriginalTokens().size(); 333 } 334 335 bool CommandExecutor::enoughArgumentsGiven(ConsoleCommand* command) 336 { 337 if (CommandExecutor::getEvaluation().getIdentifier()) 338 return (CommandExecutor::argumentsGiven() >= (2 + command->getParamCount())); 339 else 340 return (CommandExecutor::argumentsGiven() >= (1 + command->getParamCount())); 341 } 342 343 std::string CommandExecutor::getArgument(unsigned int index) 155 344 { 156 345 if ((index >= 0) && index < (CommandExecutor::getEvaluation().getOriginalTokens().size())) … … 160 349 } 161 350 162 unsigned int CommandExecutor::argumentsGiven() 163 { 164 return CommandExecutor::getEvaluation().getOriginalTokens().size(); 165 } 166 167 bool CommandExecutor::enoughArgumentsGiven(ConsoleCommand* command, unsigned int head) 168 { 169 return (CommandExecutor::argumentsGiven() >= (head + command->getParamCount())); 170 } 171 172 void CommandExecutor::createListOfPossibleFunctionClasses(const std::string& fragment) 351 std::string CommandExecutor::getLastArgument() 352 { 353 if (CommandExecutor::getEvaluation().getOriginalTokens().size() > 0) 354 return CommandExecutor::getEvaluation().getOriginalTokens()[0]; 355 else 356 return ""; 357 } 358 359 void CommandExecutor::createListOfPossibleIdentifiers(const std::string& fragment) 173 360 { 174 361 for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseIdentifierMapBegin(); it != Identifier::getLowercaseIdentifierMapEnd(); ++it) 175 362 if ((*it).second->hasConsoleCommands()) 176 363 if ((*it).first.find(getLowercase(fragment)) == 0 || fragment == "") 177 CommandExecutor::getEvaluation().getListOfPossible FunctionClasses().push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));178 179 CommandExecutor::getEvaluation().getListOfPossible FunctionClasses().sort(CommandExecutor::compareStringsInList);364 CommandExecutor::getEvaluation().getListOfPossibleIdentifiers().push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 365 366 CommandExecutor::getEvaluation().getListOfPossibleIdentifiers().sort(CommandExecutor::compareStringsInList); 180 367 } 181 368 … … 197 384 } 198 385 386 void CommandExecutor::createListOfPossibleArguments(const std::string& fragment, ConsoleCommand* command, unsigned int param) 387 { 388 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(param); it != command->getArgumentCompletionListEnd(param); ++it) 389 if ((*it).first.find(getLowercase(fragment)) == 0 || fragment == "") 390 CommandExecutor::getEvaluation().getListOfPossibleArguments().push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second)); 391 392 CommandExecutor::getEvaluation().getListOfPossibleIdentifiers().sort(CommandExecutor::compareStringsInList); 393 394 } 395 199 396 Identifier* CommandExecutor::getPossibleIdentifier(const std::string& name) 200 397 { … … 223 420 } 224 421 422 const std::string* CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param) 423 { 424 std::string lowercasename = getLowercase(name); 425 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(param); it != command->getArgumentCompletionListEnd(param); ++it) 426 if ((*it).first == lowercasename) 427 return &(*it).second; 428 429 return 0; 430 } 431 225 432 bool CommandExecutor::compareStringsInList(const std::pair<const std::string*, const std::string*>& first, const std::pair<const std::string*, const std::string*>& second) 226 433 { -
code/branches/console/src/core/CommandExecutor.h
r1351 r1390 78 78 static void parse(const std::string& command, bool bInitialize = true); 79 79 80 static bool argumentsFinished(unsigned int num);81 80 static unsigned int argumentsFinished(); 82 81 static unsigned int argumentsGiven(); 83 static bool enoughArgumentsGiven(ConsoleCommand* command, unsigned int head); 84 static std::string getToken(unsigned int index); 82 static bool enoughArgumentsGiven(ConsoleCommand* command); 83 static std::string getArgument(unsigned int index); 84 static std::string getLastArgument(); 85 85 86 static void createListOfPossible FunctionClasses(const std::string& fragment);86 static void createListOfPossibleIdentifiers(const std::string& fragment); 87 87 static void createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier = 0); 88 static void createListOfPossibleArguments(const std::string& fragment, ConsoleCommand* command, unsigned int param); 88 89 89 90 static Identifier* getPossibleIdentifier(const std::string& name); 90 91 static ConsoleCommand* getPossibleCommand(const std::string& name, Identifier* identifier = 0); 92 static const std::string* getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param); 91 93 92 94 static bool compareStringsInList(const std::pair<const std::string*, const std::string*>& first, const std::pair<const std::string*, const std::string*>& second); -
code/branches/console/src/core/ConsoleCommand.h
r1341 r1390 36 36 #include "Identifier.h" 37 37 #include "CommandExecutor.h" 38 #include "ArgumentCompletionFunctions.h" 38 39 39 40 … … 73 74 { 74 75 public: 75 ConsoleCommand(FunctorStatic* functor, const std::string& name = "") : ExecutorStatic(functor, name), accessLevel_(AccessLevel::None) {}76 ConsoleCommand(FunctorStatic* functor, const std::string& name = ""); 76 77 77 78 inline ConsoleCommand& setDescription(const std::string& description) … … 99 100 { return this->accessLevel_; } 100 101 102 ConsoleCommand& setArgumentCompletionList(unsigned int param, const std::list<std::pair<std::string, std::string> >& (*function) (void)); 103 104 const std::list<std::pair<std::string, std::string> >& getArgumentCompletionList(unsigned int param) const; 105 std::list<std::pair<std::string, std::string> >::const_iterator getArgumentCompletionListBegin(unsigned int param) const; 106 std::list<std::pair<std::string, std::string> >::const_iterator getArgumentCompletionListEnd(unsigned int param) const; 107 101 108 private: 102 109 AccessLevel::Level accessLevel_; 110 const std::list<std::pair<std::string, std::string> >& (*autocompletionFunction_[5]) (void); 103 111 }; 104 112 -
code/branches/console/src/core/Identifier.cc
r1341 r1390 231 231 void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container) 232 232 { 233 std::map<std::string, ConfigValueContainer*>::const_iterator it = this->configValues_.find(varname); 234 if (it != this->configValues_.end()) 235 { 236 COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << "." << std::endl; 237 } 238 233 239 this->bHasConfigValues_ = true; 234 240 this->configValues_[varname] = container; … … 272 278 ConsoleCommand& Identifier::addConsoleCommand(ConsoleCommand* command, bool bCreateShortcut) 273 279 { 280 std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_.find(command->getName()); 281 if (it != this->consoleCommands_.end()) 282 { 283 COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << "." << std::endl; 284 } 285 274 286 this->bHasConsoleCommands_ = true; 275 287 this->consoleCommands_[command->getName()] = command;
Note: See TracChangeset
for help on using the changeset viewer.