Changeset 6394 for code/branches/presentation2/src/libraries/core
- Timestamp:
- Dec 22, 2009, 2:07:44 PM (15 years ago)
- Location:
- code/branches/presentation2/src/libraries/core
- Files:
-
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc
r6166 r6394 72 72 else 73 73 { 74 std::stringdir = startdirectory.string();74 const std::string& dir = startdirectory.string(); 75 75 if (dir.size() > 0 && dir[dir.size() - 1] == ':') 76 76 startdirectory = dir + '/'; … … 130 130 if (variable != identifier->second->getLowercaseConfigValueMapEnd()) 131 131 { 132 std::stringvaluestring = variable->second->toString();132 const std::string& valuestring = variable->second->toString(); 133 133 oldvalue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring)); 134 134 } -
code/branches/presentation2/src/libraries/core/BaseObject.cc
r6387 r6394 36 36 #include <tinyxml/tinyxml.h> 37 37 38 #include "util/StringUtils.h"39 38 #include "CoreIncludes.h" 40 39 #include "Event.h" … … 278 277 if (it != this->eventStates_.end()) 279 278 { 280 COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << "."<< std::endl;279 COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << '.' << std::endl; 281 280 delete (it->second); 282 281 } … … 348 347 if (it != this->eventStates_.end()) 349 348 it->second->process(event, this); 350 else if ( event.statename_ != "")349 else if (!event.statename_.empty()) 351 350 COUT(2) << "Warning: \"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl; 352 351 else … … 386 385 this->mainStateFunctor_ = 0; 387 386 388 if ( this->mainStateName_ != "")387 if (!this->mainStateName_.empty()) 389 388 { 390 389 this->registerEventStates(); … … 437 436 for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it) 438 437 { 439 std::stringstatename = (*it);438 const std::string& statename = (*it); 440 439 441 440 // if the event state is already known, continue with the next state … … 447 446 if (!container) 448 447 { 449 ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + "(" + statename + ")");450 ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + "(" + statename + ")");448 ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + '(' + statename + ')'); 449 ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + '(' + statename + ')'); 451 450 setfunctor->setDefaultValue(1, statename); 452 451 getfunctor->setDefaultValue(1, statename); -
code/branches/presentation2/src/libraries/core/ClassTreeMask.cc
r5929 r6394 816 816 // Calculate the prefix: + means included, - means excluded 817 817 if (it->isIncluded()) 818 out << "+";818 out << '+'; 819 819 else 820 out << "-";820 out << '-'; 821 821 822 822 // Put the name of the corresponding class on the stream 823 out << it->getClass()->getName() << " ";823 out << it->getClass()->getName() << ' '; 824 824 } 825 825 -
code/branches/presentation2/src/libraries/core/CommandEvaluation.cc
r5781 r6394 50 50 this->commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0'); 51 51 52 this->additionalParameter_ = "";52 this->additionalParameter_.clear(); 53 53 54 54 this->bEvaluatedParams_ = false; … … 60 60 this->functionclass_ = 0; 61 61 this->function_ = 0; 62 this->possibleArgument_ = "";63 this->argument_ = "";64 65 this->errorMessage_ = "";62 this->possibleArgument_.clear(); 63 this->argument_.clear(); 64 65 this->errorMessage_.clear(); 66 66 this->state_ = CommandState::Empty; 67 67 } … … 79 79 if (this->bEvaluatedParams_ && this->function_) 80 80 { 81 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;81 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; 82 82 (*this->function_)(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]); 83 83 return true; … … 98 98 } 99 99 100 std::stringCommandEvaluation::complete()100 const std::string& CommandEvaluation::complete() 101 101 { 102 102 if (!this->bNewCommand_) … … 114 114 return (this->command_ = this->function_->getName()); 115 115 else 116 return (this->command_ = this->function_->getName() + " ");116 return (this->command_ = this->function_->getName() + ' '); 117 117 } 118 118 else if (this->functionclass_) 119 return (this->command_ = this->functionclass_->getName() + " ");119 return (this->command_ = this->functionclass_->getName() + ' '); 120 120 break; 121 121 case CommandState::Function: … … 123 123 { 124 124 if (this->function_->getParamCount() == 0) 125 return (this->command_ = this->functionclass_->getName() + " "+ this->function_->getName());125 return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName()); 126 126 else 127 return (this->command_ = this->functionclass_->getName() + " " + this->function_->getName() + " ");127 return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName() + ' '); 128 128 } 129 129 break; … … 131 131 case CommandState::Params: 132 132 { 133 if (this->argument_ == "" && this->possibleArgument_ == "")133 if (this->argument_.empty() && this->possibleArgument_.empty()) 134 134 break; 135 135 … … 137 137 if (this->command_[this->command_.size() - 1] != ' ') 138 138 maxIndex -= 1; 139 std::string whitespace = "";140 141 if ( this->possibleArgument_ != "")139 std::string whitespace; 140 141 if (!this->possibleArgument_.empty()) 142 142 { 143 143 this->argument_ = this->possibleArgument_; … … 146 146 } 147 147 148 return (this->command_ = this->commandTokens_.subSet(0, maxIndex).join() + " "+ this->argument_ + whitespace);148 return (this->command_ = this->commandTokens_.subSet(0, maxIndex).join() + ' ' + this->argument_ + whitespace); 149 149 break; 150 150 } … … 262 262 std::string CommandEvaluation::dump(const std::list<std::pair<const std::string*, const std::string*> >& list) 263 263 { 264 std::string output = "";264 std::string output; 265 265 for (std::list<std::pair<const std::string*, const std::string*> >::const_iterator it = list.begin(); it != list.end(); ++it) 266 266 { 267 267 if (it != list.begin()) 268 output += " ";269 270 output += *( *it).second;268 output += ' '; 269 270 output += *(it->second); 271 271 } 272 272 return output; … … 275 275 std::string CommandEvaluation::dump(const ArgumentCompletionList& list) 276 276 { 277 std::string output = "";277 std::string output; 278 278 for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it) 279 279 { 280 280 if (it != list.begin()) 281 output += " ";281 output += ' '; 282 282 283 283 output += (*it).getDisplay(); … … 295 295 { 296 296 if (i != 0) 297 output += " ";297 output += ' '; 298 298 299 299 if (command->defaultValueSet(i)) 300 output += "[";300 output += '['; 301 301 else 302 output += "{";302 output += '{'; 303 303 304 304 output += command->getTypenameParam(i); 305 305 306 306 if (command->defaultValueSet(i)) 307 output += "=" + command->getDefaultValue(i).getString() + "]";307 output += '=' + command->getDefaultValue(i).getString() + ']'; 308 308 else 309 output += "}";309 output += '}'; 310 310 } 311 311 return output; -
code/branches/presentation2/src/libraries/core/CommandEvaluation.h
r5781 r6394 66 66 67 67 bool execute() const; 68 std::stringcomplete();68 const std::string& complete(); 69 69 std::string hint() const; 70 70 void evaluateParams(); … … 82 82 { this->additionalParameter_ = param; this->bEvaluatedParams_ = false; } 83 83 inline std::string getAdditionalParameter() const 84 { return ( this->additionalParameter_ != "") ? (" "+ this->additionalParameter_) : ""; }84 { return (!this->additionalParameter_.empty()) ? (' ' + this->additionalParameter_) : ""; } 85 85 86 86 void setEvaluatedParameter(unsigned int index, MultiType param); -
code/branches/presentation2/src/libraries/core/CommandExecutor.cc
r6166 r6394 59 59 if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end()) 60 60 { 61 COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << "."<< std::endl;61 COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << '.' << std::endl; 62 62 } 63 63 … … 215 215 CommandExecutor::getEvaluation().state_ = CommandState::Error; 216 216 AddLanguageEntry("commandexecutorunknownfirstargument", "is not a shortcut nor a classname"); 217 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + ".";217 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + ' ' + GetLocalisation("commandexecutorunknownfirstargument") + '.'; 218 218 return; 219 219 } … … 231 231 { 232 232 // It's a shortcut 233 std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;233 const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first; 234 234 CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname); 235 235 if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(0))) … … 243 243 if (CommandExecutor::getEvaluation().function_->getParamCount() > 0) 244 244 { 245 CommandExecutor::getEvaluation().command_ += " ";245 CommandExecutor::getEvaluation().command_ += ' '; 246 246 CommandExecutor::getEvaluation().bCommandChanged_ = true; 247 247 } … … 251 251 { 252 252 // It's a classname 253 std::string classname = *(*CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()).first;253 const std::string& classname = *CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()->first; 254 254 CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getPossibleIdentifier(classname); 255 255 if (getLowercase(classname) != getLowercase(CommandExecutor::getArgument(0))) … … 260 260 CommandExecutor::getEvaluation().state_ = CommandState::Function; 261 261 CommandExecutor::getEvaluation().function_ = 0; 262 CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " ";262 CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' '; 263 263 // Move on to next case 264 264 } … … 268 268 CommandExecutor::getEvaluation().state_ = CommandState::Error; 269 269 AddLanguageEntry("commandexecutorunknownfirstargumentstart", "There is no command or classname starting with"); 270 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + " " + CommandExecutor::getArgument(0) + ".";270 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + ' ' + CommandExecutor::getArgument(0) + '.'; 271 271 return; 272 272 } … … 319 319 { 320 320 // It's a function 321 std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;321 const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first; 322 322 CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname, CommandExecutor::getEvaluation().functionclass_); 323 323 if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(1))) … … 327 327 } 328 328 CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation; 329 CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " "+ CommandExecutor::getEvaluation().function_->getName();329 CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + CommandExecutor::getEvaluation().function_->getName(); 330 330 if (CommandExecutor::getEvaluation().function_->getParamCount() > 0) 331 331 { 332 CommandExecutor::getEvaluation().command_ += " ";332 CommandExecutor::getEvaluation().command_ += ' '; 333 333 CommandExecutor::getEvaluation().bCommandChanged_ = true; 334 334 } … … 340 340 CommandExecutor::getEvaluation().state_ = CommandState::Error; 341 341 AddLanguageEntry("commandexecutorunknownsecondargumentstart", "has no function starting with"); 342 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + " " + GetLocalisation("commandexecutorunknownsecondargumentstart") + " " + CommandExecutor::getArgument(1) + ".";342 CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + GetLocalisation("commandexecutorunknownsecondargumentstart") + ' ' + CommandExecutor::getArgument(1) + '.'; 343 343 return; 344 344 } … … 346 346 { 347 347 // There are several possibilities 348 CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " "+ CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleFunctions_);348 CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleFunctions_); 349 349 CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().functionclass_); 350 350 CommandExecutor::getEvaluation().bCommandChanged_ = true; … … 451 451 } 452 452 453 std::stringCommandExecutor::getArgument(unsigned int index)453 const std::string& CommandExecutor::getArgument(unsigned int index) 454 454 { 455 455 if (index < (CommandExecutor::getEvaluation().commandTokens_.size())) 456 456 return CommandExecutor::getEvaluation().commandTokens_[index]; 457 457 else 458 return "";459 } 460 461 std::stringCommandExecutor::getLastArgument()458 return BLANKSTRING; 459 } 460 461 const std::string& CommandExecutor::getLastArgument() 462 462 { 463 463 return CommandExecutor::getArgument(CommandExecutor::argumentsGiven() - 1); … … 467 467 { 468 468 CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.clear(); 469 std::stringlowercase = getLowercase(fragment);469 const std::string& lowercase = getLowercase(fragment); 470 470 for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapBegin(); it != Identifier::getLowercaseStringIdentifierMapEnd(); ++it) 471 if ( (*it).second->hasConsoleCommands())472 if ( (*it).first.find(lowercase) == 0 || fragment == "")471 if (it->second->hasConsoleCommands()) 472 if (it->first.find(lowercase) == 0 || fragment.empty()) 473 473 CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 474 474 } … … 477 477 { 478 478 CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear(); 479 std::stringlowercase = getLowercase(fragment);479 const std::string& lowercase = getLowercase(fragment); 480 480 if (!identifier) 481 481 { 482 482 for (std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin(); it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd(); ++it) 483 if ( (*it).first.find(lowercase) == 0 || fragment == "")483 if (it->first.find(lowercase) == 0 || fragment.empty()) 484 484 CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 485 485 } … … 487 487 { 488 488 for (std::map<std::string, ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMapBegin(); it != identifier->getLowercaseConsoleCommandMapEnd(); ++it) 489 if ( (*it).first.find(lowercase) == 0 || fragment == "")489 if (it->first.find(lowercase) == 0 || fragment.empty()) 490 490 CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 491 491 } … … 497 497 498 498 CommandExecutor::getEvaluation().listOfPossibleArguments_.clear(); 499 std::stringlowercase = getLowercase(fragment);499 const std::string& lowercase = getLowercase(fragment); 500 500 for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 501 501 { 502 if ( (*it).lowercaseComparison())503 { 504 if ( (*it).getComparable().find(lowercase) == 0 || fragment == "")502 if (it->lowercaseComparison()) 503 { 504 if (it->getComparable().find(lowercase) == 0 || fragment.empty()) 505 505 CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it); 506 506 } 507 507 else 508 508 { 509 if ( (*it).getComparable().find(fragment) == 0 || fragment == "")509 if (it->getComparable().find(fragment) == 0 || fragment.empty()) 510 510 CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it); 511 511 } … … 515 515 Identifier* CommandExecutor::getPossibleIdentifier(const std::string& name) 516 516 { 517 std::stringlowercase = getLowercase(name);517 const std::string& lowercase = getLowercase(name); 518 518 std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMap().find(lowercase); 519 519 if ((it != Identifier::getLowercaseStringIdentifierMapEnd()) && (*it).second->hasConsoleCommands()) … … 525 525 ConsoleCommand* CommandExecutor::getPossibleCommand(const std::string& name, Identifier* identifier) 526 526 { 527 std::stringlowercase = getLowercase(name);527 const std::string& lowercase = getLowercase(name); 528 528 if (!identifier) 529 529 { … … 541 541 } 542 542 543 std::stringCommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param)543 const std::string& CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param) 544 544 { 545 545 CommandExecutor::createArgumentCompletionList(command, param); 546 546 547 std::stringlowercase = getLowercase(name);547 const std::string& lowercase = getLowercase(name); 548 548 for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 549 549 { 550 if ( (*it).lowercaseComparison())551 { 552 if ( (*it).getComparable() == lowercase)553 return (*it).getString();550 if (it->lowercaseComparison()) 551 { 552 if (it->getComparable() == lowercase) 553 return it->getString(); 554 554 } 555 555 else 556 556 { 557 if ( (*it).getComparable() == name)558 return (*it).getString();559 } 560 } 561 562 return "";557 if (it->getComparable() == name) 558 return it->getString(); 559 } 560 } 561 562 return BLANKSTRING; 563 563 } 564 564 … … 589 589 else if (list.size() == 1) 590 590 { 591 return ((* (*list.begin()).first) + " ");592 } 593 else 594 { 595 std::string output = "";591 return ((*list.begin()->first) + ' '); 592 } 593 else 594 { 595 std::string output; 596 596 for (unsigned int i = 0; true; i++) 597 597 { … … 630 630 else if (list.size() == 1) 631 631 { 632 return ( (*list.begin()).getComparable() + " ");633 } 634 else 635 { 636 std::string output = "";632 return (list.begin()->getComparable() + ' '); 633 } 634 else 635 { 636 std::string output; 637 637 for (unsigned int i = 0; true; i++) 638 638 { … … 641 641 for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it) 642 642 { 643 std::string argumentComparable = (*it).getComparable();644 std::string argument = (*it).getString();643 const std::string& argumentComparable = it->getComparable(); 644 const std::string& argument = it->getString(); 645 645 if (argument.size() > i) 646 646 { -
code/branches/presentation2/src/libraries/core/CommandExecutor.h
r5781 r6394 90 90 static unsigned int argumentsGiven(); 91 91 static bool enoughArgumentsGiven(ConsoleCommand* command); 92 static std::stringgetArgument(unsigned int index);93 static std::stringgetLastArgument();92 static const std::string& getArgument(unsigned int index); 93 static const std::string& getLastArgument(); 94 94 95 95 static void createListOfPossibleIdentifiers(const std::string& fragment); … … 99 99 static Identifier* getPossibleIdentifier(const std::string& name); 100 100 static ConsoleCommand* getPossibleCommand(const std::string& name, Identifier* identifier = 0); 101 static std::stringgetPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param);101 static const std::string& getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param); 102 102 103 103 static void createArgumentCompletionList(ConsoleCommand* command, unsigned int param); -
code/branches/presentation2/src/libraries/core/CommandLineParser.cc
r6021 r6394 63 63 this->value_ = temp; 64 64 } 65 else if (value == "")65 else if (value.empty()) 66 66 { 67 67 this->bHasDefaultValue_ = false; … … 140 140 OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(), 141 141 "Cannot have two command line shortcut with the same name."); 142 if ( it->second->getShortcut() != "")142 if (!it->second->getShortcut().empty()) 143 143 cmdLineArgsShortcut_[it->second->getShortcut()] = it->second; 144 144 } … … 165 165 { 166 166 // negative number as a value 167 value += arguments[i] + " ";167 value += arguments[i] + ' '; 168 168 } 169 169 else … … 173 173 // save old data first 174 174 value = removeTrailingWhitespaces(value); 175 if ( name != "")175 if (!name.empty()) 176 176 { 177 177 checkFullArgument(name, value, bParsingFile); 178 name = "";179 assert(shortcut == "");178 name.clear(); 179 assert(shortcut.empty()); 180 180 } 181 else if ( shortcut != "")181 else if (!shortcut.empty()) 182 182 { 183 183 checkShortcut(shortcut, value, bParsingFile); 184 shortcut = "";185 assert(name == "");184 shortcut.clear(); 185 assert(name.empty()); 186 186 } 187 187 … … 198 198 199 199 // reset value string 200 value = "";200 value.clear(); 201 201 } 202 202 } … … 205 205 // value string 206 206 207 if (name == "" && shortcut == "")207 if (name.empty() && shortcut.empty()) 208 208 { 209 209 ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n"); … … 218 218 // parse last argument 219 219 value = removeTrailingWhitespaces(value); 220 if ( name != "")220 if (!name.empty()) 221 221 { 222 222 checkFullArgument(name, value, bParsingFile); 223 assert(shortcut == "");224 } 225 else if ( shortcut != "")223 assert(shortcut.empty()); 224 } 225 else if (!shortcut.empty()) 226 226 { 227 227 checkShortcut(shortcut, value, bParsingFile); 228 assert(name == "");228 assert(name.empty()); 229 229 } 230 230 } … … 291 291 it != inst.cmdLineArgs_.end(); ++it) 292 292 { 293 if ( it->second->getShortcut() != "")293 if (!it->second->getShortcut().empty()) 294 294 infoStr << " [-" << it->second->getShortcut() << "] "; 295 295 else 296 296 infoStr << " "; 297 infoStr << "--" << it->second->getName() << " ";297 infoStr << "--" << it->second->getName() << ' '; 298 298 if (it->second->getValue().getType() != MT_Type::Bool) 299 299 infoStr << "ARG "; … … 347 347 void CommandLineParser::_parseFile() 348 348 { 349 std::stringfilename = CommandLineParser::getValue("optionsFile").getString();349 const std::string& filename = CommandLineParser::getValue("optionsFile").getString(); 350 350 351 351 // look for additional arguments in given file or start.ini as default -
code/branches/presentation2/src/libraries/core/ConfigFileManager.cc
r6387 r6394 99 99 this->value_ = value; 100 100 else 101 this->value_ = "\"" + addSlashes(stripEnclosingQuotes(value)) + "\"";101 this->value_ = '"' + addSlashes(stripEnclosingQuotes(value)) + '"'; 102 102 } 103 103 … … 112 112 std::string ConfigFileEntryValue::getFileEntry() const 113 113 { 114 if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)115 return (this->name_ + "="+ this->value_);116 else 117 return (this->name_ + "="+ this->value_ + " " + this->additionalComment_);114 if (this->additionalComment_.empty()) 115 return (this->name_ + '=' + this->value_); 116 else 117 return (this->name_ + '=' + this->value_ + " " + this->additionalComment_); 118 118 } 119 119 … … 124 124 std::string ConfigFileEntryVectorValue::getFileEntry() const 125 125 { 126 if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)127 return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]" + "="+ this->value_);128 else 129 return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]=" + this->value_ + " "+ this->additionalComment_);126 if (this->additionalComment_.empty()) 127 return (this->name_ + '[' + multi_cast<std::string>(this->index_) + ']' + '=' + this->value_); 128 else 129 return (this->name_ + '[' + multi_cast<std::string>(this->index_) + "]=" + this->value_ + ' ' + this->additionalComment_); 130 130 } 131 131 … … 171 171 std::string ConfigFileSection::getFileEntry() const 172 172 { 173 if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)174 return ( "[" + this->name_ + "]");175 else 176 return ( "["+ this->name_ + "] " + this->additionalComment_);173 if (this->additionalComment_.empty()) 174 return ('[' + this->name_ + ']'); 175 else 176 return ('[' + this->name_ + "] " + this->additionalComment_); 177 177 } 178 178 … … 251 251 std::getline(file, line); 252 252 253 std::stringtemp = getStripped(line);253 const std::string& temp = getStripped(line); 254 254 if (!isEmpty(temp) && !isComment(temp)) 255 255 { … … 261 261 { 262 262 // New section 263 std::stringcomment = line.substr(pos2 + 1);263 const std::string& comment = line.substr(pos2 + 1); 264 264 if (isComment(comment)) 265 265 newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment); … … 293 293 commentposition = getNextCommentPosition(line, commentposition + 1); 294 294 } 295 std::string value = "", comment = "";295 std::string value, comment; 296 296 if (commentposition == std::string::npos) 297 297 { -
code/branches/presentation2/src/libraries/core/ConfigFileManager.h
r6374 r6394 89 89 { 90 90 public: 91 inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : name_(name), value_(value), bString_(bString), additionalComment_(additionalComment) {} 91 inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") 92 : name_(name) 93 , value_(value) 94 , bString_(bString) 95 , additionalComment_(additionalComment) 96 {} 92 97 inline virtual ~ConfigFileEntryValue() {} 93 98 … … 173 178 174 179 public: 175 inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") : name_(name), additionalComment_(additionalComment), bUpdated_(false) {} 180 inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") 181 : name_(name) 182 , additionalComment_(additionalComment) 183 , bUpdated_(false) 184 {} 176 185 ~ConfigFileSection(); 177 186 … … 244 253 { this->getSection(section)->setValue(name, value, bString); this->save(); } 245 254 inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString) 246 { std::stringoutput = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }255 { const std::string& output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; } 247 256 248 257 inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString) 249 258 { this->getSection(section)->setValue(name, index, value, bString); this->save(); } 250 259 inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString) 251 { std::stringoutput = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }260 { const std::string& output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; } 252 261 253 262 inline void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0) -
code/branches/presentation2/src/libraries/core/ConsoleCommandCompilation.cc
r6185 r6394 35 35 #include "util/Debug.h" 36 36 #include "util/ExprParser.h" 37 #include "util/StringUtils.h" 37 38 #include "ConsoleCommand.h" 38 39 … … 142 143 } 143 144 144 std::string output = "";145 std::string output; 145 146 while (file.good() && !file.eof()) 146 147 { … … 166 167 COUT(3) << "Greetings from the restaurant at the end of the universe." << std::endl; 167 168 } 168 if ( expr.getRemains() != "")169 if (!expr.getRemains().empty()) 169 170 { 170 COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << "'"<< std::endl;171 COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << std::endl; 171 172 } 172 173 return static_cast<float>(expr.getResult()); -
code/branches/presentation2/src/libraries/core/DynLib.cc
r6073 r6394 70 70 COUT(2) << "Loading module " << mName << std::endl; 71 71 72 std::stringname = mName;72 const std::string& name = mName; 73 73 #ifdef ORXONOX_PLATFORM_LINUX 74 74 // dlopen() does not add .so to the filename, like windows does for .dll … … 132 132 return std::string(mac_errorBundle()); 133 133 #else 134 return std::string("");134 return ""; 135 135 #endif 136 136 } -
code/branches/presentation2/src/libraries/core/Event.cc
r6387 r6394 53 53 if (this->bProcessingEvent_) 54 54 { 55 COUT(2) << "Warning: Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << "\""<< std::endl;55 COUT(2) << "Warning: Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << '"' << std::endl; 56 56 return; 57 57 } -
code/branches/presentation2/src/libraries/core/EventIncludes.h
r6388 r6394 66 66 67 67 #define XMLPortEventStateIntern(name, classname, statename, xmlelement, mode) \ 68 static orxonox::ExecutorMember<classname>* xmlsetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \69 static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \68 static orxonox::ExecutorMember<classname>* xmlsetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \ 69 static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \ 70 70 XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true) 71 71 -
code/branches/presentation2/src/libraries/core/Executor.cc
r5738 r6394 73 73 { 74 74 // only one param: check if there are params given, otherwise try to use default values 75 std::string temp = getStripped(params); 76 if ((temp != "") && (temp.size() != 0)) 75 if (!getStripped(params).empty()) 77 76 { 78 77 param[0] = params; -
code/branches/presentation2/src/libraries/core/Executor.h
r5738 r6394 63 63 else if (paramCount == 1) \ 64 64 { \ 65 std::stringtemp = getStripped(params); \66 if ( (temp != "") && (temp.size() != 0)) \65 const std::string& temp = getStripped(params); \ 66 if (!temp.empty()) \ 67 67 { \ 68 68 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; \ … … 187 187 { return this->functor_->getTypenameReturnvalue(); } 188 188 189 inline void setName(const std::string name)189 inline void setName(const std::string& name) 190 190 { this->name_ = name; } 191 191 inline const std::string& getName() const -
code/branches/presentation2/src/libraries/core/Functor.h
r5929 r6394 35 35 #include "util/Debug.h" 36 36 #include "util/MultiType.h" 37 #include "util/StringUtils.h"38 37 39 38 namespace orxonox -
code/branches/presentation2/src/libraries/core/GraphicsManager.cc
r6386 r6394 208 208 shared_array<char> data(new char[output.str().size()]); 209 209 // Debug optimisations 210 const std::string outputStr = output.str();210 const std::string& outputStr = output.str(); 211 211 char* rawData = data.get(); 212 212 for (unsigned i = 0; i < outputStr.size(); ++i) … … 238 238 COUT(3) << "Setting up Ogre..." << std::endl; 239 239 240 if (ogreConfigFile_ == "")240 if (ogreConfigFile_.empty()) 241 241 { 242 242 COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl; 243 243 ModifyConfigValue(ogreConfigFile_, tset, "config.cfg"); 244 244 } 245 if (ogreLogFile_ == "")245 if (ogreLogFile_.empty()) 246 246 { 247 247 COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl; … … 285 285 { 286 286 // just to make sure the next statement doesn't segfault 287 if (ogrePluginsDirectory_ == "")288 ogrePluginsDirectory_ = ".";287 if (ogrePluginsDirectory_.empty()) 288 ogrePluginsDirectory_ = '.'; 289 289 290 290 boost::filesystem::path folder(ogrePluginsDirectory_); -
code/branches/presentation2/src/libraries/core/IOConsole.cc
r6380 r6394 307 307 this->cout_ << "\033[u"; 308 308 if (this->buffer_->getCursorPosition() > 0) 309 this->cout_ << "\033[" << this->buffer_->getCursorPosition() << "C";309 this->cout_ << "\033[" << this->buffer_->getCursorPosition() << 'C'; 310 310 } 311 311 -
code/branches/presentation2/src/libraries/core/IRC.cc
r5781 r6394 33 33 #include "util/Convert.h" 34 34 #include "util/Exception.h" 35 #include "util/StringUtils.h" 35 36 #include "ConsoleCommand.h" 36 37 #include "CoreIncludes.h" … … 103 104 void IRC::say(const std::string& message) 104 105 { 105 if (IRC::eval("irk::say $conn #orxonox {" + message + "}"))106 if (IRC::eval("irk::say $conn #orxonox {" + message + '}')) 106 107 IRC::tcl_say(Tcl::object(), Tcl::object(IRC::getInstance().nickname_), Tcl::object(message)); 107 108 } … … 109 110 void IRC::msg(const std::string& channel, const std::string& message) 110 111 { 111 if (IRC::eval("irk::say $conn " + channel + " {" + message + "}"))112 if (IRC::eval("irk::say $conn " + channel + " {" + message + '}')) 112 113 IRC::tcl_privmsg(Tcl::object(channel), Tcl::object(IRC::getInstance().nickname_), Tcl::object(message)); 113 114 } … … 131 132 void IRC::tcl_action(Tcl::object const &channel, Tcl::object const &nick, Tcl::object const &args) 132 133 { 133 COUT(0) << "IRC> * " << nick.get() << " "<< stripEnclosingBraces(args.get()) << std::endl;134 COUT(0) << "IRC> * " << nick.get() << ' ' << stripEnclosingBraces(args.get()) << std::endl; 134 135 } 135 136 -
code/branches/presentation2/src/libraries/core/Identifier.cc
r5929 r6394 410 410 if (it != this->configValues_.end()) 411 411 { 412 COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << "."<< std::endl;412 COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << std::endl; 413 413 delete (it->second); 414 414 } … … 458 458 if (it != this->consoleCommands_.end()) 459 459 { 460 COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << "."<< std::endl;460 COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << '.' << std::endl; 461 461 delete (it->second); 462 462 } … … 524 524 if (it != this->xmlportParamContainers_.end()) 525 525 { 526 COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << "."<< std::endl;526 COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << '.' << std::endl; 527 527 delete (it->second); 528 528 } … … 555 555 if (it != this->xmlportObjectContainers_.end()) 556 556 { 557 COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << "."<< std::endl;557 COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << std::endl; 558 558 delete (it->second); 559 559 } … … 573 573 { 574 574 if (it != list.begin()) 575 out << " ";575 out << ' '; 576 576 out << (*it)->getName(); 577 577 } -
code/branches/presentation2/src/libraries/core/Identifier.h
r5929 r6394 411 411 { 412 412 // Get the name of the class 413 std::stringname = typeid(T).name();413 const std::string& name = typeid(T).name(); 414 414 415 415 // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used. -
code/branches/presentation2/src/libraries/core/Language.cc
r6121 r6394 62 62 { 63 63 // Check if the translation is more than just an empty string 64 if ( (localisation != "") && (localisation.size() > 0))64 if (!localisation.empty()) 65 65 { 66 66 this->localisedEntry_ = localisation; … … 130 130 } 131 131 132 COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << "!"<< std::endl;132 COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << '!' << std::endl; 133 133 return it->second; 134 134 } … … 199 199 COUT(4) << "Read default language file." << std::endl; 200 200 201 std::stringfilepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);201 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_); 202 202 203 203 // This creates the file if it's not existing … … 224 224 225 225 // Check if the line is empty 226 if ( (lineString != "") && (lineString.size() > 0))226 if (!lineString.empty()) 227 227 { 228 228 size_t pos = lineString.find('='); … … 248 248 COUT(4) << "Read translated language file (" << Core::getInstance().getLanguage() << ")." << std::endl; 249 249 250 std::stringfilepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage());250 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage()); 251 251 252 252 // Open the file … … 259 259 COUT(1) << "Error: Couldn't open file " << getFilename(Core::getInstance().getLanguage()) << " to read the translated language entries!" << std::endl; 260 260 Core::getInstance().resetLanguage(); 261 COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << "."<< std::endl;261 COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << '.' << std::endl; 262 262 return; 263 263 } … … 270 270 271 271 // Check if the line is empty 272 if ( (lineString != "") && (lineString.size() > 0))272 if (!lineString.empty()) 273 273 { 274 274 size_t pos = lineString.find('='); … … 302 302 COUT(4) << "Language: Write default language file." << std::endl; 303 303 304 std::stringfilepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);304 const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_); 305 305 306 306 // Open the file … … 318 318 for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it) 319 319 { 320 file << (*it).second->getLabel() << "="<< (*it).second->getDefault() << std::endl;320 file << (*it).second->getLabel() << '=' << (*it).second->getDefault() << std::endl; 321 321 } 322 322 -
code/branches/presentation2/src/libraries/core/Loader.cc
r5929 r6394 165 165 rootNamespace->XMLPort(rootElement, XMLPort::LoadObject); 166 166 167 COUT(0) << "Finished loading " << file->getFilename() << "."<< std::endl;167 COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl; 168 168 169 169 COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString(" ") << std::endl; … … 174 174 { 175 175 COUT(1) << std::endl; 176 COUT(1) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ":"<< std::endl;176 COUT(1) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl; 177 177 COUT(1) << ex.what() << std::endl; 178 178 COUT(1) << "Loading aborted." << std::endl; … … 182 182 { 183 183 COUT(1) << std::endl; 184 COUT(1) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ":"<< std::endl;184 COUT(1) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl; 185 185 COUT(1) << ex.what() << std::endl; 186 186 COUT(1) << "Loading aborted." << std::endl; … … 190 190 { 191 191 COUT(1) << std::endl; 192 COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ":"<< std::endl;192 COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl; 193 193 COUT(1) << Exception::handleMessage() << std::endl; 194 194 COUT(1) << "Loading aborted." << std::endl; … … 218 218 std::string Loader::replaceLuaTags(const std::string& text) 219 219 { 220 // c hreate map with all Lua tags220 // create map with all Lua tags 221 221 std::map<size_t, bool> luaTags; 222 222 { … … 300 300 { 301 301 // count ['='[ and ]'='] and replace tags with print([[ and ]]) 302 std::stringtemp = text.substr(start, end - start);302 const std::string& temp = text.substr(start, end - start); 303 303 { 304 304 size_t pos = 0; … … 345 345 } 346 346 } 347 std::string equalSigns = "";347 std::string equalSigns; 348 348 for(unsigned int i = 0; i < equalSignCounter; i++) 349 349 { 350 equalSigns += "=";350 equalSigns += '='; 351 351 } 352 output << "print([" + equalSigns + "[" + temp + "]"+ equalSigns +"])";352 output << "print([" + equalSigns + '[' + temp + ']' + equalSigns +"])"; 353 353 start = end + 5; 354 354 } -
code/branches/presentation2/src/libraries/core/Namespace.cc
r5781 r6394 173 173 { 174 174 if (i > 0) 175 output += "\n";175 output += '\n'; 176 176 177 177 output += (*it)->toString(indentation); -
code/branches/presentation2/src/libraries/core/NamespaceNode.cc
r5781 r6394 50 50 std::set<NamespaceNode*> nodes; 51 51 52 if ( (name.size() == 0) || (name == ""))52 if (name.empty()) 53 53 { 54 54 nodes.insert(this); … … 154 154 output += ", "; 155 155 156 output += (*it).second->toString();156 output += it->second->toString(); 157 157 } 158 158 159 output += ")";159 output += ')'; 160 160 } 161 161 … … 165 165 std::string NamespaceNode::toString(const std::string& indentation) const 166 166 { 167 std::string output = (indentation + this->name_ + "\n");167 std::string output = (indentation + this->name_ + '\n'); 168 168 169 169 for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it) 170 output += (*it).second->toString(indentation + " ");170 output += it->second->toString(indentation + " "); 171 171 172 172 return output; -
code/branches/presentation2/src/libraries/core/OrxonoxClass.cc
r6348 r6394 57 57 { 58 58 // if (!this->requestedDestruction_) 59 // COUT(2) << "Warning: Destroyed object without destroy() (" << this->getIdentifier()->getName() << ")"<< std::endl;59 // COUT(2) << "Warning: Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << std::endl; 60 60 61 61 assert(this->referenceCount_ <= 0); -
code/branches/presentation2/src/libraries/core/PathConfig.cc
r6105 r6394 226 226 if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue()) 227 227 { 228 std::stringdirectory(CommandLineParser::getValue("writingPathSuffix").getString());228 const std::string& directory(CommandLineParser::getValue("writingPathSuffix").getString()); 229 229 configPath_ = configPath_ / directory; 230 230 logPath_ = logPath_ / directory; … … 256 256 257 257 // We search for helper files with the following extension 258 std::stringmoduleextension = specialConfig::moduleExtension;258 const std::string& moduleextension = specialConfig::moduleExtension; 259 259 size_t moduleextensionlength = moduleextension.size(); 260 260 261 261 // Add that path to the PATH variable in case a module depends on another one 262 std::string pathVariable = getenv("PATH");263 putenv(const_cast<char*>(("PATH=" + pathVariable + ";"+ modulePath_.string()).c_str()));262 std::string pathVariable(getenv("PATH")); 263 putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str())); 264 264 265 265 // Make sure the path exists, otherwise don't load modules … … 273 273 while (file != end) 274 274 { 275 std::stringfilename = file->BOOST_LEAF_FUNCTION();275 const std::string& filename = file->BOOST_LEAF_FUNCTION(); 276 276 277 277 // Check if the file ends with the exension in question … … 281 281 { 282 282 // We've found a helper file 283 std::stringlibrary = filename.substr(0, filename.size() - moduleextensionlength);283 const std::string& library = filename.substr(0, filename.size() - moduleextensionlength); 284 284 modulePaths.push_back((modulePath_ / library).file_string()); 285 285 } -
code/branches/presentation2/src/libraries/core/Shell.cc
r6379 r6394 226 226 } 227 227 228 std::stringShell::getFromHistory() const228 const std::string& Shell::getFromHistory() const 229 229 { 230 230 unsigned int index = mod(static_cast<int>(this->historyOffset_) - static_cast<int>(this->historyPosition_), this->maxHistoryLength_); … … 232 232 return this->commandHistory_[index]; 233 233 else 234 return "";234 return BLANKSTRING; 235 235 } 236 236 … … 251 251 newline = (!eof && !fail); 252 252 253 if (!newline && output == "")253 if (!newline && output.empty()) 254 254 break; 255 255 … … 400 400 return; 401 401 unsigned int cursorPosition = this->getCursorPosition(); 402 std::stringinput_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning of the inputline until the cursor position402 const std::string& input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning of the inputline until the cursor position 403 403 for (unsigned int newPos = this->historyPosition_ + 1; newPos <= this->historyOffset_; newPos++) 404 404 { … … 418 418 return; 419 419 unsigned int cursorPosition = this->getCursorPosition(); 420 std::stringinput_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning420 const std::string& input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning 421 421 for (unsigned int newPos = this->historyPosition_ - 1; newPos > 0; newPos--) 422 422 { -
code/branches/presentation2/src/libraries/core/Shell.h
r6375 r6394 96 96 { return this->inputBuffer_->getCursorPosition(); } 97 97 98 inline std::stringgetInput() const98 inline const std::string& getInput() const 99 99 { return this->inputBuffer_->get(); } 100 100 … … 118 118 119 119 void addToHistory(const std::string& command); 120 std::stringgetFromHistory() const;120 const std::string& getFromHistory() const; 121 121 void clearInput(); 122 122 // OutputListener -
code/branches/presentation2/src/libraries/core/SubclassIdentifier.h
r5929 r6394 98 98 if (identifier) 99 99 { 100 COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!"<< std::endl;100 COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << std::endl; 101 101 COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl; 102 102 } … … 166 166 { 167 167 COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl; 168 COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!"<< std::endl;168 COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << std::endl; 169 169 COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl; 170 170 } -
code/branches/presentation2/src/libraries/core/TclBind.cc
r5929 r6394 101 101 { 102 102 Tcl::interpreter* interpreter = new Tcl::interpreter(); 103 std::stringlibpath = TclBind::getTclLibraryPath();103 const std::string& libpath = TclBind::getTclLibraryPath(); 104 104 105 105 try 106 106 { 107 if ( libpath != "")108 interpreter->eval("set tcl_library \"" + libpath + "\"");107 if (!libpath.empty()) 108 interpreter->eval("set tcl_library \"" + libpath + '"'); 109 109 110 110 Tcl_Init(interpreter->get()); … … 136 136 COUT(4) << "Tcl_query: " << args.get() << std::endl; 137 137 138 std::stringcommand = stripEnclosingBraces(args.get());138 const std::string& command = stripEnclosingBraces(args.get()); 139 139 140 140 if (!CommandExecutor::execute(command, false)) … … 152 152 { 153 153 COUT(4) << "Tcl_execute: " << args.get() << std::endl; 154 std::stringcommand = stripEnclosingBraces(args.get());154 const std::string& command = stripEnclosingBraces(args.get()); 155 155 156 156 if (!CommandExecutor::execute(command, false)) … … 166 166 try 167 167 { 168 std::stringoutput = TclBind::getInstance().interpreter_->eval("uplevel #0 " + tclcode);169 if ( output != "")168 const std::string& output = TclBind::getInstance().interpreter_->eval("uplevel #0 " + tclcode); 169 if (!output.empty()) 170 170 { 171 171 COUT(0) << "tcl> " << output << std::endl; … … 182 182 } 183 183 184 void TclBind::bgerror( std::stringerror)184 void TclBind::bgerror(const std::string& error) 185 185 { 186 186 COUT(1) << "Tcl background error: " << stripEnclosingBraces(error) << std::endl; -
code/branches/presentation2/src/libraries/core/TclBind.h
r5781 r6394 46 46 47 47 static std::string tcl(const std::string& tclcode); 48 static void bgerror( std::stringerror);48 static void bgerror(const std::string& error); 49 49 50 50 void setDataPath(const std::string& datapath); -
code/branches/presentation2/src/libraries/core/TclThreadManager.cc
r6183 r6394 39 39 #include "util/Convert.h" 40 40 #include "util/Exception.h" 41 #include "util/StringUtils.h" 41 42 #include "CommandExecutor.h" 42 43 #include "ConsoleCommand.h" … … 252 253 void TclThreadManager::initialize(TclInterpreterBundle* bundle) 253 254 { 254 std::stringid_string = getConvertedValue<unsigned int, std::string>(bundle->id_);255 const std::string& id_string = getConvertedValue<unsigned int, std::string>(bundle->id_); 255 256 256 257 // Initialize the new interpreter … … 403 404 { 404 405 // This query would lead to a deadlock - return with an error 405 TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + " "+ getConvertedValue<unsigned int, std::string>(source_bundle->id_) \406 TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + getConvertedValue<unsigned int, std::string>(source_bundle->id_) \ 406 407 + " -> " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) \ 407 408 + "), couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) \ 408 + " from other interpreter with ID " + getConvertedValue<unsigned int, std::string>(source_bundle->id_) + ".");409 + " from other interpreter with ID " + getConvertedValue<unsigned int, std::string>(source_bundle->id_) + '.'); 409 410 } 410 411 else … … 524 525 std::string TclThreadManager::dumpList(const std::list<unsigned int>& list) 525 526 { 526 std::string output = "";527 std::string output; 527 528 for (std::list<unsigned int>::const_iterator it = list.begin(); it != list.end(); ++it) 528 529 { 529 530 if (it != list.begin()) 530 output += " ";531 output += ' '; 531 532 532 533 output += getConvertedValue<unsigned int, std::string>(*it); … … 600 601 @param command the Command to execute 601 602 */ 602 void tclThread(TclInterpreterBundle* bundle, std::stringcommand)603 void tclThread(TclInterpreterBundle* bundle, const std::string& command) 603 604 { 604 605 TclThreadManager::debug("TclThread_execute: " + command); … … 613 614 @param file The name of the file that should be executed by the non-interactive interpreter. 614 615 */ 615 void sourceThread( std::stringfile)616 void sourceThread(const std::string& file) 616 617 { 617 618 TclThreadManager::debug("TclThread_source: " + file); … … 651 652 652 653 // Initialize the non-interactive interpreter (like in @ref TclBind::createTclInterpreter but exception safe) 653 std::stringlibpath = TclBind::getTclLibraryPath();654 if ( libpath != "")655 TclThreadManager::eval(bundle, "set tcl_library \"" + libpath + "\"", "source");654 const std::string& libpath = TclBind::getTclLibraryPath(); 655 if (!libpath.empty()) 656 TclThreadManager::eval(bundle, "set tcl_library \"" + libpath + '"', "source"); 656 657 int cc = Tcl_Init(interp); 657 658 TclThreadManager::eval(bundle, "source \"" + TclBind::getInstance().getTclDataPath() + "/init.tcl\"", "source"); -
code/branches/presentation2/src/libraries/core/TclThreadManager.h
r6183 r6394 48 48 friend class Singleton<TclThreadManager>; 49 49 friend class TclBind; 50 friend _CoreExport void tclThread(TclInterpreterBundle* bundle, std::stringcommand);51 friend _CoreExport void sourceThread( std::stringfile);50 friend _CoreExport void tclThread(TclInterpreterBundle* bundle, const std::string& command); 51 friend _CoreExport void sourceThread(const std::string& file); 52 52 friend _CoreExport int Tcl_OrxonoxAppInit(Tcl_Interp* interp); 53 53 … … 95 95 }; 96 96 97 _CoreExport void tclThread(TclInterpreterBundle* bundle, std::stringcommand);98 _CoreExport void sourceThread( std::stringfile);97 _CoreExport void tclThread(TclInterpreterBundle* bundle, const std::string& command); 98 _CoreExport void sourceThread(const std::string& file); 99 99 _CoreExport int Tcl_OrxonoxAppInit(Tcl_Interp* interp); 100 100 } -
code/branches/presentation2/src/libraries/core/Template.cc
r5781 r6394 79 79 SUPER(Template, changedName); 80 80 81 if ( this->getName() != "")81 if (!this->getName().empty()) 82 82 { 83 83 std::map<std::string, Template*>::iterator it; -
code/branches/presentation2/src/libraries/core/Template.h
r5781 r6394 48 48 49 49 inline void setLink(const std::string& link) 50 { this->link_ = link; this->bIsLink_ = (link != ""); }50 { this->link_ = link; this->bIsLink_ = !link.empty(); } 51 51 inline const std::string& getLink() const 52 52 { return this->link_; } -
code/branches/presentation2/src/libraries/core/XMLPort.h
r6117 r6394 51 51 #include "util/MultiType.h" 52 52 #include "util/OrxAssert.h" 53 #include "util/StringUtils.h" 53 54 #include "Identifier.h" 54 55 #include "Executor.h" … … 316 317 { return this->paramname_; } 317 318 318 virtual XMLPortParamContainer& description(const std::string description) = 0;319 virtual XMLPortParamContainer& description(const std::string& description) = 0; 319 320 virtual const std::string& getDescription() = 0; 320 321 … … 344 345 345 346 public: 346 XMLPortClassParamContainer(const std::string paramname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor)347 XMLPortClassParamContainer(const std::string& paramname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor) 347 348 { 348 349 this->paramname_ = paramname; … … 385 386 } 386 387 std::map<std::string, std::string>::const_iterator it = this->owner_->xmlAttributes_.find(getLowercase(this->paramname_)); 387 std::string attributeValue ("");388 std::string attributeValue; 388 389 if (it != this->owner_->xmlAttributes_.end()) 389 390 attributeValue = it->second; … … 407 408 { 408 409 COUT(1) << std::endl; 409 COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getFilename() << ":"<< std::endl;410 COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getFilename() << ':' << std::endl; 410 411 COUT(1) << ex.what() << std::endl; 411 412 } … … 435 436 } 436 437 437 virtual XMLPortParamContainer& description(const std::string description)438 virtual XMLPortParamContainer& description(const std::string& description) 438 439 { this->loadexecutor_->setDescription(description); return (*this); } 439 440 virtual const std::string& getDescription() … … 497 498 { return this->sectionname_; } 498 499 499 virtual XMLPortObjectContainer& description(const std::string description) = 0;500 virtual XMLPortObjectContainer& description(const std::string& description) = 0; 500 501 virtual const std::string& getDescription() = 0; 501 502 … … 513 514 { 514 515 public: 515 XMLPortClassObjectContainer(const std::string sectionname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor, bool bApplyLoaderMask, bool bLoadBefore)516 XMLPortClassObjectContainer(const std::string& sectionname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor, bool bApplyLoaderMask, bool bLoadBefore) 516 517 { 517 518 this->sectionname_ = sectionname; … … 538 539 { 539 540 Element* xmlsubelement; 540 if ( (this->sectionname_ != "") && (this->sectionname_.size() > 0))541 if (!this->sectionname_.empty()) 541 542 xmlsubelement = xmlelement.FirstChildElement(this->sectionname_, false); 542 543 else … … 570 571 { 571 572 newObject->XMLPort(*child, XMLPort::LoadObject); 572 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")"<< std::endl;573 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl; 573 574 } 574 575 else 575 576 { 576 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")"<< std::endl;577 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl; 577 578 } 578 579 … … 609 610 else 610 611 { 611 if ( this->sectionname_ != "")612 if (!this->sectionname_.empty()) 612 613 { 613 614 COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl; … … 624 625 { 625 626 COUT(1) << std::endl; 626 COUT(1) << "An error occurred in XMLPort.h while loading a '" << ClassIdentifier<O>::getIdentifier()->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ":"<< std::endl;627 COUT(1) << "An error occurred in XMLPort.h while loading a '" << ClassIdentifier<O>::getIdentifier()->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ':' << std::endl; 627 628 COUT(1) << ex.what() << std::endl; 628 629 } … … 635 636 } 636 637 637 virtual XMLPortObjectContainer& description(const std::string description)638 virtual XMLPortObjectContainer& description(const std::string& description) 638 639 { this->loadexecutor_->setDescription(description); return (*this); } 639 640 virtual const std::string& getDescription() -
code/branches/presentation2/src/libraries/core/input/Button.cc
r5929 r6394 116 116 for (unsigned int iCommand = 0; iCommand < commandStrings.size(); iCommand++) 117 117 { 118 if ( commandStrings[iCommand] != "")118 if (!commandStrings[iCommand].empty()) 119 119 { 120 120 SubString tokens(commandStrings[iCommand], " ", SubString::WhiteSpaces, false, … … 123 123 KeybindMode::Value mode = KeybindMode::None; 124 124 float paramModifier = 1.0f; 125 std::string commandStr = "";125 std::string commandStr; 126 126 127 127 for (unsigned int iToken = 0; iToken < tokens.size(); ++iToken) 128 128 { 129 std::stringtoken = getLowercase(tokens[iToken]);129 const std::string& token = getLowercase(tokens[iToken]); 130 130 131 131 if (token == "onpress") … … 159 159 // we interpret everything from here as a command string 160 160 while (iToken != tokens.size()) 161 commandStr += tokens[iToken++] + " ";162 } 163 } 164 165 if (commandStr == "")161 commandStr += tokens[iToken++] + ' '; 162 } 163 } 164 165 if (commandStr.empty()) 166 166 { 167 167 parseError("No command string given.", false); … … 242 242 } 243 243 244 inline void Button::parseError( std::stringmessage, bool serious)244 inline void Button::parseError(const std::string& message, bool serious) 245 245 { 246 246 if (serious) -
code/branches/presentation2/src/libraries/core/input/Button.h
r5781 r6394 76 76 77 77 private: 78 void parseError( std::stringmessage, bool serious);78 void parseError(const std::string& message, bool serious); 79 79 }; 80 80 -
code/branches/presentation2/src/libraries/core/input/InputBuffer.cc
r6177 r6394 39 39 RegisterRootObject(InputBuffer); 40 40 41 this->buffer_ = "";42 41 this->cursor_ = 0; 43 42 this->maxLength_ = 1024; … … 62 61 this->maxLength_ = 1024; 63 62 this->allowedChars_ = allowedChars; 64 this->buffer_ = "";65 63 this->cursor_ = 0; 66 64 … … 138 136 void InputBuffer::clear(bool update) 139 137 { 140 this->buffer_ = "";138 this->buffer_.clear(); 141 139 this->cursor_ = 0; 142 140 … … 188 186 bool InputBuffer::charIsAllowed(const char& input) 189 187 { 190 if (this->allowedChars_ == "")188 if (this->allowedChars_.empty()) 191 189 return true; 192 190 else -
code/branches/presentation2/src/libraries/core/input/InputManager.cc
r6388 r6394 297 297 if (device == NULL) 298 298 continue; 299 std::stringclassName = device->getClassName();299 const std::string& className = device->getClassName(); 300 300 try 301 301 { … … 579 579 InputState* InputManager::createInputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority) 580 580 { 581 if (name == "")581 if (name.empty()) 582 582 return 0; 583 583 if (statesByName_.find(name) == statesByName_.end()) -
code/branches/presentation2/src/libraries/core/input/JoyStick.cc
r5781 r6394 33 33 #include <boost/foreach.hpp> 34 34 35 #include "util/StringUtils.h" 35 36 #include "core/ConfigFileManager.h" 36 37 #include "core/ConfigValueIncludes.h" … … 61 62 std::string name = oisDevice_->vendor(); 62 63 replaceCharacters(name, ' ', '_'); 63 deviceName_ = name + "_";64 } 65 deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Button)) + "_";66 deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Axis)) + "_";67 deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Slider)) + "_";64 deviceName_ = name + '_'; 65 } 66 deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Button)) + '_'; 67 deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Axis)) + '_'; 68 deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Slider)) + '_'; 68 69 deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_POV)); 69 70 //deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Vector3)); … … 74 75 { 75 76 // Make the ID unique for this execution time. 76 deviceName_ += "_"+ multi_cast<std::string>(this->getDeviceName());77 deviceName_ += '_' + multi_cast<std::string>(this->getDeviceName()); 77 78 break; 78 79 } -
code/branches/presentation2/src/libraries/core/input/KeyBinder.cc
r6388 r6394 61 61 for (unsigned int i = 0; i < KeyCode::numberOfKeys; i++) 62 62 { 63 std::stringkeyname = KeyCode::ByString[i];63 const std::string& keyname = KeyCode::ByString[i]; 64 64 if (!keyname.empty()) 65 65 keys_[i].name_ = std::string("Key") + keyname; 66 66 else 67 keys_[i].name_ = "";67 keys_[i].name_.clear(); 68 68 keys_[i].paramCommandBuffer_ = ¶mCommandBuffer_; 69 69 keys_[i].groupName_ = "Keys"; … … 188 188 this->joyStickButtons_.resize(joySticks_.size()); 189 189 190 // reinitialise all joy stick bin ings (doesn't overwrite the old ones)190 // reinitialise all joy stick bindings (doesn't overwrite the old ones) 191 191 for (unsigned int iDev = 0; iDev < joySticks_.size(); iDev++) 192 192 { 193 std::stringdeviceName = joySticks_[iDev]->getDeviceName();193 const std::string& deviceName = joySticks_[iDev]->getDeviceName(); 194 194 // joy stick buttons 195 195 for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++) … … 221 221 for (unsigned int i = 0; i < KeyCode::numberOfKeys; i++) 222 222 if (!keys_[i].name_.empty()) 223 allButtons_[keys_[i].groupName_ + "."+ keys_[i].name_] = keys_ + i;223 allButtons_[keys_[i].groupName_ + '.' + keys_[i].name_] = keys_ + i; 224 224 for (unsigned int i = 0; i < numberOfMouseButtons_; i++) 225 allButtons_[mouseButtons_[i].groupName_ + "."+ mouseButtons_[i].name_] = mouseButtons_ + i;225 allButtons_[mouseButtons_[i].groupName_ + '.' + mouseButtons_[i].name_] = mouseButtons_ + i; 226 226 for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++) 227 227 { 228 allButtons_[mouseAxes_[i].groupName_ + "."+ mouseAxes_[i].name_] = mouseAxes_ + i;228 allButtons_[mouseAxes_[i].groupName_ + '.' + mouseAxes_[i].name_] = mouseAxes_ + i; 229 229 allHalfAxes_.push_back(mouseAxes_ + i); 230 230 } … … 232 232 { 233 233 for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++) 234 allButtons_[(*joyStickButtons_[iDev])[i].groupName_ + "."+ (*joyStickButtons_[iDev])[i].name_] = &((*joyStickButtons_[iDev])[i]);234 allButtons_[(*joyStickButtons_[iDev])[i].groupName_ + '.' + (*joyStickButtons_[iDev])[i].name_] = &((*joyStickButtons_[iDev])[i]); 235 235 for (unsigned int i = 0; i < JoyStickAxisCode::numberOfAxes * 2; i++) 236 236 { 237 allButtons_[(*joyStickAxes_[iDev])[i].groupName_ + "."+ (*joyStickAxes_[iDev])[i].name_] = &((*joyStickAxes_[iDev])[i]);237 allButtons_[(*joyStickAxes_[iDev])[i].groupName_ + '.' + (*joyStickAxes_[iDev])[i].name_] = &((*joyStickAxes_[iDev])[i]); 238 238 allHalfAxes_.push_back(&((*joyStickAxes_[iDev])[i])); 239 239 } … … 284 284 } 285 285 286 void KeyBinder::addButtonToCommand( std::stringcommand, Button* button)286 void KeyBinder::addButtonToCommand(const std::string& command, Button* button) 287 287 { 288 288 std::ostringstream stream; 289 stream << button->groupName_ << "."<< button->name_;289 stream << button->groupName_ << '.' << button->name_; 290 290 291 291 std::vector<std::string>& oldKeynames = this->allCommands_[button->bindingString_]; … … 296 296 } 297 297 298 if (command != "")298 if (!command.empty()) 299 299 { 300 300 std::vector<std::string>& keynames = this->allCommands_[command]; … … 310 310 Return the first key name for a specific command 311 311 */ 312 std::string KeyBinder::getBinding(std::stringcommandName)312 const std::string& KeyBinder::getBinding(const std::string& commandName) 313 313 { 314 314 if( this->allCommands_.find(commandName) != this->allCommands_.end()) … … 318 318 } 319 319 320 return "";320 return BLANKSTRING; 321 321 } 322 322 … … 329 329 The index at which the key name is returned for. 330 330 */ 331 std::string KeyBinder::getBinding(std::stringcommandName, unsigned int index)331 const std::string& KeyBinder::getBinding(const std::string& commandName, unsigned int index) 332 332 { 333 333 if( this->allCommands_.find(commandName) != this->allCommands_.end()) … … 339 339 } 340 340 341 return "";342 } 343 344 return "";341 return BLANKSTRING; 342 } 343 344 return BLANKSTRING; 345 345 } 346 346 … … 351 351 The command. 352 352 */ 353 unsigned int KeyBinder::getNumberOfBindings( std::stringcommandName)353 unsigned int KeyBinder::getNumberOfBindings(const std::string& commandName) 354 354 { 355 355 if( this->allCommands_.find(commandName) != this->allCommands_.end()) -
code/branches/presentation2/src/libraries/core/input/KeyBinder.h
r6387 r6394 66 66 void clearBindings(); 67 67 bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false); 68 std::string getBinding(std::stringcommandName); //tolua_export69 std::string getBinding(std::stringcommandName, unsigned int index); //tolua_export70 unsigned int getNumberOfBindings( std::stringcommandName); //tolua_export68 const std::string& getBinding(const std::string& commandName); //tolua_export 69 const std::string& getBinding(const std::string& commandName, unsigned int index); //tolua_export 70 unsigned int getNumberOfBindings(const std::string& commandName); //tolua_export 71 71 72 72 const std::string& getBindingsFilename() … … 160 160 161 161 private: 162 void addButtonToCommand( std::stringcommand, Button* button);162 void addButtonToCommand(const std::string& command, Button* button); 163 163 164 164 //##### ConfigValues ##### -
code/branches/presentation2/src/libraries/core/input/KeyDetector.cc
r6182 r6394 67 67 for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it) 68 68 { 69 it->second->bindingString_ = callbackCommand_s + " "+ it->second->groupName_ + "." + it->second->name_;69 it->second->bindingString_ = callbackCommand_s + ' ' + it->second->groupName_ + "." + it->second->name_; 70 70 it->second->parse(); 71 71 }
Note: See TracChangeset
for help on using the changeset viewer.