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
Files:
67 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        }
  • code/branches/presentation2/src/libraries/network/Client.cc

    r6387 r6394  
    139139    {
    140140      timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
    141       //     COUT(3) << ".";
     141      //     COUT(3) << '.';
    142142      if ( isConnected() && isSynched_ )
    143143      {
  • code/branches/presentation2/src/libraries/network/GamestateClient.cc

    r6387 r6394  
    137137    COUT(4) << "gamestates: ";
    138138    for(it=gamestateMap_.begin(); it!=gamestateMap_.end(); it++){
    139       COUT(4) << it->first << ":" << it->second << "|";
     139      COUT(4) << it->first << ':' << it->second << '|';
    140140    }
    141141    COUT(4) << std::endl;
  • code/branches/presentation2/src/libraries/network/packet/ClassID.cc

    r5929 r6394  
    4848ClassID::ClassID( ) : Packet(){
    4949  Identifier *id;
    50   std::string classname;
    5150  unsigned int nrOfClasses=0;
    5251  unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nrofclasses
     
    6160    if(id == NULL || !id->hasFactory())
    6261      continue;
    63     classname = id->getName();
     62    const std::string& classname = id->getName();
    6463    network_id = id->getNetworkID();
    6564    // now push the network id and the classname to the stack
  • code/branches/presentation2/src/libraries/network/packet/DeleteObjects.cc

    r6387 r6394  
    7272    unsigned int temp = Synchronisable::popDeletedObject();
    7373    *reinterpret_cast<uint32_t*>(tdata) = temp;
    74     COUT(4) << temp << " ";
     74    COUT(4) << temp << ' ';
    7575    tdata += sizeof(uint32_t);
    7676  }
  • code/branches/presentation2/src/libraries/network/packet/FunctionIDs.cc

    r6388 r6394  
    4747
    4848FunctionIDs::FunctionIDs( ) : Packet(){
    49   std::string functionname;
    5049  unsigned int nrOfFunctions=0;
    5150  unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nroffunctions
     
    5756  ObjectList<NetworkFunctionBase>::iterator it;
    5857  for(it = ObjectList<NetworkFunctionBase>::begin(); it; ++it){
    59     functionname = it->getName();
     58    const std::string& functionname = it->getName();
    6059    networkID = it->getNetworkID();
    6160    // now push the network id and the classname to the stack
  • code/branches/presentation2/src/libraries/network/packet/Gamestate.cc

    r6388 r6394  
    529529//   COUT(0) << "myvector contains:";
    530530//   for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
    531 //     COUT(0) << " " << (*itt).objID;
     531//     COUT(0) << ' ' << (*itt).objID;
    532532//   COUT(0) << endl;
    533533  for(it=dataVector_.begin(); it!=dataVector_.end();){
  • code/branches/presentation2/src/libraries/tools/BillboardSet.cc

    r5781 r6394  
    3838#include "util/Convert.h"
    3939#include "util/Math.h"
    40 #include "util/StringUtils.h"
    4140#include "core/GameMode.h"
    4241
     
    8180        catch (...)
    8281        {
    83             COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
     82            COUT(1) << "Error: Couln't load billboard \"" << file << '"' << std::endl;
    8483            this->billboardSet_ = 0;
    8584        }
     
    104103        catch (...)
    105104        {
    106             COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
     105            COUT(1) << "Error: Couln't load billboard \"" << file << '"' << std::endl;
    107106            this->billboardSet_ = 0;
    108107        }
  • code/branches/presentation2/src/libraries/tools/Mesh.cc

    r5781 r6394  
    3636
    3737#include "util/Convert.h"
    38 #include "util/StringUtils.h"
    3938#include "core/GameMode.h"
    4039
     
    8483            catch (...)
    8584            {
    86                 COUT(1) << "Error: Couln't load mesh \"" << meshsource << "\"" << std::endl;
     85                COUT(1) << "Error: Couln't load mesh \"" << meshsource << '"' << std::endl;
    8786                this->entity_ = 0;
    8887            }
  • code/branches/presentation2/src/libraries/tools/ParticleInterface.cc

    r6218 r6394  
    7878            catch (...)
    7979            {
    80                 COUT(1) << "Error: Couln't load particle system \"" << templateName << "\"" << std::endl;
     80                COUT(1) << "Error: Couln't load particle system \"" << templateName << '"' << std::endl;
    8181                this->particleSystem_ = 0;
    8282            }
  • code/branches/presentation2/src/libraries/tools/ResourceLocation.cc

    r5929 r6394  
    9292    {
    9393        // Remove from Ogre paths
    94         resourceGroup_.erase();
     94        resourceGroup_.clear();
    9595        try
    9696        {
  • code/branches/presentation2/src/libraries/tools/Shader.cc

    r6218 r6394  
    5757        this->bLoadCompositor_ = GameMode::showsGraphics();
    5858        this->bViewportInitialized_ = false;
    59         this->compositor_ = "";
    60         this->oldcompositor_ = "";
    6159
    6260        if (this->bLoadCompositor_ && Ogre::Root::getSingletonPtr())
     
    111109            Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
    112110            assert(viewport);
    113             if (this->oldcompositor_ != "")
     111            if (!this->oldcompositor_.empty())
    114112            {
    115113                Ogre::CompositorManager::getSingleton().removeCompositor(viewport, this->oldcompositor_);
    116114                this->compositorInstance_ = 0;
    117115            }
    118             if (this->compositor_ != "")
     116            if (!this->compositor_.empty())
    119117            {
    120118                this->compositorInstance_ = Ogre::CompositorManager::getSingleton().addCompositor(viewport, this->compositor_);
     
    298296                        continue;
    299297
    300                     if (pass_pointer->getFragmentProgramName() != "")
     298                    if (!pass_pointer->getFragmentProgramName().empty())
    301299                    {
    302300                        Ogre::GpuProgramParameters* parameter_pointer = pass_pointer->getFragmentProgramParameters().get();
  • code/branches/presentation2/src/libraries/tools/TextureGenerator.cc

    r5781 r6394  
    7272        if (it == colourMap.end())
    7373        {
    74             std::string materialName = textureName + "_Material_" + multi_cast<std::string>(materialCount_s++);
     74            const std::string& materialName = textureName + "_Material_" + multi_cast<std::string>(materialCount_s++);
    7575            Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialName, "General"));
    7676            material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
  • code/branches/presentation2/src/libraries/util/Clipboard.cc

    r5958 r6394  
    7878        {
    7979            COUT(1) << "Error: Unable to copy the following text to the clipboard:" << std::endl;
    80             COUT(1) << "       \"" << text << "\"" << std::endl;
     80            COUT(1) << "       \"" << text << '"' << std::endl;
    8181        }
    8282        return false;
     
    9696                if (hData == NULL)
    9797                    return "";
    98                 std::string output = static_cast<char*>(GlobalLock(hData));
     98                std::string output(static_cast<char*>(GlobalLock(hData)));
    9999                GlobalUnlock(hData);
    100100                CloseClipboard();
     
    119119namespace orxonox
    120120{
    121     static std::string clipboard = ""; //!< Keeps the text of our internal clipboard
     121    static std::string clipboard; //!< Keeps the text of our internal clipboard
    122122
    123123    /**
  • code/branches/presentation2/src/libraries/util/Convert.h

    r5738 r6394  
    4343
    4444#include "Debug.h"
    45 #include "StringUtils.h"
    4645#include "TemplateUtils.h"
    4746
     
    336335        FORCEINLINE static bool convert(std::string* output, const char input)
    337336        {
    338             *output = std::string(1, input);
     337            *output = input;
    339338            return true;
    340339        }
     
    345344        FORCEINLINE static bool convert(std::string* output, const unsigned char input)
    346345        {
    347             *output = std::string(1, input);
     346            *output = input;
    348347            return true;
    349348        }
     
    352351    struct ConverterExplicit<std::string, char>
    353352    {
    354         FORCEINLINE static bool convert(char* output, const std::string input)
    355         {
    356             if (input != "")
     353        FORCEINLINE static bool convert(char* output, const std::string& input)
     354        {
     355            if (!input.empty())
    357356                *output = input[0];
    358357            else
     
    364363    struct ConverterExplicit<std::string, unsigned char>
    365364    {
    366         FORCEINLINE static bool convert(unsigned char* output, const std::string input)
    367         {
    368             if (input != "")
     365        FORCEINLINE static bool convert(unsigned char* output, const std::string& input)
     366        {
     367            if (!input.empty())
    369368                *output = input[0];
    370369            else
     
    389388    };
    390389
     390    // Declarations to avoid StringUtils.h include
     391    _UtilExport std::string removeTrailingWhitespaces(const std::string& str);
     392    _UtilExport std::string getLowercase(const std::string& str);
     393
    391394    // std::string to bool
    392395    template <>
     
    395398        static bool convert(bool* output, const std::string& input)
    396399        {
    397             std::string stripped = getLowercase(removeTrailingWhitespaces(input));
     400            const std::string& stripped = getLowercase(removeTrailingWhitespaces(input));
    398401            if (stripped == "true" || stripped == "on" || stripped == "yes")
    399402            {
    400               *output = true;
    401               return true;
     403                *output = true;
     404                return true;
    402405            }
    403406            else if (stripped == "false" || stripped == "off" || stripped == "no")
    404407            {
    405               *output = false;
    406               return true;
     408                *output = false;
     409                return true;
    407410            }
    408411
  • code/branches/presentation2/src/libraries/util/Exception.cc

    r5781 r6394  
    4949        : description_(description)
    5050        , lineNumber_(0)
    51         , functionName_("")
    52         , filename_("")
    5351    { }
    5452
     
    6159    const std::string& Exception::getFullDescription() const
    6260    {
    63         if (fullDescription_ == "")
     61        if (fullDescription_.empty())
    6462        {
    6563            std::ostringstream fullDesc;
     
    6765            fullDesc << this->getTypeName() << "Exception";
    6866
    69             if (this->filename_ != "")
     67            if (!this->filename_.empty())
    7068            {
    7169                fullDesc << " in " << this->filename_;
    7270                if (this->lineNumber_)
    73                     fullDesc << "(" << this->lineNumber_ << ")";
     71                    fullDesc << '(' << this->lineNumber_ << ')';
    7472            }
    7573
    76             if (this->functionName_ != "")
    77                 fullDesc << " in function '" << this->functionName_ << "'";
     74            if (!this->functionName_.empty())
     75                fullDesc << " in function '" << this->functionName_ << '\'';
    7876
    7977            fullDesc << ": ";
    80             if (this->description_ != "")
     78            if (!this->description_.empty())
    8179                fullDesc << this->description_;
    8280            else
    8381                fullDesc << "No description available.";
    8482
    85             this->fullDescription_ = std::string(fullDesc.str());
     83            this->fullDescription_ = fullDesc.str();
    8684        }
    8785
  • code/branches/presentation2/src/libraries/util/Math.h

    r6137 r6394  
    165165    template <> inline bool                 zeroise<bool>()                 { return 0; }
    166166    template <> inline void*                zeroise<void*>()                { return 0; }
    167     template <> inline std::string          zeroise<std::string>()          { return ""; }
     167    template <> inline std::string          zeroise<std::string>()          { return std::string(); }
    168168    template <> inline orxonox::Radian      zeroise<orxonox::Radian>()      { return orxonox::Radian(0.0f); }
    169169    template <> inline orxonox::Degree      zeroise<orxonox::Degree>()      { return orxonox::Degree(0.0f); }
  • code/branches/presentation2/src/libraries/util/MathConvert.h

    r5738 r6394  
    5353        {
    5454            std::ostringstream ostream;
    55             if (ostream << input.x << "," << input.y)
     55            if (ostream << input.x << ',' << input.y)
    5656            {
    5757                (*output) = ostream.str();
     
    6969        {
    7070            std::ostringstream ostream;
    71             if (ostream << input.x << "," << input.y << "," << input.z)
     71            if (ostream << input.x << ',' << input.y << ',' << input.z)
    7272            {
    7373                (*output) = ostream.str();
     
    8585        {
    8686            std::ostringstream ostream;
    87             if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w)
     87            if (ostream << input.x << ',' << input.y << ',' << input.z << ',' << input.w)
    8888            {
    8989                (*output) = ostream.str();
     
    101101        {
    102102            std::ostringstream ostream;
    103             if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z)
     103            if (ostream << input.w << ',' << input.x << ',' << input.y << ',' << input.z)
    104104            {
    105105                (*output) = ostream.str();
     
    117117        {
    118118            std::ostringstream ostream;
    119             if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
     119            if (ostream << input.r << ',' << input.g << ',' << input.b << ',' << input.a)
    120120            {
    121121                (*output) = ostream.str();
  • code/branches/presentation2/src/libraries/util/OutputHandler.cc

    r6277 r6394  
    7777#ifdef ORXONOX_PLATFORM_WINDOWS
    7878            char* pTempDir = getenv("TEMP");
    79             this->logFilename_ = std::string(pTempDir) + "/" + logFileBaseName_g;
     79            this->logFilename_ = std::string(pTempDir) + '/' + logFileBaseName_g;
    8080#else
    8181            this->logFilename_ = std::string("/tmp/") + logFileBaseName_g;
  • code/branches/presentation2/src/libraries/util/StringUtils.cc

    r5738 r6394  
    4040namespace orxonox
    4141{
    42     std::string BLANKSTRING("");
     42    std::string BLANKSTRING;
    4343
    4444    std::string getUniqueNumberString()
     
    5454    {
    5555        size_t pos;
    56         while ((pos = (*str).find(" ")) < (*str).length())
     56        while ((pos = (*str).find(' ')) < (*str).length())
    5757            (*str).erase(pos, 1);
    58         while ((pos = (*str).find("\t")) < (*str).length())
     58        while ((pos = (*str).find('\t')) < (*str).length())
    5959            (*str).erase(pos, 1);
    60         while ((pos = (*str).find("\n")) < (*str).length())
     60        while ((pos = (*str).find('\n')) < (*str).length())
    6161            (*str).erase(pos, 1);
    6262    }
     
    6969    std::string getStripped(const std::string& str)
    7070    {
    71         std::string output = std::string(str);
     71        std::string output(str);
    7272        strip(&output);
    7373        return output;
     
    9898        size_t quote = start - 1;
    9999
    100         while ((quote = str.find('\"', quote + 1)) != std::string::npos)
     100        while ((quote = str.find('"', quote + 1)) != std::string::npos)
    101101        {
    102102            size_t backslash = quote;
     
    231231    {
    232232        // Strip the line, whitespaces are disturbing
    233         std::string teststring = getStripped(str);
     233        const std::string& teststring = getStripped(str);
    234234
    235235        // There are four possible comment-symbols:
     
    259259    bool isEmpty(const std::string& str)
    260260    {
    261         std::string temp = getStripped(str);
    262         return ((temp == "") || (temp.size() == 0));
     261        return getStripped(str).empty();
    263262    }
    264263
     
    303302        for (size_t pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\f"); }
    304303        for (size_t pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\a"); }
    305         for (size_t pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
     304        for (size_t pos = 0; (pos = output.find('"' , pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
    306305        for (size_t pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\0"); }
    307306
     
    319318            return str;
    320319
    321         std::string output = "";
     320        std::string output;
    322321        for (size_t pos = 0; pos < str.size() - 1; )
    323322        {
     
    363362    std::string getLowercase(const std::string& str)
    364363    {
    365         std::string output = std::string(str);
     364        std::string output(str);
    366365        lowercase(&output);
    367366        return output;
     
    387386    std::string getUppercase(const std::string& str)
    388387    {
    389         std::string output = std::string(str);
     388        std::string output(str);
    390389        uppercase(&output);
    391390        return output;
  • code/branches/presentation2/src/libraries/util/SubString.cc

    r6061 r6394  
    270270        }
    271271        else
    272         {
    273             static std::string empty;
    274             return empty;
    275         }
     272            return "";
    276273    }
    277274
  • code/branches/presentation2/src/libraries/util/UtilPrereqs.h

    r6105 r6394  
    131131}
    132132
     133// Just so you don't have to include StringUtils.h everywhere just for this
     134namespace orxonox
     135{
     136    extern _UtilExport std::string BLANKSTRING;
     137}
     138
     139
    133140#endif /* _UtilPrereqs_H__ */
Note: See TracChangeset for help on using the changeset viewer.