Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 22, 2009, 2:07:44 PM (15 years ago)
Author:
rgrieder
Message:

std::string tweaks:

  • Declared BLANKSTRING in UtilPrereqs.h as well (removed obsolete StringUtils.h includes to avoid dependencies)
  • Using BLANKSTRING if const std::string& return type is possible
  • Replaced a few (const) std::string arguments with const std::string&
  • if (str == "") —> if (str.empty())
  • std::string msg = name + "adsf"; —> const std::string& msg = name + "asdf";
  • std::string asdf = object→getFooBar(); —> const std::string& asdf = object→getFooBar();
  • std::string asdf = "asdf"; —> std::string asdf("asdf");
  • ostream << "."; and name + "." —> ostream << '.'; and name + '.'
  • str = ""; —> str.clear()
  • std::string asdf = ""; —> std::string asdf;
  • asdf_ = ""; (in c'tor) —> delete line
Location:
code/branches/presentation2/src/libraries/core
Files:
46 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc

    r6166 r6394  
    7272                else
    7373                {
    74                     std::string dir = startdirectory.string();
     74                    const std::string& dir = startdirectory.string();
    7575                    if (dir.size() > 0 && dir[dir.size() - 1] == ':')
    7676                        startdirectory = dir + '/';
     
    130130                if (variable != identifier->second->getLowercaseConfigValueMapEnd())
    131131                {
    132                     std::string valuestring = variable->second->toString();
     132                    const std::string& valuestring = variable->second->toString();
    133133                    oldvalue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
    134134                }
  • code/branches/presentation2/src/libraries/core/BaseObject.cc

    r6387 r6394  
    3636#include <tinyxml/tinyxml.h>
    3737
    38 #include "util/StringUtils.h"
    3938#include "CoreIncludes.h"
    4039#include "Event.h"
     
    278277        if (it != this->eventStates_.end())
    279278        {
    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;
    281280            delete (it->second);
    282281        }
     
    348347        if (it != this->eventStates_.end())
    349348            it->second->process(event, this);
    350         else if (event.statename_ != "")
     349        else if (!event.statename_.empty())
    351350            COUT(2) << "Warning: \"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl;
    352351        else
     
    386385        this->mainStateFunctor_ = 0;
    387386
    388         if (this->mainStateName_ != "")
     387        if (!this->mainStateName_.empty())
    389388        {
    390389            this->registerEventStates();
     
    437436            for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
    438437            {
    439                 std::string statename = (*it);
     438                const std::string& statename = (*it);
    440439
    441440                // if the event state is already known, continue with the next state
     
    447446                if (!container)
    448447                {
    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 + ')');
    451450                    setfunctor->setDefaultValue(1, statename);
    452451                    getfunctor->setDefaultValue(1, statename);
  • code/branches/presentation2/src/libraries/core/ClassTreeMask.cc

    r5929 r6394  
    816816            // Calculate the prefix: + means included, - means excluded
    817817            if (it->isIncluded())
    818                 out << "+";
     818                out << '+';
    819819            else
    820                 out << "-";
     820                out << '-';
    821821
    822822            // Put the name of the corresponding class on the stream
    823             out << it->getClass()->getName() << " ";
     823            out << it->getClass()->getName() << ' ';
    824824        }
    825825
  • code/branches/presentation2/src/libraries/core/CommandEvaluation.cc

    r5781 r6394  
    5050        this->commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
    5151
    52         this->additionalParameter_ = "";
     52        this->additionalParameter_.clear();
    5353
    5454        this->bEvaluatedParams_ = false;
     
    6060        this->functionclass_ = 0;
    6161        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();
    6666        this->state_ = CommandState::Empty;
    6767    }
     
    7979        if (this->bEvaluatedParams_ && this->function_)
    8080        {
    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;
    8282            (*this->function_)(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]);
    8383            return true;
     
    9898    }
    9999
    100     std::string CommandEvaluation::complete()
     100    const std::string& CommandEvaluation::complete()
    101101    {
    102102        if (!this->bNewCommand_)
     
    114114                            return (this->command_ = this->function_->getName());
    115115                        else
    116                             return (this->command_ = this->function_->getName() + " ");
     116                            return (this->command_ = this->function_->getName() + ' ');
    117117                    }
    118118                    else if (this->functionclass_)
    119                         return (this->command_ = this->functionclass_->getName() + " ");
     119                        return (this->command_ = this->functionclass_->getName() + ' ');
    120120                    break;
    121121                case CommandState::Function:
     
    123123                    {
    124124                        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());
    126126                        else
    127                             return (this->command_ = this->functionclass_->getName() + " " + this->function_->getName() + " ");
     127                            return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName() + ' ');
    128128                    }
    129129                    break;
     
    131131                case CommandState::Params:
    132132                {
    133                     if (this->argument_ == "" && this->possibleArgument_ == "")
     133                    if (this->argument_.empty() && this->possibleArgument_.empty())
    134134                        break;
    135135
     
    137137                    if (this->command_[this->command_.size() - 1] != ' ')
    138138                        maxIndex -= 1;
    139                     std::string whitespace = "";
    140 
    141                     if (this->possibleArgument_ != "")
     139                    std::string whitespace;
     140
     141                    if (!this->possibleArgument_.empty())
    142142                    {
    143143                        this->argument_ = this->possibleArgument_;
     
    146146                    }
    147147
    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);
    149149                    break;
    150150                }
     
    262262    std::string CommandEvaluation::dump(const std::list<std::pair<const std::string*, const std::string*> >& list)
    263263    {
    264         std::string output = "";
     264        std::string output;
    265265        for (std::list<std::pair<const std::string*, const std::string*> >::const_iterator it = list.begin(); it != list.end(); ++it)
    266266        {
    267267            if (it != list.begin())
    268                 output += " ";
    269 
    270             output += *(*it).second;
     268                output += ' ';
     269
     270            output += *(it->second);
    271271        }
    272272        return output;
     
    275275    std::string CommandEvaluation::dump(const ArgumentCompletionList& list)
    276276    {
    277         std::string output = "";
     277        std::string output;
    278278        for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    279279        {
    280280            if (it != list.begin())
    281                 output += " ";
     281                output += ' ';
    282282
    283283            output += (*it).getDisplay();
     
    295295        {
    296296            if (i != 0)
    297                 output += " ";
     297                output += ' ';
    298298
    299299            if (command->defaultValueSet(i))
    300                 output += "[";
     300                output += '[';
    301301            else
    302                 output += "{";
     302                output += '{';
    303303
    304304            output += command->getTypenameParam(i);
    305305
    306306            if (command->defaultValueSet(i))
    307                 output += "=" + command->getDefaultValue(i).getString() + "]";
     307                output += '=' + command->getDefaultValue(i).getString() + ']';
    308308            else
    309                 output += "}";
     309                output += '}';
    310310        }
    311311        return output;
  • code/branches/presentation2/src/libraries/core/CommandEvaluation.h

    r5781 r6394  
    6666
    6767            bool execute() const;
    68             std::string complete();
     68            const std::string& complete();
    6969            std::string hint() const;
    7070            void evaluateParams();
     
    8282                { this->additionalParameter_ = param; this->bEvaluatedParams_ = false; }
    8383            inline std::string getAdditionalParameter() const
    84                 { return (this->additionalParameter_ != "") ? (" " + this->additionalParameter_) : ""; }
     84                { return (!this->additionalParameter_.empty()) ? (' ' + this->additionalParameter_) : ""; }
    8585
    8686            void setEvaluatedParameter(unsigned int index, MultiType param);
  • code/branches/presentation2/src/libraries/core/CommandExecutor.cc

    r6166 r6394  
    5959        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end())
    6060        {
    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;
    6262        }
    6363
     
    215215                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
    216216                        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") + '.';
    218218                        return;
    219219                    }
     
    231231                    {
    232232                        // It's a shortcut
    233                         std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;
     233                        const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first;
    234234                        CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname);
    235235                        if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(0)))
     
    243243                        if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
    244244                        {
    245                             CommandExecutor::getEvaluation().command_ += " ";
     245                            CommandExecutor::getEvaluation().command_ += ' ';
    246246                            CommandExecutor::getEvaluation().bCommandChanged_ = true;
    247247                        }
     
    251251                    {
    252252                        // It's a classname
    253                         std::string classname = *(*CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()).first;
     253                        const std::string& classname = *CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()->first;
    254254                        CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getPossibleIdentifier(classname);
    255255                        if (getLowercase(classname) != getLowercase(CommandExecutor::getArgument(0)))
     
    260260                        CommandExecutor::getEvaluation().state_ = CommandState::Function;
    261261                        CommandExecutor::getEvaluation().function_ = 0;
    262                         CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " ";
     262                        CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ';
    263263                        // Move on to next case
    264264                    }
     
    268268                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
    269269                        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) + '.';
    271271                        return;
    272272                    }
     
    319319                        {
    320320                            // It's a function
    321                             std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;
     321                            const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first;
    322322                            CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname, CommandExecutor::getEvaluation().functionclass_);
    323323                            if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(1)))
     
    327327                            }
    328328                            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();
    330330                            if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
    331331                            {
    332                                 CommandExecutor::getEvaluation().command_ += " ";
     332                                CommandExecutor::getEvaluation().command_ += ' ';
    333333                                CommandExecutor::getEvaluation().bCommandChanged_ = true;
    334334                            }
     
    340340                            CommandExecutor::getEvaluation().state_ = CommandState::Error;
    341341                            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) + '.';
    343343                            return;
    344344                        }
     
    346346                        {
    347347                            // 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_);
    349349                            CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().functionclass_);
    350350                            CommandExecutor::getEvaluation().bCommandChanged_ = true;
     
    451451    }
    452452
    453     std::string CommandExecutor::getArgument(unsigned int index)
     453    const std::string& CommandExecutor::getArgument(unsigned int index)
    454454    {
    455455        if (index < (CommandExecutor::getEvaluation().commandTokens_.size()))
    456456            return CommandExecutor::getEvaluation().commandTokens_[index];
    457457        else
    458             return "";
    459     }
    460 
    461     std::string CommandExecutor::getLastArgument()
     458            return BLANKSTRING;
     459    }
     460
     461    const std::string& CommandExecutor::getLastArgument()
    462462    {
    463463        return CommandExecutor::getArgument(CommandExecutor::argumentsGiven() - 1);
     
    467467    {
    468468        CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.clear();
    469         std::string lowercase = getLowercase(fragment);
     469        const std::string& lowercase = getLowercase(fragment);
    470470        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())
    473473                    CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
    474474    }
     
    477477    {
    478478        CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear();
    479         std::string lowercase = getLowercase(fragment);
     479        const std::string& lowercase = getLowercase(fragment);
    480480        if (!identifier)
    481481        {
    482482            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())
    484484                    CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
    485485        }
     
    487487        {
    488488            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())
    490490                    CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
    491491        }
     
    497497
    498498        CommandExecutor::getEvaluation().listOfPossibleArguments_.clear();
    499         std::string lowercase = getLowercase(fragment);
     499        const std::string& lowercase = getLowercase(fragment);
    500500        for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
    501501        {
    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())
    505505                    CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it);
    506506            }
    507507            else
    508508            {
    509                 if ((*it).getComparable().find(fragment) == 0 || fragment == "")
     509                if (it->getComparable().find(fragment) == 0 || fragment.empty())
    510510                    CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it);
    511511            }
     
    515515    Identifier* CommandExecutor::getPossibleIdentifier(const std::string& name)
    516516    {
    517         std::string lowercase = getLowercase(name);
     517        const std::string& lowercase = getLowercase(name);
    518518        std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMap().find(lowercase);
    519519        if ((it != Identifier::getLowercaseStringIdentifierMapEnd()) && (*it).second->hasConsoleCommands())
     
    525525    ConsoleCommand* CommandExecutor::getPossibleCommand(const std::string& name, Identifier* identifier)
    526526    {
    527         std::string lowercase = getLowercase(name);
     527        const std::string& lowercase = getLowercase(name);
    528528        if (!identifier)
    529529        {
     
    541541    }
    542542
    543     std::string CommandExecutor::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)
    544544    {
    545545        CommandExecutor::createArgumentCompletionList(command, param);
    546546
    547         std::string lowercase = getLowercase(name);
     547        const std::string& lowercase = getLowercase(name);
    548548        for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
    549549        {
    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();
    554554            }
    555555            else
    556556            {
    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;
    563563    }
    564564
     
    589589        else if (list.size() == 1)
    590590        {
    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;
    596596            for (unsigned int i = 0; true; i++)
    597597            {
     
    630630        else if (list.size() == 1)
    631631        {
    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;
    637637            for (unsigned int i = 0; true; i++)
    638638            {
     
    641641                for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    642642                {
    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();
    645645                    if (argument.size() > i)
    646646                    {
  • code/branches/presentation2/src/libraries/core/CommandExecutor.h

    r5781 r6394  
    9090            static unsigned int argumentsGiven();
    9191            static bool enoughArgumentsGiven(ConsoleCommand* command);
    92             static std::string getArgument(unsigned int index);
    93             static std::string getLastArgument();
     92            static const std::string& getArgument(unsigned int index);
     93            static const std::string& getLastArgument();
    9494
    9595            static void createListOfPossibleIdentifiers(const std::string& fragment);
     
    9999            static Identifier* getPossibleIdentifier(const std::string& name);
    100100            static ConsoleCommand* getPossibleCommand(const std::string& name, Identifier* identifier = 0);
    101             static std::string getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param);
     101            static const std::string& getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param);
    102102
    103103            static void createArgumentCompletionList(ConsoleCommand* command, unsigned int param);
  • code/branches/presentation2/src/libraries/core/CommandLineParser.cc

    r6021 r6394  
    6363                this->value_ = temp;
    6464            }
    65             else if (value == "")
     65            else if (value.empty())
    6666            {
    6767                this->bHasDefaultValue_ = false;
     
    140140                    OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
    141141                        "Cannot have two command line shortcut with the same name.");
    142                     if (it->second->getShortcut() != "")
     142                    if (!it->second->getShortcut().empty())
    143143                        cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
    144144                }
     
    165165                        {
    166166                            // negative number as a value
    167                             value += arguments[i] + " ";
     167                            value += arguments[i] + ' ';
    168168                        }
    169169                        else
     
    173173                            // save old data first
    174174                            value = removeTrailingWhitespaces(value);
    175                             if (name != "")
     175                            if (!name.empty())
    176176                            {
    177177                                checkFullArgument(name, value, bParsingFile);
    178                                 name = "";
    179                                 assert(shortcut == "");
     178                                name.clear();
     179                                assert(shortcut.empty());
    180180                            }
    181                             else if (shortcut != "")
     181                            else if (!shortcut.empty())
    182182                            {
    183183                                checkShortcut(shortcut, value, bParsingFile);
    184                                 shortcut = "";
    185                                 assert(name == "");
     184                                shortcut.clear();
     185                                assert(name.empty());
    186186                            }
    187187
     
    198198
    199199                            // reset value string
    200                             value = "";
     200                            value.clear();
    201201                        }
    202202                    }
     
    205205                        // value string
    206206
    207                         if (name == "" && shortcut == "")
     207                        if (name.empty() && shortcut.empty())
    208208                        {
    209209                            ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
     
    218218            // parse last argument
    219219            value = removeTrailingWhitespaces(value);
    220             if (name != "")
     220            if (!name.empty())
    221221            {
    222222                checkFullArgument(name, value, bParsingFile);
    223                 assert(shortcut == "");
    224             }
    225             else if (shortcut != "")
     223                assert(shortcut.empty());
     224            }
     225            else if (!shortcut.empty())
    226226            {
    227227                checkShortcut(shortcut, value, bParsingFile);
    228                 assert(name == "");
     228                assert(name.empty());
    229229            }
    230230        }
     
    291291            it != inst.cmdLineArgs_.end(); ++it)
    292292        {
    293             if (it->second->getShortcut() != "")
     293            if (!it->second->getShortcut().empty())
    294294                infoStr << " [-" << it->second->getShortcut() << "] ";
    295295            else
    296296                infoStr << "      ";
    297             infoStr << "--" << it->second->getName() << " ";
     297            infoStr << "--" << it->second->getName() << ' ';
    298298            if (it->second->getValue().getType() != MT_Type::Bool)
    299299                infoStr << "ARG ";
     
    347347    void CommandLineParser::_parseFile()
    348348    {
    349         std::string filename = CommandLineParser::getValue("optionsFile").getString();
     349        const std::string& filename = CommandLineParser::getValue("optionsFile").getString();
    350350
    351351        // look for additional arguments in given file or start.ini as default
  • code/branches/presentation2/src/libraries/core/ConfigFileManager.cc

    r6387 r6394  
    9999            this->value_ = value;
    100100        else
    101             this->value_ = "\"" + addSlashes(stripEnclosingQuotes(value)) + "\"";
     101            this->value_ = '"' + addSlashes(stripEnclosingQuotes(value)) + '"';
    102102    }
    103103
     
    112112    std::string ConfigFileEntryValue::getFileEntry() const
    113113    {
    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_);
    118118    }
    119119
     
    124124    std::string ConfigFileEntryVectorValue::getFileEntry() const
    125125    {
    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_);
    130130    }
    131131
     
    171171    std::string ConfigFileSection::getFileEntry() const
    172172    {
    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_);
    177177    }
    178178
     
    251251                std::getline(file, line);
    252252
    253                 std::string temp = getStripped(line);
     253                const std::string& temp = getStripped(line);
    254254                if (!isEmpty(temp) && !isComment(temp))
    255255                {
     
    261261                    {
    262262                        // New section
    263                         std::string comment = line.substr(pos2 + 1);
     263                        const std::string& comment = line.substr(pos2 + 1);
    264264                        if (isComment(comment))
    265265                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
     
    293293                                commentposition = getNextCommentPosition(line, commentposition + 1);
    294294                            }
    295                             std::string value = "", comment = "";
     295                            std::string value, comment;
    296296                            if (commentposition == std::string::npos)
    297297                            {
  • code/branches/presentation2/src/libraries/core/ConfigFileManager.h

    r6374 r6394  
    8989    {
    9090        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                {}
    9297            inline virtual ~ConfigFileEntryValue() {}
    9398
     
    173178
    174179        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                {}
    176185            ~ConfigFileSection();
    177186
     
    244253                { this->getSection(section)->setValue(name, value, bString); this->save(); }
    245254            inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
    246                 { std::string output = 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; }
    247256
    248257            inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
    249258                { this->getSection(section)->setValue(name, index, value, bString); this->save(); }
    250259            inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
    251                 { std::string output = 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; }
    252261
    253262            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  
    3535#include "util/Debug.h"
    3636#include "util/ExprParser.h"
     37#include "util/StringUtils.h"
    3738#include "ConsoleCommand.h"
    3839
     
    142143        }
    143144
    144         std::string output = "";
     145        std::string output;
    145146        while (file.good() && !file.eof())
    146147        {
     
    166167                COUT(3) << "Greetings from the restaurant at the end of the universe." << std::endl;
    167168            }
    168             if (expr.getRemains() != "")
     169            if (!expr.getRemains().empty())
    169170            {
    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;
    171172            }
    172173            return static_cast<float>(expr.getResult());
  • code/branches/presentation2/src/libraries/core/DynLib.cc

    r6073 r6394  
    7070        COUT(2) << "Loading module " << mName << std::endl;
    7171
    72         std::string name = mName;
     72        const std::string& name = mName;
    7373#ifdef ORXONOX_PLATFORM_LINUX
    7474        // dlopen() does not add .so to the filename, like windows does for .dll
     
    132132        return std::string(mac_errorBundle());
    133133#else
    134         return std::string("");
     134        return "";
    135135#endif
    136136    }
  • code/branches/presentation2/src/libraries/core/Event.cc

    r6387 r6394  
    5353        if (this->bProcessingEvent_)
    5454        {
    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;
    5656            return;
    5757        }
  • code/branches/presentation2/src/libraries/core/EventIncludes.h

    r6388 r6394  
    6666
    6767#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); \
    7070    XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true)
    7171
  • code/branches/presentation2/src/libraries/core/Executor.cc

    r5738 r6394  
    7373        {
    7474            // 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())
    7776            {
    7877                param[0] = params;
  • code/branches/presentation2/src/libraries/core/Executor.h

    r5738 r6394  
    6363    else if (paramCount == 1) \
    6464    { \
    65         std::string temp = getStripped(params); \
    66         if ((temp != "") && (temp.size() != 0)) \
     65        const std::string& temp = getStripped(params); \
     66        if (!temp.empty()) \
    6767        { \
    6868            COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; \
     
    187187                { return this->functor_->getTypenameReturnvalue(); }
    188188
    189             inline void setName(const std::string name)
     189            inline void setName(const std::string& name)
    190190                { this->name_ = name; }
    191191            inline const std::string& getName() const
  • code/branches/presentation2/src/libraries/core/Functor.h

    r5929 r6394  
    3535#include "util/Debug.h"
    3636#include "util/MultiType.h"
    37 #include "util/StringUtils.h"
    3837
    3938namespace orxonox
  • code/branches/presentation2/src/libraries/core/GraphicsManager.cc

    r6386 r6394  
    208208                shared_array<char> data(new char[output.str().size()]);
    209209                // Debug optimisations
    210                 const std::string outputStr = output.str();
     210                const std::string& outputStr = output.str();
    211211                char* rawData = data.get();
    212212                for (unsigned i = 0; i < outputStr.size(); ++i)
     
    238238        COUT(3) << "Setting up Ogre..." << std::endl;
    239239
    240         if (ogreConfigFile_ == "")
     240        if (ogreConfigFile_.empty())
    241241        {
    242242            COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
    243243            ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
    244244        }
    245         if (ogreLogFile_ == "")
     245        if (ogreLogFile_.empty())
    246246        {
    247247            COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
     
    285285    {
    286286        // just to make sure the next statement doesn't segfault
    287         if (ogrePluginsDirectory_ == "")
    288             ogrePluginsDirectory_ = ".";
     287        if (ogrePluginsDirectory_.empty())
     288            ogrePluginsDirectory_ = '.';
    289289
    290290        boost::filesystem::path folder(ogrePluginsDirectory_);
  • code/branches/presentation2/src/libraries/core/IOConsole.cc

    r6380 r6394  
    307307        this->cout_ << "\033[u";
    308308        if (this->buffer_->getCursorPosition() > 0)
    309             this->cout_ << "\033[" << this->buffer_->getCursorPosition() << "C";
     309            this->cout_ << "\033[" << this->buffer_->getCursorPosition() << 'C';
    310310    }
    311311
  • code/branches/presentation2/src/libraries/core/IRC.cc

    r5781 r6394  
    3333#include "util/Convert.h"
    3434#include "util/Exception.h"
     35#include "util/StringUtils.h"
    3536#include "ConsoleCommand.h"
    3637#include "CoreIncludes.h"
     
    103104    void IRC::say(const std::string& message)
    104105    {
    105         if (IRC::eval("irk::say $conn #orxonox {" + message + "}"))
     106        if (IRC::eval("irk::say $conn #orxonox {" + message + '}'))
    106107            IRC::tcl_say(Tcl::object(), Tcl::object(IRC::getInstance().nickname_), Tcl::object(message));
    107108    }
     
    109110    void IRC::msg(const std::string& channel, const std::string& message)
    110111    {
    111         if (IRC::eval("irk::say $conn " + channel + " {" + message + "}"))
     112        if (IRC::eval("irk::say $conn " + channel + " {" + message + '}'))
    112113            IRC::tcl_privmsg(Tcl::object(channel), Tcl::object(IRC::getInstance().nickname_), Tcl::object(message));
    113114    }
     
    131132    void IRC::tcl_action(Tcl::object const &channel, Tcl::object const &nick, Tcl::object const &args)
    132133    {
    133         COUT(0) << "IRC> * " << nick.get() << " " << stripEnclosingBraces(args.get()) << std::endl;
     134        COUT(0) << "IRC> * " << nick.get() << ' ' << stripEnclosingBraces(args.get()) << std::endl;
    134135    }
    135136
  • code/branches/presentation2/src/libraries/core/Identifier.cc

    r5929 r6394  
    410410        if (it != this->configValues_.end())
    411411        {
    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;
    413413            delete (it->second);
    414414        }
     
    458458        if (it != this->consoleCommands_.end())
    459459        {
    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;
    461461            delete (it->second);
    462462        }
     
    524524        if (it != this->xmlportParamContainers_.end())
    525525        {
    526             COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << "." << std::endl;
     526            COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << '.' << std::endl;
    527527            delete (it->second);
    528528        }
     
    555555        if (it != this->xmlportObjectContainers_.end())
    556556        {
    557             COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << "." << std::endl;
     557            COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << std::endl;
    558558            delete (it->second);
    559559        }
     
    573573        {
    574574            if (it != list.begin())
    575                 out << " ";
     575                out << ' ';
    576576            out << (*it)->getName();
    577577        }
  • code/branches/presentation2/src/libraries/core/Identifier.h

    r5929 r6394  
    411411    {
    412412        // Get the name of the class
    413         std::string name = typeid(T).name();
     413        const std::string& name = typeid(T).name();
    414414
    415415        // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
  • code/branches/presentation2/src/libraries/core/Language.cc

    r6121 r6394  
    6262    {
    6363        // Check if the translation is more than just an empty string
    64         if ((localisation != "") && (localisation.size() > 0))
     64        if (!localisation.empty())
    6565        {
    6666            this->localisedEntry_ = localisation;
     
    130130        }
    131131
    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;
    133133        return it->second;
    134134    }
     
    199199        COUT(4) << "Read default language file." << std::endl;
    200200
    201         std::string filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
     201        const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
    202202
    203203        // This creates the file if it's not existing
     
    224224
    225225            // Check if the line is empty
    226             if ((lineString != "") && (lineString.size() > 0))
     226            if (!lineString.empty())
    227227            {
    228228                size_t pos = lineString.find('=');
     
    248248        COUT(4) << "Read translated language file (" << Core::getInstance().getLanguage() << ")." << std::endl;
    249249
    250         std::string filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage());
     250        const std::string& filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage());
    251251
    252252        // Open the file
     
    259259            COUT(1) << "Error: Couldn't open file " << getFilename(Core::getInstance().getLanguage()) << " to read the translated language entries!" << std::endl;
    260260            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;
    262262            return;
    263263        }
     
    270270
    271271            // Check if the line is empty
    272             if ((lineString != "") && (lineString.size() > 0))
     272            if (!lineString.empty())
    273273            {
    274274                size_t pos = lineString.find('=');
     
    302302        COUT(4) << "Language: Write default language file." << std::endl;
    303303
    304         std::string filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
     304        const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
    305305
    306306        // Open the file
     
    318318        for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
    319319        {
    320             file << (*it).second->getLabel() << "=" << (*it).second->getDefault() << std::endl;
     320            file << (*it).second->getLabel() << '=' << (*it).second->getDefault() << std::endl;
    321321        }
    322322
  • code/branches/presentation2/src/libraries/core/Loader.cc

    r5929 r6394  
    165165            rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
    166166
    167             COUT(0) << "Finished loading " << file->getFilename() << "." << std::endl;
     167            COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl;
    168168
    169169            COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString("  ") << std::endl;
     
    174174        {
    175175            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;
    177177            COUT(1) << ex.what() << std::endl;
    178178            COUT(1) << "Loading aborted." << std::endl;
     
    182182        {
    183183            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;
    185185            COUT(1) << ex.what() << std::endl;
    186186            COUT(1) << "Loading aborted." << std::endl;
     
    190190        {
    191191            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;
    193193            COUT(1) << Exception::handleMessage() << std::endl;
    194194            COUT(1) << "Loading aborted." << std::endl;
     
    218218    std::string Loader::replaceLuaTags(const std::string& text)
    219219    {
    220         // chreate map with all Lua tags
     220        // create map with all Lua tags
    221221        std::map<size_t, bool> luaTags;
    222222        {
     
    300300                {
    301301                    // count ['='[ and ]'='] and replace tags with print([[ and ]])
    302                     std::string temp = text.substr(start, end - start);
     302                    const std::string& temp = text.substr(start, end - start);
    303303                    {
    304304                    size_t pos = 0;
     
    345345                        }
    346346                    }
    347                     std::string equalSigns = "";
     347                    std::string equalSigns;
    348348                    for(unsigned int i = 0; i < equalSignCounter; i++)
    349349                    {
    350                         equalSigns += "=";
     350                        equalSigns += '=';
    351351                    }
    352                     output << "print([" + equalSigns + "[" + temp + "]" + equalSigns +"])";
     352                    output << "print([" + equalSigns + '[' + temp + ']' + equalSigns +"])";
    353353                    start = end + 5;
    354354                }
  • code/branches/presentation2/src/libraries/core/Namespace.cc

    r5781 r6394  
    173173        {
    174174            if (i > 0)
    175                 output += "\n";
     175                output += '\n';
    176176
    177177            output += (*it)->toString(indentation);
  • code/branches/presentation2/src/libraries/core/NamespaceNode.cc

    r5781 r6394  
    5050        std::set<NamespaceNode*> nodes;
    5151
    52         if ((name.size() == 0) || (name == ""))
     52        if (name.empty())
    5353        {
    5454            nodes.insert(this);
     
    154154                    output += ", ";
    155155
    156                 output += (*it).second->toString();
     156                output += it->second->toString();
    157157            }
    158158
    159             output += ")";
     159            output += ')';
    160160        }
    161161
     
    165165    std::string NamespaceNode::toString(const std::string& indentation) const
    166166    {
    167         std::string output = (indentation + this->name_ + "\n");
     167        std::string output = (indentation + this->name_ + '\n');
    168168
    169169        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 + "  ");
    171171
    172172        return output;
  • code/branches/presentation2/src/libraries/core/OrxonoxClass.cc

    r6348 r6394  
    5757    {
    5858//        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;
    6060
    6161        assert(this->referenceCount_ <= 0);
  • code/branches/presentation2/src/libraries/core/PathConfig.cc

    r6105 r6394  
    226226        if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
    227227        {
    228             std::string directory(CommandLineParser::getValue("writingPathSuffix").getString());
     228            const std::string& directory(CommandLineParser::getValue("writingPathSuffix").getString());
    229229            configPath_ = configPath_ / directory;
    230230            logPath_    = logPath_    / directory;
     
    256256
    257257        // We search for helper files with the following extension
    258         std::string moduleextension = specialConfig::moduleExtension;
     258        const std::string& moduleextension = specialConfig::moduleExtension;
    259259        size_t moduleextensionlength = moduleextension.size();
    260260
    261261        // 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()));
    264264
    265265        // Make sure the path exists, otherwise don't load modules
     
    273273        while (file != end)
    274274        {
    275             std::string filename = file->BOOST_LEAF_FUNCTION();
     275            const std::string& filename = file->BOOST_LEAF_FUNCTION();
    276276
    277277            // Check if the file ends with the exension in question
     
    281281                {
    282282                    // We've found a helper file
    283                     std::string library = filename.substr(0, filename.size() - moduleextensionlength);
     283                    const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
    284284                    modulePaths.push_back((modulePath_ / library).file_string());
    285285                }
  • code/branches/presentation2/src/libraries/core/Shell.cc

    r6379 r6394  
    226226    }
    227227
    228     std::string Shell::getFromHistory() const
     228    const std::string& Shell::getFromHistory() const
    229229    {
    230230        unsigned int index = mod(static_cast<int>(this->historyOffset_) - static_cast<int>(this->historyPosition_), this->maxHistoryLength_);
     
    232232            return this->commandHistory_[index];
    233233        else
    234             return "";
     234            return BLANKSTRING;
    235235    }
    236236
     
    251251            newline = (!eof && !fail);
    252252
    253             if (!newline && output == "")
     253            if (!newline && output.empty())
    254254                break;
    255255
     
    400400            return;
    401401        unsigned int cursorPosition = this->getCursorPosition();
    402         std::string input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning of the inputline until the cursor position
     402        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
    403403        for (unsigned int newPos = this->historyPosition_ + 1; newPos <= this->historyOffset_; newPos++)
    404404        {
     
    418418            return;
    419419        unsigned int cursorPosition = this->getCursorPosition();
    420         std::string input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning
     420        const std::string& input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning
    421421        for (unsigned int newPos = this->historyPosition_ - 1; newPos > 0; newPos--)
    422422        {
  • code/branches/presentation2/src/libraries/core/Shell.h

    r6375 r6394  
    9696                { return this->inputBuffer_->getCursorPosition(); }
    9797
    98             inline std::string getInput() const
     98            inline const std::string& getInput() const
    9999                { return this->inputBuffer_->get(); }
    100100
     
    118118
    119119            void addToHistory(const std::string& command);
    120             std::string getFromHistory() const;
     120            const std::string& getFromHistory() const;
    121121            void clearInput();
    122122            // OutputListener
  • code/branches/presentation2/src/libraries/core/SubclassIdentifier.h

    r5929 r6394  
    9898                    if (identifier)
    9999                    {
    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;
    101101                        COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;
    102102                    }
     
    166166                    {
    167167                        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;
    169169                        COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;
    170170                    }
  • code/branches/presentation2/src/libraries/core/TclBind.cc

    r5929 r6394  
    101101    {
    102102        Tcl::interpreter* interpreter = new Tcl::interpreter();
    103         std::string libpath = TclBind::getTclLibraryPath();
     103        const std::string& libpath = TclBind::getTclLibraryPath();
    104104
    105105        try
    106106        {
    107             if (libpath != "")
    108                 interpreter->eval("set tcl_library \"" + libpath + "\"");
     107            if (!libpath.empty())
     108                interpreter->eval("set tcl_library \"" + libpath + '"');
    109109
    110110            Tcl_Init(interpreter->get());
     
    136136        COUT(4) << "Tcl_query: " << args.get() << std::endl;
    137137
    138         std::string command = stripEnclosingBraces(args.get());
     138        const std::string& command = stripEnclosingBraces(args.get());
    139139
    140140        if (!CommandExecutor::execute(command, false))
     
    152152    {
    153153        COUT(4) << "Tcl_execute: " << args.get() << std::endl;
    154         std::string command = stripEnclosingBraces(args.get());
     154        const std::string& command = stripEnclosingBraces(args.get());
    155155
    156156        if (!CommandExecutor::execute(command, false))
     
    166166            try
    167167            {
    168                 std::string output = 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())
    170170                {
    171171                    COUT(0) << "tcl> " << output << std::endl;
     
    182182    }
    183183
    184     void TclBind::bgerror(std::string error)
     184    void TclBind::bgerror(const std::string& error)
    185185    {
    186186        COUT(1) << "Tcl background error: " << stripEnclosingBraces(error) << std::endl;
  • code/branches/presentation2/src/libraries/core/TclBind.h

    r5781 r6394  
    4646
    4747            static std::string tcl(const std::string& tclcode);
    48             static void bgerror(std::string error);
     48            static void bgerror(const std::string& error);
    4949
    5050            void setDataPath(const std::string& datapath);
  • code/branches/presentation2/src/libraries/core/TclThreadManager.cc

    r6183 r6394  
    3939#include "util/Convert.h"
    4040#include "util/Exception.h"
     41#include "util/StringUtils.h"
    4142#include "CommandExecutor.h"
    4243#include "ConsoleCommand.h"
     
    252253    void TclThreadManager::initialize(TclInterpreterBundle* bundle)
    253254    {
    254         std::string id_string = getConvertedValue<unsigned int, std::string>(bundle->id_);
     255        const std::string& id_string = getConvertedValue<unsigned int, std::string>(bundle->id_);
    255256
    256257        // Initialize the new interpreter
     
    403404            {
    404405                // 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_) \
    406407                            + " -> " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) \
    407408                            + "), 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_) + '.');
    409410            }
    410411            else
     
    524525    std::string TclThreadManager::dumpList(const std::list<unsigned int>& list)
    525526    {
    526         std::string output = "";
     527        std::string output;
    527528        for (std::list<unsigned int>::const_iterator it = list.begin(); it != list.end(); ++it)
    528529        {
    529530            if (it != list.begin())
    530                 output += " ";
     531                output += ' ';
    531532
    532533            output += getConvertedValue<unsigned int, std::string>(*it);
     
    600601        @param command the Command to execute
    601602    */
    602     void tclThread(TclInterpreterBundle* bundle, std::string command)
     603    void tclThread(TclInterpreterBundle* bundle, const std::string& command)
    603604    {
    604605        TclThreadManager::debug("TclThread_execute: " + command);
     
    613614        @param file The name of the file that should be executed by the non-interactive interpreter.
    614615    */
    615     void sourceThread(std::string file)
     616    void sourceThread(const std::string& file)
    616617    {
    617618        TclThreadManager::debug("TclThread_source: " + file);
     
    651652
    652653        // Initialize the non-interactive interpreter (like in @ref TclBind::createTclInterpreter but exception safe)
    653         std::string libpath = 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");
    656657        int cc = Tcl_Init(interp);
    657658        TclThreadManager::eval(bundle, "source \"" + TclBind::getInstance().getTclDataPath() + "/init.tcl\"", "source");
  • code/branches/presentation2/src/libraries/core/TclThreadManager.h

    r6183 r6394  
    4848        friend class Singleton<TclThreadManager>;
    4949        friend class TclBind;
    50         friend _CoreExport void tclThread(TclInterpreterBundle* bundle, std::string command);
    51         friend _CoreExport void sourceThread(std::string file);
     50        friend _CoreExport void tclThread(TclInterpreterBundle* bundle, const std::string& command);
     51        friend _CoreExport void sourceThread(const std::string& file);
    5252        friend _CoreExport int Tcl_OrxonoxAppInit(Tcl_Interp* interp);
    5353
     
    9595    };
    9696
    97     _CoreExport void tclThread(TclInterpreterBundle* bundle, std::string command);
    98     _CoreExport void sourceThread(std::string file);
     97    _CoreExport void tclThread(TclInterpreterBundle* bundle, const std::string& command);
     98    _CoreExport void sourceThread(const std::string& file);
    9999    _CoreExport int Tcl_OrxonoxAppInit(Tcl_Interp* interp);
    100100}
  • code/branches/presentation2/src/libraries/core/Template.cc

    r5781 r6394  
    7979        SUPER(Template, changedName);
    8080
    81         if (this->getName() != "")
     81        if (!this->getName().empty())
    8282        {
    8383            std::map<std::string, Template*>::iterator it;
  • code/branches/presentation2/src/libraries/core/Template.h

    r5781 r6394  
    4848
    4949            inline void setLink(const std::string& link)
    50                 { this->link_ = link; this->bIsLink_ = (link != ""); }
     50                { this->link_ = link; this->bIsLink_ = !link.empty(); }
    5151            inline const std::string& getLink() const
    5252                { return this->link_; }
  • code/branches/presentation2/src/libraries/core/XMLPort.h

    r6117 r6394  
    5151#include "util/MultiType.h"
    5252#include "util/OrxAssert.h"
     53#include "util/StringUtils.h"
    5354#include "Identifier.h"
    5455#include "Executor.h"
     
    316317                { return this->paramname_; }
    317318
    318             virtual XMLPortParamContainer& description(const std::string description) = 0;
     319            virtual XMLPortParamContainer& description(const std::string& description) = 0;
    319320            virtual const std::string& getDescription() = 0;
    320321
     
    344345
    345346        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)
    347348            {
    348349                this->paramname_ = paramname;
     
    385386                        }
    386387                        std::map<std::string, std::string>::const_iterator it = this->owner_->xmlAttributes_.find(getLowercase(this->paramname_));
    387                         std::string attributeValue("");
     388                        std::string attributeValue;
    388389                        if (it != this->owner_->xmlAttributes_.end())
    389390                            attributeValue = it->second;
     
    407408                    {
    408409                        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;
    410411                        COUT(1) << ex.what() << std::endl;
    411412                    }
     
    435436            }
    436437
    437             virtual XMLPortParamContainer& description(const std::string description)
     438            virtual XMLPortParamContainer& description(const std::string& description)
    438439                { this->loadexecutor_->setDescription(description); return (*this); }
    439440            virtual const std::string& getDescription()
     
    497498                { return this->sectionname_; }
    498499
    499             virtual XMLPortObjectContainer& description(const std::string description) = 0;
     500            virtual XMLPortObjectContainer& description(const std::string& description) = 0;
    500501            virtual const std::string& getDescription() = 0;
    501502
     
    513514    {
    514515        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)
    516517            {
    517518                this->sectionname_ = sectionname;
     
    538539                    {
    539540                        Element* xmlsubelement;
    540                         if ((this->sectionname_ != "") && (this->sectionname_.size() > 0))
     541                        if (!this->sectionname_.empty())
    541542                            xmlsubelement = xmlelement.FirstChildElement(this->sectionname_, false);
    542543                        else
     
    570571                                                    {
    571572                                                        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;
    573574                                                    }
    574575                                                    else
    575576                                                    {
    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;
    577578                                                    }
    578579
     
    609610                                else
    610611                                {
    611                                     if (this->sectionname_ != "")
     612                                    if (!this->sectionname_.empty())
    612613                                    {
    613614                                        COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
     
    624625                    {
    625626                        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;
    627628                        COUT(1) << ex.what() << std::endl;
    628629                    }
     
    635636            }
    636637
    637             virtual XMLPortObjectContainer& description(const std::string description)
     638            virtual XMLPortObjectContainer& description(const std::string& description)
    638639                { this->loadexecutor_->setDescription(description); return (*this); }
    639640            virtual const std::string& getDescription()
  • code/branches/presentation2/src/libraries/core/input/Button.cc

    r5929 r6394  
    116116        for (unsigned int iCommand = 0; iCommand < commandStrings.size(); iCommand++)
    117117        {
    118             if (commandStrings[iCommand] != "")
     118            if (!commandStrings[iCommand].empty())
    119119            {
    120120                SubString tokens(commandStrings[iCommand], " ", SubString::WhiteSpaces, false,
     
    123123                KeybindMode::Value mode = KeybindMode::None;
    124124                float paramModifier = 1.0f;
    125                 std::string commandStr = "";
     125                std::string commandStr;
    126126
    127127                for (unsigned int iToken = 0; iToken < tokens.size(); ++iToken)
    128128                {
    129                     std::string token = getLowercase(tokens[iToken]);
     129                    const std::string& token = getLowercase(tokens[iToken]);
    130130
    131131                    if (token == "onpress")
     
    159159                        // we interpret everything from here as a command string
    160160                        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())
    166166                {
    167167                    parseError("No command string given.", false);
     
    242242    }
    243243
    244     inline void Button::parseError(std::string message, bool serious)
     244    inline void Button::parseError(const std::string& message, bool serious)
    245245    {
    246246        if (serious)
  • code/branches/presentation2/src/libraries/core/input/Button.h

    r5781 r6394  
    7676
    7777    private:
    78         void parseError(std::string message, bool serious);
     78        void parseError(const std::string& message, bool serious);
    7979    };
    8080
  • code/branches/presentation2/src/libraries/core/input/InputBuffer.cc

    r6177 r6394  
    3939        RegisterRootObject(InputBuffer);
    4040
    41         this->buffer_ = "";
    4241        this->cursor_ = 0;
    4342        this->maxLength_ = 1024;
     
    6261        this->maxLength_ = 1024;
    6362        this->allowedChars_ = allowedChars;
    64         this->buffer_ = "";
    6563        this->cursor_ = 0;
    6664
     
    138136    void InputBuffer::clear(bool update)
    139137    {
    140         this->buffer_ = "";
     138        this->buffer_.clear();
    141139        this->cursor_ = 0;
    142140
     
    188186    bool InputBuffer::charIsAllowed(const char& input)
    189187    {
    190         if (this->allowedChars_ == "")
     188        if (this->allowedChars_.empty())
    191189            return true;
    192190        else
  • code/branches/presentation2/src/libraries/core/input/InputManager.cc

    r6388 r6394  
    297297            if (device == NULL)
    298298                continue;
    299             std::string className = device->getClassName();
     299            const std::string& className = device->getClassName();
    300300            try
    301301            {
     
    579579    InputState* InputManager::createInputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority)
    580580    {
    581         if (name == "")
     581        if (name.empty())
    582582            return 0;
    583583        if (statesByName_.find(name) == statesByName_.end())
  • code/branches/presentation2/src/libraries/core/input/JoyStick.cc

    r5781 r6394  
    3333#include <boost/foreach.hpp>
    3434
     35#include "util/StringUtils.h"
    3536#include "core/ConfigFileManager.h"
    3637#include "core/ConfigValueIncludes.h"
     
    6162            std::string name = oisDevice_->vendor();
    6263            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))  + '_';
    6869        deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_POV));
    6970        //deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Vector3));
     
    7475            {
    7576                // Make the ID unique for this execution time.
    76                 deviceName_ += "_" + multi_cast<std::string>(this->getDeviceName());
     77                deviceName_ += '_' + multi_cast<std::string>(this->getDeviceName());
    7778                break;
    7879            }
  • code/branches/presentation2/src/libraries/core/input/KeyBinder.cc

    r6388 r6394  
    6161        for (unsigned int i = 0; i < KeyCode::numberOfKeys; i++)
    6262        {
    63             std::string keyname = KeyCode::ByString[i];
     63            const std::string& keyname = KeyCode::ByString[i];
    6464            if (!keyname.empty())
    6565                keys_[i].name_ = std::string("Key") + keyname;
    6666            else
    67                 keys_[i].name_ = "";
     67                keys_[i].name_.clear();
    6868            keys_[i].paramCommandBuffer_ = &paramCommandBuffer_;
    6969            keys_[i].groupName_ = "Keys";
     
    188188        this->joyStickButtons_.resize(joySticks_.size());
    189189
    190         // reinitialise all joy stick binings (doesn't overwrite the old ones)
     190        // reinitialise all joy stick bindings (doesn't overwrite the old ones)
    191191        for (unsigned int iDev = 0; iDev < joySticks_.size(); iDev++)
    192192        {
    193             std::string deviceName = joySticks_[iDev]->getDeviceName();
     193            const std::string& deviceName = joySticks_[iDev]->getDeviceName();
    194194            // joy stick buttons
    195195            for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++)
     
    221221        for (unsigned int i = 0; i < KeyCode::numberOfKeys; i++)
    222222            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;
    224224        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;
    226226        for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    227227        {
    228             allButtons_[mouseAxes_[i].groupName_ + "." + mouseAxes_[i].name_] = mouseAxes_ + i;
     228            allButtons_[mouseAxes_[i].groupName_ + '.' + mouseAxes_[i].name_] = mouseAxes_ + i;
    229229            allHalfAxes_.push_back(mouseAxes_ + i);
    230230        }
     
    232232        {
    233233            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]);
    235235            for (unsigned int i = 0; i < JoyStickAxisCode::numberOfAxes * 2; i++)
    236236            {
    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]);
    238238                allHalfAxes_.push_back(&((*joyStickAxes_[iDev])[i]));
    239239            }
     
    284284    }
    285285
    286      void KeyBinder::addButtonToCommand(std::string command, Button* button)
     286     void KeyBinder::addButtonToCommand(const std::string& command, Button* button)
    287287     {
    288288        std::ostringstream stream;
    289         stream << button->groupName_  << "." << button->name_;
     289        stream << button->groupName_  << '.' << button->name_;
    290290
    291291        std::vector<std::string>& oldKeynames = this->allCommands_[button->bindingString_];
     
    296296        }
    297297
    298         if(command != "")
     298        if (!command.empty())
    299299        {
    300300            std::vector<std::string>& keynames = this->allCommands_[command];
     
    310310        Return the first key name for a specific command
    311311    */
    312     std::string KeyBinder::getBinding(std::string commandName)
     312    const std::string& KeyBinder::getBinding(const std::string& commandName)
    313313    {
    314314        if( this->allCommands_.find(commandName) != this->allCommands_.end())
     
    318318        }
    319319
    320         return "";
     320        return BLANKSTRING;
    321321    }
    322322
     
    329329        The index at which the key name is returned for.
    330330    */
    331     std::string KeyBinder::getBinding(std::string commandName, unsigned int index)
     331    const std::string& KeyBinder::getBinding(const std::string& commandName, unsigned int index)
    332332    {
    333333        if( this->allCommands_.find(commandName) != this->allCommands_.end())
     
    339339            }
    340340
    341             return "";
    342         }
    343 
    344         return "";
     341            return BLANKSTRING;
     342        }
     343
     344        return BLANKSTRING;
    345345    }
    346346
     
    351351        The command.
    352352    */
    353     unsigned int KeyBinder::getNumberOfBindings(std::string commandName)
     353    unsigned int KeyBinder::getNumberOfBindings(const std::string& commandName)
    354354    {
    355355        if( this->allCommands_.find(commandName) != this->allCommands_.end())
  • code/branches/presentation2/src/libraries/core/input/KeyBinder.h

    r6387 r6394  
    6666        void clearBindings();
    6767        bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false);
    68         std::string getBinding(std::string commandName); //tolua_export
    69         std::string getBinding(std::string commandName, unsigned int index); //tolua_export
    70         unsigned int getNumberOfBindings(std::string commandName); //tolua_export
     68        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
    7171
    7272        const std::string& getBindingsFilename()
     
    160160
    161161    private:
    162         void addButtonToCommand(std::string command, Button* button);
     162        void addButtonToCommand(const std::string& command, Button* button);
    163163
    164164        //##### ConfigValues #####
  • code/branches/presentation2/src/libraries/core/input/KeyDetector.cc

    r6182 r6394  
    6767        for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    6868        {
    69             it->second->bindingString_ = callbackCommand_s + " " + it->second->groupName_ + "." + it->second->name_;
     69            it->second->bindingString_ = callbackCommand_s + ' ' + it->second->groupName_ + "." + it->second->name_;
    7070            it->second->parse();
    7171        }
Note: See TracChangeset for help on using the changeset viewer.