[Orxonox-commit 1676] r6394 - in code/branches/presentation2/src: . libraries/core libraries/core/input libraries/network libraries/network/packet libraries/tools libraries/util modules/objects modules/objects/eventsystem modules/objects/triggers modules/overlays modules/overlays/hud modules/pong modules/questsystem modules/questsystem/notifications orxonox orxonox/gamestates orxonox/gametypes orxonox/graphics orxonox/infos orxonox/items orxonox/overlays orxonox/pickup orxonox/sound orxonox/weaponsystem orxonox/worldentities orxonox/worldentities/pawns
rgrieder at orxonox.net
rgrieder at orxonox.net
Tue Dec 22 14:07:45 CET 2009
Author: rgrieder
Date: 2009-12-22 14:07:44 +0100 (Tue, 22 Dec 2009)
New Revision: 6394
Modified:
code/branches/presentation2/src/Orxonox.cc
code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc
code/branches/presentation2/src/libraries/core/BaseObject.cc
code/branches/presentation2/src/libraries/core/ClassTreeMask.cc
code/branches/presentation2/src/libraries/core/CommandEvaluation.cc
code/branches/presentation2/src/libraries/core/CommandEvaluation.h
code/branches/presentation2/src/libraries/core/CommandExecutor.cc
code/branches/presentation2/src/libraries/core/CommandExecutor.h
code/branches/presentation2/src/libraries/core/CommandLineParser.cc
code/branches/presentation2/src/libraries/core/ConfigFileManager.cc
code/branches/presentation2/src/libraries/core/ConfigFileManager.h
code/branches/presentation2/src/libraries/core/ConsoleCommandCompilation.cc
code/branches/presentation2/src/libraries/core/DynLib.cc
code/branches/presentation2/src/libraries/core/Event.cc
code/branches/presentation2/src/libraries/core/EventIncludes.h
code/branches/presentation2/src/libraries/core/Executor.cc
code/branches/presentation2/src/libraries/core/Executor.h
code/branches/presentation2/src/libraries/core/Functor.h
code/branches/presentation2/src/libraries/core/GraphicsManager.cc
code/branches/presentation2/src/libraries/core/IOConsole.cc
code/branches/presentation2/src/libraries/core/IRC.cc
code/branches/presentation2/src/libraries/core/Identifier.cc
code/branches/presentation2/src/libraries/core/Identifier.h
code/branches/presentation2/src/libraries/core/Language.cc
code/branches/presentation2/src/libraries/core/Loader.cc
code/branches/presentation2/src/libraries/core/Namespace.cc
code/branches/presentation2/src/libraries/core/NamespaceNode.cc
code/branches/presentation2/src/libraries/core/OrxonoxClass.cc
code/branches/presentation2/src/libraries/core/PathConfig.cc
code/branches/presentation2/src/libraries/core/Shell.cc
code/branches/presentation2/src/libraries/core/Shell.h
code/branches/presentation2/src/libraries/core/SubclassIdentifier.h
code/branches/presentation2/src/libraries/core/TclBind.cc
code/branches/presentation2/src/libraries/core/TclBind.h
code/branches/presentation2/src/libraries/core/TclThreadManager.cc
code/branches/presentation2/src/libraries/core/TclThreadManager.h
code/branches/presentation2/src/libraries/core/Template.cc
code/branches/presentation2/src/libraries/core/Template.h
code/branches/presentation2/src/libraries/core/XMLPort.h
code/branches/presentation2/src/libraries/core/input/Button.cc
code/branches/presentation2/src/libraries/core/input/Button.h
code/branches/presentation2/src/libraries/core/input/InputBuffer.cc
code/branches/presentation2/src/libraries/core/input/InputManager.cc
code/branches/presentation2/src/libraries/core/input/JoyStick.cc
code/branches/presentation2/src/libraries/core/input/KeyBinder.cc
code/branches/presentation2/src/libraries/core/input/KeyBinder.h
code/branches/presentation2/src/libraries/core/input/KeyDetector.cc
code/branches/presentation2/src/libraries/network/Client.cc
code/branches/presentation2/src/libraries/network/GamestateClient.cc
code/branches/presentation2/src/libraries/network/packet/ClassID.cc
code/branches/presentation2/src/libraries/network/packet/DeleteObjects.cc
code/branches/presentation2/src/libraries/network/packet/FunctionIDs.cc
code/branches/presentation2/src/libraries/network/packet/Gamestate.cc
code/branches/presentation2/src/libraries/tools/BillboardSet.cc
code/branches/presentation2/src/libraries/tools/Mesh.cc
code/branches/presentation2/src/libraries/tools/ParticleInterface.cc
code/branches/presentation2/src/libraries/tools/ResourceLocation.cc
code/branches/presentation2/src/libraries/tools/Shader.cc
code/branches/presentation2/src/libraries/tools/TextureGenerator.cc
code/branches/presentation2/src/libraries/util/Clipboard.cc
code/branches/presentation2/src/libraries/util/Convert.h
code/branches/presentation2/src/libraries/util/Exception.cc
code/branches/presentation2/src/libraries/util/Math.h
code/branches/presentation2/src/libraries/util/MathConvert.h
code/branches/presentation2/src/libraries/util/OutputHandler.cc
code/branches/presentation2/src/libraries/util/StringUtils.cc
code/branches/presentation2/src/libraries/util/SubString.cc
code/branches/presentation2/src/libraries/util/UtilPrereqs.h
code/branches/presentation2/src/modules/objects/Attacher.cc
code/branches/presentation2/src/modules/objects/eventsystem/EventFilter.cc
code/branches/presentation2/src/modules/objects/eventsystem/EventListener.cc
code/branches/presentation2/src/modules/objects/eventsystem/EventTarget.cc
code/branches/presentation2/src/modules/objects/triggers/DistanceTrigger.cc
code/branches/presentation2/src/modules/objects/triggers/Trigger.cc
code/branches/presentation2/src/modules/overlays/GUIOverlay.cc
code/branches/presentation2/src/modules/overlays/OverlayText.cc
code/branches/presentation2/src/modules/overlays/hud/HUDBar.cc
code/branches/presentation2/src/modules/overlays/hud/HUDHealthBar.h
code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc
code/branches/presentation2/src/modules/overlays/hud/HUDRadar.cc
code/branches/presentation2/src/modules/overlays/hud/TeamBaseMatchScore.cc
code/branches/presentation2/src/modules/pong/PongScore.cc
code/branches/presentation2/src/modules/questsystem/QuestDescription.cc
code/branches/presentation2/src/modules/questsystem/QuestGUINode.cc
code/branches/presentation2/src/modules/questsystem/QuestItem.cc
code/branches/presentation2/src/modules/questsystem/QuestListener.cc
code/branches/presentation2/src/modules/questsystem/QuestNotification.cc
code/branches/presentation2/src/modules/questsystem/notifications/Notification.cc
code/branches/presentation2/src/modules/questsystem/notifications/NotificationManager.cc
code/branches/presentation2/src/modules/questsystem/notifications/NotificationQueue.cc
code/branches/presentation2/src/orxonox/Level.cc
code/branches/presentation2/src/orxonox/LevelManager.cc
code/branches/presentation2/src/orxonox/LevelManager.h
code/branches/presentation2/src/orxonox/Radar.cc
code/branches/presentation2/src/orxonox/Radar.h
code/branches/presentation2/src/orxonox/gamestates/GSLevel.cc
code/branches/presentation2/src/orxonox/gametypes/Asteroids.cc
code/branches/presentation2/src/orxonox/gametypes/Deathmatch.cc
code/branches/presentation2/src/orxonox/gametypes/Gametype.cc
code/branches/presentation2/src/orxonox/gametypes/UnderAttack.cc
code/branches/presentation2/src/orxonox/graphics/Billboard.cc
code/branches/presentation2/src/orxonox/infos/HumanPlayer.cc
code/branches/presentation2/src/orxonox/items/Engine.h
code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc
code/branches/presentation2/src/orxonox/overlays/InGameConsole.cc
code/branches/presentation2/src/orxonox/overlays/Map.cc
code/branches/presentation2/src/orxonox/overlays/OrxonoxOverlay.cc
code/branches/presentation2/src/orxonox/pickup/DroppedItem.cc
code/branches/presentation2/src/orxonox/pickup/PickupInventory.cc
code/branches/presentation2/src/orxonox/sound/AmbientSound.cc
code/branches/presentation2/src/orxonox/sound/SoundBuffer.cc
code/branches/presentation2/src/orxonox/sound/SoundManager.cc
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc
code/branches/presentation2/src/orxonox/worldentities/WorldEntity.cc
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/presentation2/src/orxonox/worldentities/pawns/SpaceShip.cc
Log:
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
Modified: code/branches/presentation2/src/Orxonox.cc
===================================================================
--- code/branches/presentation2/src/Orxonox.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/Orxonox.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -61,7 +61,7 @@
#ifndef ORXONOX_USE_WINMAIN
std::string strCmdLine;
for (int i = 1; i < argc; ++i)
- strCmdLine += argv[i] + std::string(" ");
+ strCmdLine += argv[i] + ' ';
#endif
return orxonox::main(strCmdLine);
Modified: code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -71,7 +71,7 @@
#ifdef ORXONOX_PLATFORM_WINDOWS
else
{
- std::string dir = startdirectory.string();
+ const std::string& dir = startdirectory.string();
if (dir.size() > 0 && dir[dir.size() - 1] == ':')
startdirectory = dir + '/';
}
@@ -129,7 +129,7 @@
std::map<std::string, ConfigValueContainer*>::const_iterator variable = identifier->second->getLowercaseConfigValueMap().find(getLowercase(varname));
if (variable != identifier->second->getLowercaseConfigValueMapEnd())
{
- std::string valuestring = variable->second->toString();
+ const std::string& valuestring = variable->second->toString();
oldvalue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
}
}
Modified: code/branches/presentation2/src/libraries/core/BaseObject.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/BaseObject.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/BaseObject.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -35,7 +35,6 @@
#include <tinyxml/tinyxml.h>
-#include "util/StringUtils.h"
#include "CoreIncludes.h"
#include "Event.h"
#include "EventIncludes.h"
@@ -277,7 +276,7 @@
std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(name);
if (it != this->eventStates_.end())
{
- COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << "." << std::endl;
+ COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << '.' << std::endl;
delete (it->second);
}
@@ -347,7 +346,7 @@
std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(event.statename_);
if (it != this->eventStates_.end())
it->second->process(event, this);
- else if (event.statename_ != "")
+ else if (!event.statename_.empty())
COUT(2) << "Warning: \"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl;
else
COUT(2) << "Warning: Event with invalid source sent to object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl;
@@ -385,7 +384,7 @@
{
this->mainStateFunctor_ = 0;
- if (this->mainStateName_ != "")
+ if (!this->mainStateName_.empty())
{
this->registerEventStates();
@@ -436,7 +435,7 @@
// iterate through all states and get the event sources
for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
{
- std::string statename = (*it);
+ const std::string& statename = (*it);
// if the event state is already known, continue with the next state
orxonox::EventState* eventstate = object->getEventState(statename);
@@ -446,8 +445,8 @@
XMLPortClassObjectContainer<BaseObject, BaseObject>* container = (XMLPortClassObjectContainer<BaseObject, BaseObject>*)(identifier->getXMLPortObjectContainer(statename));
if (!container)
{
- ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + "(" + statename + ")");
- ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + "(" + statename + ")");
+ ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + '(' + statename + ')');
+ ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + '(' + statename + ')');
setfunctor->setDefaultValue(1, statename);
getfunctor->setDefaultValue(1, statename);
Modified: code/branches/presentation2/src/libraries/core/ClassTreeMask.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/ClassTreeMask.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/ClassTreeMask.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -815,12 +815,12 @@
{
// Calculate the prefix: + means included, - means excluded
if (it->isIncluded())
- out << "+";
+ out << '+';
else
- out << "-";
+ out << '-';
// Put the name of the corresponding class on the stream
- out << it->getClass()->getName() << " ";
+ out << it->getClass()->getName() << ' ';
}
return out;
Modified: code/branches/presentation2/src/libraries/core/CommandEvaluation.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/CommandEvaluation.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/CommandEvaluation.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -49,7 +49,7 @@
this->command_ = command;
this->commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
- this->additionalParameter_ = "";
+ this->additionalParameter_.clear();
this->bEvaluatedParams_ = false;
@@ -59,10 +59,10 @@
this->functionclass_ = 0;
this->function_ = 0;
- this->possibleArgument_ = "";
- this->argument_ = "";
+ this->possibleArgument_.clear();
+ this->argument_.clear();
- this->errorMessage_ = "";
+ this->errorMessage_.clear();
this->state_ = CommandState::Empty;
}
@@ -78,7 +78,7 @@
if (this->bEvaluatedParams_ && this->function_)
{
- 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;
+ 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;
(*this->function_)(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]);
return true;
}
@@ -97,7 +97,7 @@
return false;
}
- std::string CommandEvaluation::complete()
+ const std::string& CommandEvaluation::complete()
{
if (!this->bNewCommand_)
{
@@ -113,39 +113,39 @@
if (this->function_->getParamCount() == 0)
return (this->command_ = this->function_->getName());
else
- return (this->command_ = this->function_->getName() + " ");
+ return (this->command_ = this->function_->getName() + ' ');
}
else if (this->functionclass_)
- return (this->command_ = this->functionclass_->getName() + " ");
+ return (this->command_ = this->functionclass_->getName() + ' ');
break;
case CommandState::Function:
if (this->function_)
{
if (this->function_->getParamCount() == 0)
- return (this->command_ = this->functionclass_->getName() + " " + this->function_->getName());
+ return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName());
else
- return (this->command_ = this->functionclass_->getName() + " " + this->function_->getName() + " ");
+ return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName() + ' ');
}
break;
case CommandState::ParamPreparation:
case CommandState::Params:
{
- if (this->argument_ == "" && this->possibleArgument_ == "")
+ if (this->argument_.empty() && this->possibleArgument_.empty())
break;
unsigned int maxIndex = this->commandTokens_.size();
if (this->command_[this->command_.size() - 1] != ' ')
maxIndex -= 1;
- std::string whitespace = "";
+ std::string whitespace;
- if (this->possibleArgument_ != "")
+ if (!this->possibleArgument_.empty())
{
this->argument_ = this->possibleArgument_;
if (this->function_->getParamCount() > (maxIndex + 1 - this->getStartindex()))
whitespace = " ";
}
- return (this->command_ = this->commandTokens_.subSet(0, maxIndex).join() + " " + this->argument_ + whitespace);
+ return (this->command_ = this->commandTokens_.subSet(0, maxIndex).join() + ' ' + this->argument_ + whitespace);
break;
}
case CommandState::Finished:
@@ -261,24 +261,24 @@
std::string CommandEvaluation::dump(const std::list<std::pair<const std::string*, const std::string*> >& list)
{
- std::string output = "";
+ std::string output;
for (std::list<std::pair<const std::string*, const std::string*> >::const_iterator it = list.begin(); it != list.end(); ++it)
{
if (it != list.begin())
- output += " ";
+ output += ' ';
- output += *(*it).second;
+ output += *(it->second);
}
return output;
}
std::string CommandEvaluation::dump(const ArgumentCompletionList& list)
{
- std::string output = "";
+ std::string output;
for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
{
if (it != list.begin())
- output += " ";
+ output += ' ';
output += (*it).getDisplay();
}
@@ -294,19 +294,19 @@
for (unsigned int i = 0; i < command->getParamCount(); i++)
{
if (i != 0)
- output += " ";
+ output += ' ';
if (command->defaultValueSet(i))
- output += "[";
+ output += '[';
else
- output += "{";
+ output += '{';
output += command->getTypenameParam(i);
if (command->defaultValueSet(i))
- output += "=" + command->getDefaultValue(i).getString() + "]";
+ output += '=' + command->getDefaultValue(i).getString() + ']';
else
- output += "}";
+ output += '}';
}
return output;
}
Modified: code/branches/presentation2/src/libraries/core/CommandEvaluation.h
===================================================================
--- code/branches/presentation2/src/libraries/core/CommandEvaluation.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/CommandEvaluation.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -65,7 +65,7 @@
void initialize(const std::string& command);
bool execute() const;
- std::string complete();
+ const std::string& complete();
std::string hint() const;
void evaluateParams();
@@ -81,7 +81,7 @@
inline void setAdditionalParameter(const std::string& param)
{ this->additionalParameter_ = param; this->bEvaluatedParams_ = false; }
inline std::string getAdditionalParameter() const
- { return (this->additionalParameter_ != "") ? (" " + this->additionalParameter_) : ""; }
+ { return (!this->additionalParameter_.empty()) ? (' ' + this->additionalParameter_) : ""; }
void setEvaluatedParameter(unsigned int index, MultiType param);
MultiType getEvaluatedParameter(unsigned int index) const;
Modified: code/branches/presentation2/src/libraries/core/CommandExecutor.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/CommandExecutor.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/CommandExecutor.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -58,7 +58,7 @@
std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_.find(command->getName());
if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end())
{
- COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << "." << std::endl;
+ COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << '.' << std::endl;
}
// Make sure we can also delete the external ConsoleCommands that don't belong to an Identifier
@@ -214,7 +214,7 @@
// The first argument is bad
CommandExecutor::getEvaluation().state_ = CommandState::Error;
AddLanguageEntry("commandexecutorunknownfirstargument", "is not a shortcut nor a classname");
- CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + ".";
+ CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + ' ' + GetLocalisation("commandexecutorunknownfirstargument") + '.';
return;
}
}
@@ -230,7 +230,7 @@
if (num_functions == 1 && num_identifiers == 0)
{
// It's a shortcut
- std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;
+ const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first;
CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname);
if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(0)))
{
@@ -242,7 +242,7 @@
CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().function_->getName();
if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
{
- CommandExecutor::getEvaluation().command_ += " ";
+ CommandExecutor::getEvaluation().command_ += ' ';
CommandExecutor::getEvaluation().bCommandChanged_ = true;
}
// Move on to next case
@@ -250,7 +250,7 @@
else if (num_identifiers == 1 && num_functions == 0)
{
// It's a classname
- std::string classname = *(*CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()).first;
+ const std::string& classname = *CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()->first;
CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getPossibleIdentifier(classname);
if (getLowercase(classname) != getLowercase(CommandExecutor::getArgument(0)))
{
@@ -259,7 +259,7 @@
}
CommandExecutor::getEvaluation().state_ = CommandState::Function;
CommandExecutor::getEvaluation().function_ = 0;
- CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " ";
+ CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ';
// Move on to next case
}
else if (num_identifiers == 0 && num_functions == 0)
@@ -267,7 +267,7 @@
// No possibilities
CommandExecutor::getEvaluation().state_ = CommandState::Error;
AddLanguageEntry("commandexecutorunknownfirstargumentstart", "There is no command or classname starting with");
- CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + " " + CommandExecutor::getArgument(0) + ".";
+ CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + ' ' + CommandExecutor::getArgument(0) + '.';
return;
}
else
@@ -318,7 +318,7 @@
if (num_functions == 1)
{
// It's a function
- std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;
+ const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first;
CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname, CommandExecutor::getEvaluation().functionclass_);
if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(1)))
{
@@ -326,10 +326,10 @@
CommandExecutor::getEvaluation().bCommandChanged_ = true;
}
CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
- CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " " + CommandExecutor::getEvaluation().function_->getName();
+ CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + CommandExecutor::getEvaluation().function_->getName();
if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
{
- CommandExecutor::getEvaluation().command_ += " ";
+ CommandExecutor::getEvaluation().command_ += ' ';
CommandExecutor::getEvaluation().bCommandChanged_ = true;
}
// Move on to next case
@@ -339,13 +339,13 @@
// No possibilities
CommandExecutor::getEvaluation().state_ = CommandState::Error;
AddLanguageEntry("commandexecutorunknownsecondargumentstart", "has no function starting with");
- CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + " " + GetLocalisation("commandexecutorunknownsecondargumentstart") + " " + CommandExecutor::getArgument(1) + ".";
+ CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + GetLocalisation("commandexecutorunknownsecondargumentstart") + ' ' + CommandExecutor::getArgument(1) + '.';
return;
}
else
{
// There are several possibilities
- CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleFunctions_);
+ CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleFunctions_);
CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().functionclass_);
CommandExecutor::getEvaluation().bCommandChanged_ = true;
return;
@@ -450,15 +450,15 @@
return (CommandExecutor::argumentsGiven() > (1 + command->getParamCount()));
}
- std::string CommandExecutor::getArgument(unsigned int index)
+ const std::string& CommandExecutor::getArgument(unsigned int index)
{
if (index < (CommandExecutor::getEvaluation().commandTokens_.size()))
return CommandExecutor::getEvaluation().commandTokens_[index];
else
- return "";
+ return BLANKSTRING;
}
- std::string CommandExecutor::getLastArgument()
+ const std::string& CommandExecutor::getLastArgument()
{
return CommandExecutor::getArgument(CommandExecutor::argumentsGiven() - 1);
}
@@ -466,27 +466,27 @@
void CommandExecutor::createListOfPossibleIdentifiers(const std::string& fragment)
{
CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.clear();
- std::string lowercase = getLowercase(fragment);
+ const std::string& lowercase = getLowercase(fragment);
for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapBegin(); it != Identifier::getLowercaseStringIdentifierMapEnd(); ++it)
- if ((*it).second->hasConsoleCommands())
- if ((*it).first.find(lowercase) == 0 || fragment == "")
+ if (it->second->hasConsoleCommands())
+ if (it->first.find(lowercase) == 0 || fragment.empty())
CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
}
void CommandExecutor::createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier)
{
CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear();
- std::string lowercase = getLowercase(fragment);
+ const std::string& lowercase = getLowercase(fragment);
if (!identifier)
{
for (std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin(); it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd(); ++it)
- if ((*it).first.find(lowercase) == 0 || fragment == "")
+ if (it->first.find(lowercase) == 0 || fragment.empty())
CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
}
else
{
for (std::map<std::string, ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMapBegin(); it != identifier->getLowercaseConsoleCommandMapEnd(); ++it)
- if ((*it).first.find(lowercase) == 0 || fragment == "")
+ if (it->first.find(lowercase) == 0 || fragment.empty())
CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
}
}
@@ -496,17 +496,17 @@
CommandExecutor::createArgumentCompletionList(command, param);
CommandExecutor::getEvaluation().listOfPossibleArguments_.clear();
- std::string lowercase = getLowercase(fragment);
+ const std::string& lowercase = getLowercase(fragment);
for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
{
- if ((*it).lowercaseComparison())
+ if (it->lowercaseComparison())
{
- if ((*it).getComparable().find(lowercase) == 0 || fragment == "")
+ if (it->getComparable().find(lowercase) == 0 || fragment.empty())
CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it);
}
else
{
- if ((*it).getComparable().find(fragment) == 0 || fragment == "")
+ if (it->getComparable().find(fragment) == 0 || fragment.empty())
CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it);
}
}
@@ -514,7 +514,7 @@
Identifier* CommandExecutor::getPossibleIdentifier(const std::string& name)
{
- std::string lowercase = getLowercase(name);
+ const std::string& lowercase = getLowercase(name);
std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMap().find(lowercase);
if ((it != Identifier::getLowercaseStringIdentifierMapEnd()) && (*it).second->hasConsoleCommands())
return (*it).second;
@@ -524,7 +524,7 @@
ConsoleCommand* CommandExecutor::getPossibleCommand(const std::string& name, Identifier* identifier)
{
- std::string lowercase = getLowercase(name);
+ const std::string& lowercase = getLowercase(name);
if (!identifier)
{
std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMap().find(lowercase);
@@ -540,26 +540,26 @@
return 0;
}
- std::string CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param)
+ const std::string& CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param)
{
CommandExecutor::createArgumentCompletionList(command, param);
- std::string lowercase = getLowercase(name);
+ const std::string& lowercase = getLowercase(name);
for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
{
- if ((*it).lowercaseComparison())
+ if (it->lowercaseComparison())
{
- if ((*it).getComparable() == lowercase)
- return (*it).getString();
+ if (it->getComparable() == lowercase)
+ return it->getString();
}
else
{
- if ((*it).getComparable() == name)
- return (*it).getString();
+ if (it->getComparable() == name)
+ return it->getString();
}
}
- return "";
+ return BLANKSTRING;
}
void CommandExecutor::createArgumentCompletionList(ConsoleCommand* command, unsigned int param)
@@ -588,11 +588,11 @@
}
else if (list.size() == 1)
{
- return ((*(*list.begin()).first) + " ");
+ return ((*list.begin()->first) + ' ');
}
else
{
- std::string output = "";
+ std::string output;
for (unsigned int i = 0; true; i++)
{
char temp = 0;
@@ -629,19 +629,19 @@
}
else if (list.size() == 1)
{
- return ((*list.begin()).getComparable() + " ");
+ return (list.begin()->getComparable() + ' ');
}
else
{
- std::string output = "";
+ std::string output;
for (unsigned int i = 0; true; i++)
{
char tempComparable = 0;
char temp = 0;
for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
{
- std::string argumentComparable = (*it).getComparable();
- std::string argument = (*it).getString();
+ const std::string& argumentComparable = it->getComparable();
+ const std::string& argument = it->getString();
if (argument.size() > i)
{
if (it == list.begin())
Modified: code/branches/presentation2/src/libraries/core/CommandExecutor.h
===================================================================
--- code/branches/presentation2/src/libraries/core/CommandExecutor.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/CommandExecutor.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -89,8 +89,8 @@
static unsigned int argumentsFinished();
static unsigned int argumentsGiven();
static bool enoughArgumentsGiven(ConsoleCommand* command);
- static std::string getArgument(unsigned int index);
- static std::string getLastArgument();
+ static const std::string& getArgument(unsigned int index);
+ static const std::string& getLastArgument();
static void createListOfPossibleIdentifiers(const std::string& fragment);
static void createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier = 0);
@@ -98,7 +98,7 @@
static Identifier* getPossibleIdentifier(const std::string& name);
static ConsoleCommand* getPossibleCommand(const std::string& name, Identifier* identifier = 0);
- static std::string getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param);
+ static const std::string& getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param);
static void createArgumentCompletionList(ConsoleCommand* command, unsigned int param);
static std::string getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list);
Modified: code/branches/presentation2/src/libraries/core/CommandLineParser.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/CommandLineParser.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/CommandLineParser.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -62,7 +62,7 @@
this->bHasDefaultValue_ = false;
this->value_ = temp;
}
- else if (value == "")
+ else if (value.empty())
{
this->bHasDefaultValue_ = false;
this->value_ = true;
@@ -139,7 +139,7 @@
{
OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
"Cannot have two command line shortcut with the same name.");
- if (it->second->getShortcut() != "")
+ if (!it->second->getShortcut().empty())
cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
}
bFirstTimeParse_ = false;
@@ -164,7 +164,7 @@
else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
{
// negative number as a value
- value += arguments[i] + " ";
+ value += arguments[i] + ' ';
}
else
{
@@ -172,17 +172,17 @@
// save old data first
value = removeTrailingWhitespaces(value);
- if (name != "")
+ if (!name.empty())
{
checkFullArgument(name, value, bParsingFile);
- name = "";
- assert(shortcut == "");
+ name.clear();
+ assert(shortcut.empty());
}
- else if (shortcut != "")
+ else if (!shortcut.empty())
{
checkShortcut(shortcut, value, bParsingFile);
- shortcut = "";
- assert(name == "");
+ shortcut.clear();
+ assert(name.empty());
}
if (arguments[i][1] == '-')
@@ -197,14 +197,14 @@
}
// reset value string
- value = "";
+ value.clear();
}
}
else
{
// value string
- if (name == "" && shortcut == "")
+ if (name.empty() && shortcut.empty())
{
ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
}
@@ -217,15 +217,15 @@
// parse last argument
value = removeTrailingWhitespaces(value);
- if (name != "")
+ if (!name.empty())
{
checkFullArgument(name, value, bParsingFile);
- assert(shortcut == "");
+ assert(shortcut.empty());
}
- else if (shortcut != "")
+ else if (!shortcut.empty())
{
checkShortcut(shortcut, value, bParsingFile);
- assert(name == "");
+ assert(name.empty());
}
}
catch (const ArgumentException& ex)
@@ -290,11 +290,11 @@
for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
it != inst.cmdLineArgs_.end(); ++it)
{
- if (it->second->getShortcut() != "")
+ if (!it->second->getShortcut().empty())
infoStr << " [-" << it->second->getShortcut() << "] ";
else
infoStr << " ";
- infoStr << "--" << it->second->getName() << " ";
+ infoStr << "--" << it->second->getName() << ' ';
if (it->second->getValue().getType() != MT_Type::Bool)
infoStr << "ARG ";
else
@@ -346,7 +346,7 @@
*/
void CommandLineParser::_parseFile()
{
- std::string filename = CommandLineParser::getValue("optionsFile").getString();
+ const std::string& filename = CommandLineParser::getValue("optionsFile").getString();
// look for additional arguments in given file or start.ini as default
// They will not overwrite the arguments given directly
Modified: code/branches/presentation2/src/libraries/core/ConfigFileManager.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/ConfigFileManager.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/ConfigFileManager.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -98,7 +98,7 @@
if (!this->bString_)
this->value_ = value;
else
- this->value_ = "\"" + addSlashes(stripEnclosingQuotes(value)) + "\"";
+ this->value_ = '"' + addSlashes(stripEnclosingQuotes(value)) + '"';
}
std::string ConfigFileEntryValue::getValue() const
@@ -111,10 +111,10 @@
std::string ConfigFileEntryValue::getFileEntry() const
{
- if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
- return (this->name_ + "=" + this->value_);
+ if (this->additionalComment_.empty())
+ return (this->name_ + '=' + this->value_);
else
- return (this->name_ + "=" + this->value_ + " " + this->additionalComment_);
+ return (this->name_ + '=' + this->value_ + " " + this->additionalComment_);
}
@@ -123,10 +123,10 @@
////////////////////////////////
std::string ConfigFileEntryVectorValue::getFileEntry() const
{
- if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
- return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]" + "=" + this->value_);
+ if (this->additionalComment_.empty())
+ return (this->name_ + '[' + multi_cast<std::string>(this->index_) + ']' + '=' + this->value_);
else
- return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]=" + this->value_ + " " + this->additionalComment_);
+ return (this->name_ + '[' + multi_cast<std::string>(this->index_) + "]=" + this->value_ + ' ' + this->additionalComment_);
}
@@ -170,10 +170,10 @@
std::string ConfigFileSection::getFileEntry() const
{
- if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
- return ("[" + this->name_ + "]");
+ if (this->additionalComment_.empty())
+ return ('[' + this->name_ + ']');
else
- return ("[" + this->name_ + "] " + this->additionalComment_);
+ return ('[' + this->name_ + "] " + this->additionalComment_);
}
std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, const std::string& fallback, bool bString)
@@ -250,7 +250,7 @@
std::string line;
std::getline(file, line);
- std::string temp = getStripped(line);
+ const std::string& temp = getStripped(line);
if (!isEmpty(temp) && !isComment(temp))
{
size_t pos1 = temp.find('[');
@@ -260,7 +260,7 @@
if (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1)
{
// New section
- std::string comment = line.substr(pos2 + 1);
+ const std::string& comment = line.substr(pos2 + 1);
if (isComment(comment))
newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
else
@@ -292,7 +292,7 @@
{
commentposition = getNextCommentPosition(line, commentposition + 1);
}
- std::string value = "", comment = "";
+ std::string value, comment;
if (commentposition == std::string::npos)
{
value = removeTrailingWhitespaces(line.substr(pos1 + 1));
Modified: code/branches/presentation2/src/libraries/core/ConfigFileManager.h
===================================================================
--- code/branches/presentation2/src/libraries/core/ConfigFileManager.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/ConfigFileManager.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -88,7 +88,12 @@
class _CoreExport ConfigFileEntryValue : public ConfigFileEntry
{
public:
- 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) {}
+ 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)
+ {}
inline virtual ~ConfigFileEntryValue() {}
inline virtual const std::string& getName() const
@@ -172,7 +177,11 @@
friend class ConfigFile;
public:
- inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") : name_(name), additionalComment_(additionalComment), bUpdated_(false) {}
+ inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "")
+ : name_(name)
+ , additionalComment_(additionalComment)
+ , bUpdated_(false)
+ {}
~ConfigFileSection();
inline const std::string& getName() const
@@ -243,12 +252,12 @@
inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString)
{ this->getSection(section)->setValue(name, value, bString); this->save(); }
inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
- { std::string output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }
+ { const std::string& output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }
inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
{ this->getSection(section)->setValue(name, index, value, bString); this->save(); }
inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
- { std::string output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }
+ { const std::string& output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }
inline void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0)
{ this->getSection(section)->deleteVectorEntries(name, startindex); }
Modified: code/branches/presentation2/src/libraries/core/ConsoleCommandCompilation.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/ConsoleCommandCompilation.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/ConsoleCommandCompilation.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -34,6 +34,7 @@
#include "util/Debug.h"
#include "util/ExprParser.h"
+#include "util/StringUtils.h"
#include "ConsoleCommand.h"
namespace orxonox
@@ -141,7 +142,7 @@
return "";
}
- std::string output = "";
+ std::string output;
while (file.good() && !file.eof())
{
std::string line;
@@ -165,9 +166,9 @@
{
COUT(3) << "Greetings from the restaurant at the end of the universe." << std::endl;
}
- if (expr.getRemains() != "")
+ if (!expr.getRemains().empty())
{
- COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << "'" << std::endl;
+ COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << std::endl;
}
return static_cast<float>(expr.getResult());
}
Modified: code/branches/presentation2/src/libraries/core/DynLib.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/DynLib.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/DynLib.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -69,7 +69,7 @@
// Log library load
COUT(2) << "Loading module " << mName << std::endl;
- std::string name = mName;
+ const std::string& name = mName;
#ifdef ORXONOX_PLATFORM_LINUX
// dlopen() does not add .so to the filename, like windows does for .dll
if (name.substr(name.length() - 3, 3) != ".so")
@@ -131,7 +131,7 @@
#elif defined(ORXONOX_PLATFORM_APPLE)
return std::string(mac_errorBundle());
#else
- return std::string("");
+ return "";
#endif
}
Modified: code/branches/presentation2/src/libraries/core/Event.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Event.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Event.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -52,7 +52,7 @@
{
if (this->bProcessingEvent_)
{
- COUT(2) << "Warning: Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << "\"" << std::endl;
+ COUT(2) << "Warning: Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << '"' << std::endl;
return;
}
Modified: code/branches/presentation2/src/libraries/core/EventIncludes.h
===================================================================
--- code/branches/presentation2/src/libraries/core/EventIncludes.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/EventIncludes.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -65,8 +65,8 @@
XMLPortEventStateIntern(xmlportevent##function, classname, statename, xmlelement, mode)
#define XMLPortEventStateIntern(name, classname, statename, xmlelement, mode) \
- static orxonox::ExecutorMember<classname>* xmlsetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \
- static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \
+ static orxonox::ExecutorMember<classname>* xmlsetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \
+ static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \
XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true)
Modified: code/branches/presentation2/src/libraries/core/Executor.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Executor.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Executor.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -72,8 +72,7 @@
if (paramCount == 1)
{
// only one param: check if there are params given, otherwise try to use default values
- std::string temp = getStripped(params);
- if ((temp != "") && (temp.size() != 0))
+ if (!getStripped(params).empty())
{
param[0] = params;
this->functor_->evaluateParam(0, param[0]);
Modified: code/branches/presentation2/src/libraries/core/Executor.h
===================================================================
--- code/branches/presentation2/src/libraries/core/Executor.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Executor.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -62,8 +62,8 @@
} \
else if (paramCount == 1) \
{ \
- std::string temp = getStripped(params); \
- if ((temp != "") && (temp.size() != 0)) \
+ const std::string& temp = getStripped(params); \
+ if (!temp.empty()) \
{ \
COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; \
EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) MultiType(params)); \
@@ -186,7 +186,7 @@
inline const std::string& getTypenameReturnvalue() const
{ return this->functor_->getTypenameReturnvalue(); }
- inline void setName(const std::string name)
+ inline void setName(const std::string& name)
{ this->name_ = name; }
inline const std::string& getName() const
{ return this->name_; }
Modified: code/branches/presentation2/src/libraries/core/Functor.h
===================================================================
--- code/branches/presentation2/src/libraries/core/Functor.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Functor.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -34,7 +34,6 @@
#include "util/Debug.h"
#include "util/MultiType.h"
-#include "util/StringUtils.h"
namespace orxonox
{
Modified: code/branches/presentation2/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/GraphicsManager.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/GraphicsManager.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -207,7 +207,7 @@
// Add file to the memory archive
shared_array<char> data(new char[output.str().size()]);
// Debug optimisations
- const std::string outputStr = output.str();
+ const std::string& outputStr = output.str();
char* rawData = data.get();
for (unsigned i = 0; i < outputStr.size(); ++i)
rawData[i] = outputStr[i];
@@ -237,12 +237,12 @@
{
COUT(3) << "Setting up Ogre..." << std::endl;
- if (ogreConfigFile_ == "")
+ if (ogreConfigFile_.empty())
{
COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
}
- if (ogreLogFile_ == "")
+ if (ogreLogFile_.empty())
{
COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
ModifyConfigValue(ogreLogFile_, tset, "ogre.log");
@@ -284,8 +284,8 @@
void GraphicsManager::loadOgrePlugins()
{
// just to make sure the next statement doesn't segfault
- if (ogrePluginsDirectory_ == "")
- ogrePluginsDirectory_ = ".";
+ if (ogrePluginsDirectory_.empty())
+ ogrePluginsDirectory_ = '.';
boost::filesystem::path folder(ogrePluginsDirectory_);
// Do some SubString magic to get the comma separated list of plugins
Modified: code/branches/presentation2/src/libraries/core/IOConsole.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/IOConsole.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/IOConsole.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -306,7 +306,7 @@
// Restore cursor position and move it to the right
this->cout_ << "\033[u";
if (this->buffer_->getCursorPosition() > 0)
- this->cout_ << "\033[" << this->buffer_->getCursorPosition() << "C";
+ this->cout_ << "\033[" << this->buffer_->getCursorPosition() << 'C';
}
void IOConsole::printStatusLines()
Modified: code/branches/presentation2/src/libraries/core/IRC.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/IRC.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/IRC.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -32,6 +32,7 @@
#include "util/Convert.h"
#include "util/Exception.h"
+#include "util/StringUtils.h"
#include "ConsoleCommand.h"
#include "CoreIncludes.h"
#include "TclThreadManager.h"
@@ -102,13 +103,13 @@
void IRC::say(const std::string& message)
{
- if (IRC::eval("irk::say $conn #orxonox {" + message + "}"))
+ if (IRC::eval("irk::say $conn #orxonox {" + message + '}'))
IRC::tcl_say(Tcl::object(), Tcl::object(IRC::getInstance().nickname_), Tcl::object(message));
}
void IRC::msg(const std::string& channel, const std::string& message)
{
- if (IRC::eval("irk::say $conn " + channel + " {" + message + "}"))
+ if (IRC::eval("irk::say $conn " + channel + " {" + message + '}'))
IRC::tcl_privmsg(Tcl::object(channel), Tcl::object(IRC::getInstance().nickname_), Tcl::object(message));
}
@@ -130,7 +131,7 @@
void IRC::tcl_action(Tcl::object const &channel, Tcl::object const &nick, Tcl::object const &args)
{
- COUT(0) << "IRC> * " << nick.get() << " " << stripEnclosingBraces(args.get()) << std::endl;
+ COUT(0) << "IRC> * " << nick.get() << ' ' << stripEnclosingBraces(args.get()) << std::endl;
}
void IRC::tcl_info(Tcl::object const &channel, Tcl::object const &args)
Modified: code/branches/presentation2/src/libraries/core/Identifier.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Identifier.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Identifier.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -409,7 +409,7 @@
std::map<std::string, ConfigValueContainer*>::const_iterator it = this->configValues_.find(varname);
if (it != this->configValues_.end())
{
- COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << "." << std::endl;
+ COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << std::endl;
delete (it->second);
}
@@ -457,7 +457,7 @@
std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_.find(command->getName());
if (it != this->consoleCommands_.end())
{
- COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << "." << std::endl;
+ COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << '.' << std::endl;
delete (it->second);
}
@@ -523,7 +523,7 @@
std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
if (it != this->xmlportParamContainers_.end())
{
- COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << "." << std::endl;
+ COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << '.' << std::endl;
delete (it->second);
}
@@ -554,7 +554,7 @@
std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
if (it != this->xmlportObjectContainers_.end())
{
- COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << "." << std::endl;
+ COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << std::endl;
delete (it->second);
}
@@ -572,7 +572,7 @@
for (std::set<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it)
{
if (it != list.begin())
- out << " ";
+ out << ' ';
out << (*it)->getName();
}
Modified: code/branches/presentation2/src/libraries/core/Identifier.h
===================================================================
--- code/branches/presentation2/src/libraries/core/Identifier.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Identifier.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -410,7 +410,7 @@
void ClassIdentifier<T>::initialiseIdentifier()
{
// Get the name of the class
- std::string name = typeid(T).name();
+ const std::string& name = typeid(T).name();
// create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
ClassIdentifier<T>* proposal = new ClassIdentifier<T>();
Modified: code/branches/presentation2/src/libraries/core/Language.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Language.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Language.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -61,7 +61,7 @@
void LanguageEntry::setLocalisation(const std::string& localisation)
{
// Check if the translation is more than just an empty string
- if ((localisation != "") && (localisation.size() > 0))
+ if (!localisation.empty())
{
this->localisedEntry_ = localisation;
this->bLocalisationSet_ = true;
@@ -129,7 +129,7 @@
return newEntry;
}
- COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << "!" << std::endl;
+ COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << '!' << std::endl;
return it->second;
}
@@ -198,7 +198,7 @@
{
COUT(4) << "Read default language file." << std::endl;
- std::string filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
+ const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
// This creates the file if it's not existing
std::ofstream createFile;
@@ -223,7 +223,7 @@
std::getline(file, lineString);
// Check if the line is empty
- if ((lineString != "") && (lineString.size() > 0))
+ if (!lineString.empty())
{
size_t pos = lineString.find('=');
@@ -247,7 +247,7 @@
{
COUT(4) << "Read translated language file (" << Core::getInstance().getLanguage() << ")." << std::endl;
- std::string filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage());
+ const std::string& filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage());
// Open the file
std::ifstream file;
@@ -258,7 +258,7 @@
COUT(1) << "An error occurred in Language.cc:" << std::endl;
COUT(1) << "Error: Couldn't open file " << getFilename(Core::getInstance().getLanguage()) << " to read the translated language entries!" << std::endl;
Core::getInstance().resetLanguage();
- COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << "." << std::endl;
+ COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << '.' << std::endl;
return;
}
@@ -269,7 +269,7 @@
std::getline(file, lineString);
// Check if the line is empty
- if ((lineString != "") && (lineString.size() > 0))
+ if (!lineString.empty())
{
size_t pos = lineString.find('=');
@@ -301,7 +301,7 @@
{
COUT(4) << "Language: Write default language file." << std::endl;
- std::string filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
+ const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
// Open the file
std::ofstream file;
@@ -317,7 +317,7 @@
// Iterate through the list an write the lines into the file
for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
{
- file << (*it).second->getLabel() << "=" << (*it).second->getDefault() << std::endl;
+ file << (*it).second->getLabel() << '=' << (*it).second->getDefault() << std::endl;
}
file.close();
Modified: code/branches/presentation2/src/libraries/core/Loader.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Loader.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Loader.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -164,7 +164,7 @@
rootNamespace->setRoot(true);
rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
- COUT(0) << "Finished loading " << file->getFilename() << "." << std::endl;
+ COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl;
COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString(" ") << std::endl;
@@ -173,7 +173,7 @@
catch (ticpp::Exception& ex)
{
COUT(1) << std::endl;
- COUT(1) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl;
+ COUT(1) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;
COUT(1) << ex.what() << std::endl;
COUT(1) << "Loading aborted." << std::endl;
return false;
@@ -181,7 +181,7 @@
catch (Exception& ex)
{
COUT(1) << std::endl;
- COUT(1) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl;
+ COUT(1) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;
COUT(1) << ex.what() << std::endl;
COUT(1) << "Loading aborted." << std::endl;
return false;
@@ -189,7 +189,7 @@
catch (...)
{
COUT(1) << std::endl;
- COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl;
+ COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;
COUT(1) << Exception::handleMessage() << std::endl;
COUT(1) << "Loading aborted." << std::endl;
return false;
@@ -217,7 +217,7 @@
std::string Loader::replaceLuaTags(const std::string& text)
{
- // chreate map with all Lua tags
+ // create map with all Lua tags
std::map<size_t, bool> luaTags;
{
size_t pos = 0;
@@ -299,7 +299,7 @@
if (bInPrintFunction)
{
// count ['='[ and ]'='] and replace tags with print([[ and ]])
- std::string temp = text.substr(start, end - start);
+ const std::string& temp = text.substr(start, end - start);
{
size_t pos = 0;
while ((pos = temp.find('[', pos)) != std::string::npos)
@@ -344,12 +344,12 @@
equalSignCounter = tempCounter;
}
}
- std::string equalSigns = "";
+ std::string equalSigns;
for(unsigned int i = 0; i < equalSignCounter; i++)
{
- equalSigns += "=";
+ equalSigns += '=';
}
- output << "print([" + equalSigns + "[" + temp + "]" + equalSigns +"])";
+ output << "print([" + equalSigns + '[' + temp + ']' + equalSigns +"])";
start = end + 5;
}
else
Modified: code/branches/presentation2/src/libraries/core/Namespace.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Namespace.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Namespace.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -172,7 +172,7 @@
for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
{
if (i > 0)
- output += "\n";
+ output += '\n';
output += (*it)->toString(indentation);
}
Modified: code/branches/presentation2/src/libraries/core/NamespaceNode.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/NamespaceNode.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/NamespaceNode.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -49,7 +49,7 @@
{
std::set<NamespaceNode*> nodes;
- if ((name.size() == 0) || (name == ""))
+ if (name.empty())
{
nodes.insert(this);
}
@@ -153,10 +153,10 @@
if (i > 0)
output += ", ";
- output += (*it).second->toString();
+ output += it->second->toString();
}
- output += ")";
+ output += ')';
}
return output;
@@ -164,10 +164,10 @@
std::string NamespaceNode::toString(const std::string& indentation) const
{
- std::string output = (indentation + this->name_ + "\n");
+ std::string output = (indentation + this->name_ + '\n');
for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
- output += (*it).second->toString(indentation + " ");
+ output += it->second->toString(indentation + " ");
return output;
}
Modified: code/branches/presentation2/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/OrxonoxClass.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/OrxonoxClass.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -56,7 +56,7 @@
OrxonoxClass::~OrxonoxClass()
{
// if (!this->requestedDestruction_)
-// COUT(2) << "Warning: Destroyed object without destroy() (" << this->getIdentifier()->getName() << ")" << std::endl;
+// COUT(2) << "Warning: Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << std::endl;
assert(this->referenceCount_ <= 0);
Modified: code/branches/presentation2/src/libraries/core/PathConfig.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/PathConfig.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/PathConfig.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -225,7 +225,7 @@
// Option to put all the config and log files in a separate folder
if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
{
- std::string directory(CommandLineParser::getValue("writingPathSuffix").getString());
+ const std::string& directory(CommandLineParser::getValue("writingPathSuffix").getString());
configPath_ = configPath_ / directory;
logPath_ = logPath_ / directory;
}
@@ -255,12 +255,12 @@
std::vector<std::string> modulePaths;
// We search for helper files with the following extension
- std::string moduleextension = specialConfig::moduleExtension;
+ const std::string& moduleextension = specialConfig::moduleExtension;
size_t moduleextensionlength = moduleextension.size();
// Add that path to the PATH variable in case a module depends on another one
- std::string pathVariable = getenv("PATH");
- putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + modulePath_.string()).c_str()));
+ std::string pathVariable(getenv("PATH"));
+ putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));
// Make sure the path exists, otherwise don't load modules
if (!boost::filesystem::exists(modulePath_))
@@ -272,7 +272,7 @@
// Iterate through all files
while (file != end)
{
- std::string filename = file->BOOST_LEAF_FUNCTION();
+ const std::string& filename = file->BOOST_LEAF_FUNCTION();
// Check if the file ends with the exension in question
if (filename.size() > moduleextensionlength)
@@ -280,7 +280,7 @@
if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
{
// We've found a helper file
- std::string library = filename.substr(0, filename.size() - moduleextensionlength);
+ const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
modulePaths.push_back((modulePath_ / library).file_string());
}
}
Modified: code/branches/presentation2/src/libraries/core/Shell.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Shell.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Shell.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -225,13 +225,13 @@
ModifyConfigValue(historyOffset_, set, (this->historyOffset_ + 1) % this->maxHistoryLength_);
}
- std::string Shell::getFromHistory() const
+ const std::string& Shell::getFromHistory() const
{
unsigned int index = mod(static_cast<int>(this->historyOffset_) - static_cast<int>(this->historyPosition_), this->maxHistoryLength_);
if (index < this->commandHistory_.size() && this->historyPosition_ != 0)
return this->commandHistory_[index];
else
- return "";
+ return BLANKSTRING;
}
void Shell::outputChanged(int lineType)
@@ -250,7 +250,7 @@
this->outputBuffer_.clear();
newline = (!eof && !fail);
- if (!newline && output == "")
+ if (!newline && output.empty())
break;
if (this->bFinishedLastLine_)
@@ -399,7 +399,7 @@
if (this->historyPosition_ == this->historyOffset_)
return;
unsigned int cursorPosition = this->getCursorPosition();
- std::string input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning of the inputline until the cursor position
+ 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
for (unsigned int newPos = this->historyPosition_ + 1; newPos <= this->historyOffset_; newPos++)
{
if (getLowercase(this->commandHistory_[this->historyOffset_ - newPos]).find(getLowercase(input_str)) == 0) // search case insensitive
@@ -417,7 +417,7 @@
if (this->historyPosition_ == 0)
return;
unsigned int cursorPosition = this->getCursorPosition();
- std::string input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning
+ const std::string& input_str(this->getInput().substr(0, cursorPosition)); // only search for the expression from the beginning
for (unsigned int newPos = this->historyPosition_ - 1; newPos > 0; newPos--)
{
if (getLowercase(this->commandHistory_[this->historyOffset_ - newPos]).find(getLowercase(input_str)) == 0) // sear$
Modified: code/branches/presentation2/src/libraries/core/Shell.h
===================================================================
--- code/branches/presentation2/src/libraries/core/Shell.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Shell.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -95,7 +95,7 @@
inline unsigned int getCursorPosition() const
{ return this->inputBuffer_->getCursorPosition(); }
- inline std::string getInput() const
+ inline const std::string& getInput() const
{ return this->inputBuffer_->get(); }
typedef std::list<std::pair<std::string, LineType> > LineList;
@@ -117,7 +117,7 @@
Shell(const Shell& other);
void addToHistory(const std::string& command);
- std::string getFromHistory() const;
+ const std::string& getFromHistory() const;
void clearInput();
// OutputListener
void outputChanged(int level);
Modified: code/branches/presentation2/src/libraries/core/SubclassIdentifier.h
===================================================================
--- code/branches/presentation2/src/libraries/core/SubclassIdentifier.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/SubclassIdentifier.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -97,7 +97,7 @@
COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
if (identifier)
{
- COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;
+ COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << std::endl;
COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;
}
else
@@ -165,7 +165,7 @@
if (this->identifier_)
{
COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
- COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;
+ COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << std::endl;
COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;
}
else
Modified: code/branches/presentation2/src/libraries/core/TclBind.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/TclBind.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/TclBind.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -100,12 +100,12 @@
Tcl::interpreter* TclBind::createTclInterpreter()
{
Tcl::interpreter* interpreter = new Tcl::interpreter();
- std::string libpath = TclBind::getTclLibraryPath();
+ const std::string& libpath = TclBind::getTclLibraryPath();
try
{
- if (libpath != "")
- interpreter->eval("set tcl_library \"" + libpath + "\"");
+ if (!libpath.empty())
+ interpreter->eval("set tcl_library \"" + libpath + '"');
Tcl_Init(interpreter->get());
@@ -135,7 +135,7 @@
{
COUT(4) << "Tcl_query: " << args.get() << std::endl;
- std::string command = stripEnclosingBraces(args.get());
+ const std::string& command = stripEnclosingBraces(args.get());
if (!CommandExecutor::execute(command, false))
{
@@ -151,7 +151,7 @@
void TclBind::tcl_execute(Tcl::object const &args)
{
COUT(4) << "Tcl_execute: " << args.get() << std::endl;
- std::string command = stripEnclosingBraces(args.get());
+ const std::string& command = stripEnclosingBraces(args.get());
if (!CommandExecutor::execute(command, false))
{
@@ -165,8 +165,8 @@
{
try
{
- std::string output = TclBind::getInstance().interpreter_->eval("uplevel #0 " + tclcode);
- if (output != "")
+ const std::string& output = TclBind::getInstance().interpreter_->eval("uplevel #0 " + tclcode);
+ if (!output.empty())
{
COUT(0) << "tcl> " << output << std::endl;
}
@@ -181,7 +181,7 @@
return "";
}
- void TclBind::bgerror(std::string error)
+ void TclBind::bgerror(const std::string& error)
{
COUT(1) << "Tcl background error: " << stripEnclosingBraces(error) << std::endl;
}
Modified: code/branches/presentation2/src/libraries/core/TclBind.h
===================================================================
--- code/branches/presentation2/src/libraries/core/TclBind.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/TclBind.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -45,7 +45,7 @@
~TclBind();
static std::string tcl(const std::string& tclcode);
- static void bgerror(std::string error);
+ static void bgerror(const std::string& error);
void setDataPath(const std::string& datapath);
const std::string& getTclDataPath() const { return this->tclDataPath_; }
Modified: code/branches/presentation2/src/libraries/core/TclThreadManager.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/TclThreadManager.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/TclThreadManager.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -38,6 +38,7 @@
#include "util/Clock.h"
#include "util/Convert.h"
#include "util/Exception.h"
+#include "util/StringUtils.h"
#include "CommandExecutor.h"
#include "ConsoleCommand.h"
#include "CoreIncludes.h"
@@ -251,7 +252,7 @@
void TclThreadManager::initialize(TclInterpreterBundle* bundle)
{
- std::string id_string = getConvertedValue<unsigned int, std::string>(bundle->id_);
+ const std::string& id_string = getConvertedValue<unsigned int, std::string>(bundle->id_);
// Initialize the new interpreter
try
@@ -402,10 +403,10 @@
if ((source_bundle->id_ == target_bundle->id_) || source_bundle->queriers_.is_in(target_bundle->id_))
{
// This query would lead to a deadlock - return with an error
- TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + " " + getConvertedValue<unsigned int, std::string>(source_bundle->id_) \
+ TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + getConvertedValue<unsigned int, std::string>(source_bundle->id_) \
+ " -> " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) \
+ "), couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) \
- + " from other interpreter with ID " + getConvertedValue<unsigned int, std::string>(source_bundle->id_) + ".");
+ + " from other interpreter with ID " + getConvertedValue<unsigned int, std::string>(source_bundle->id_) + '.');
}
else
{
@@ -523,11 +524,11 @@
*/
std::string TclThreadManager::dumpList(const std::list<unsigned int>& list)
{
- std::string output = "";
+ std::string output;
for (std::list<unsigned int>::const_iterator it = list.begin(); it != list.end(); ++it)
{
if (it != list.begin())
- output += " ";
+ output += ' ';
output += getConvertedValue<unsigned int, std::string>(*it);
}
@@ -599,7 +600,7 @@
@param bundle The interpreter bundle containing all necessary variables
@param command the Command to execute
*/
- void tclThread(TclInterpreterBundle* bundle, std::string command)
+ void tclThread(TclInterpreterBundle* bundle, const std::string& command)
{
TclThreadManager::debug("TclThread_execute: " + command);
@@ -612,7 +613,7 @@
@brief The main function of a non-interactive source thread. Executes the file.
@param file The name of the file that should be executed by the non-interactive interpreter.
*/
- void sourceThread(std::string file)
+ void sourceThread(const std::string& file)
{
TclThreadManager::debug("TclThread_source: " + file);
@@ -650,9 +651,9 @@
bundle->interpreter_ = new Tcl::interpreter(interp, true);
// Initialize the non-interactive interpreter (like in @ref TclBind::createTclInterpreter but exception safe)
- std::string libpath = TclBind::getTclLibraryPath();
- if (libpath != "")
- TclThreadManager::eval(bundle, "set tcl_library \"" + libpath + "\"", "source");
+ const std::string& libpath = TclBind::getTclLibraryPath();
+ if (!libpath.empty())
+ TclThreadManager::eval(bundle, "set tcl_library \"" + libpath + '"', "source");
int cc = Tcl_Init(interp);
TclThreadManager::eval(bundle, "source \"" + TclBind::getInstance().getTclDataPath() + "/init.tcl\"", "source");
Modified: code/branches/presentation2/src/libraries/core/TclThreadManager.h
===================================================================
--- code/branches/presentation2/src/libraries/core/TclThreadManager.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/TclThreadManager.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -47,8 +47,8 @@
{
friend class Singleton<TclThreadManager>;
friend class TclBind;
- friend _CoreExport void tclThread(TclInterpreterBundle* bundle, std::string command);
- friend _CoreExport void sourceThread(std::string file);
+ friend _CoreExport void tclThread(TclInterpreterBundle* bundle, const std::string& command);
+ friend _CoreExport void sourceThread(const std::string& file);
friend _CoreExport int Tcl_OrxonoxAppInit(Tcl_Interp* interp);
public:
@@ -94,8 +94,8 @@
boost::mutex* mainInterpreterMutex_; ///< A mutex to synchronize queries to the main interpreter
};
- _CoreExport void tclThread(TclInterpreterBundle* bundle, std::string command);
- _CoreExport void sourceThread(std::string file);
+ _CoreExport void tclThread(TclInterpreterBundle* bundle, const std::string& command);
+ _CoreExport void sourceThread(const std::string& file);
_CoreExport int Tcl_OrxonoxAppInit(Tcl_Interp* interp);
}
Modified: code/branches/presentation2/src/libraries/core/Template.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Template.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Template.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -78,7 +78,7 @@
{
SUPER(Template, changedName);
- if (this->getName() != "")
+ if (!this->getName().empty())
{
std::map<std::string, Template*>::iterator it;
it = Template::getTemplateMap().find(this->getOldName());
Modified: code/branches/presentation2/src/libraries/core/Template.h
===================================================================
--- code/branches/presentation2/src/libraries/core/Template.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/Template.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -47,7 +47,7 @@
virtual void changedName();
inline void setLink(const std::string& link)
- { this->link_ = link; this->bIsLink_ = (link != ""); }
+ { this->link_ = link; this->bIsLink_ = !link.empty(); }
inline const std::string& getLink() const
{ return this->link_; }
Modified: code/branches/presentation2/src/libraries/core/XMLPort.h
===================================================================
--- code/branches/presentation2/src/libraries/core/XMLPort.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/XMLPort.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -50,6 +50,7 @@
#include "util/Exception.h"
#include "util/MultiType.h"
#include "util/OrxAssert.h"
+#include "util/StringUtils.h"
#include "Identifier.h"
#include "Executor.h"
#include "BaseObject.h"
@@ -315,7 +316,7 @@
inline const std::string& getName() const
{ return this->paramname_; }
- virtual XMLPortParamContainer& description(const std::string description) = 0;
+ virtual XMLPortParamContainer& description(const std::string& description) = 0;
virtual const std::string& getDescription() = 0;
virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiType& param) = 0;
@@ -343,7 +344,7 @@
};
public:
- XMLPortClassParamContainer(const std::string paramname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor)
+ XMLPortClassParamContainer(const std::string& paramname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor)
{
this->paramname_ = paramname;
this->identifier_ = identifier;
@@ -384,7 +385,7 @@
this->owner_->lastLoadedXMLElement_ = &xmlelement;
}
std::map<std::string, std::string>::const_iterator it = this->owner_->xmlAttributes_.find(getLowercase(this->paramname_));
- std::string attributeValue("");
+ std::string attributeValue;
if (it != this->owner_->xmlAttributes_.end())
attributeValue = it->second;
@@ -406,7 +407,7 @@
catch (ticpp::Exception& ex)
{
COUT(1) << std::endl;
- 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;
+ 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;
COUT(1) << ex.what() << std::endl;
}
}
@@ -434,7 +435,7 @@
return (*this);
}
- virtual XMLPortParamContainer& description(const std::string description)
+ virtual XMLPortParamContainer& description(const std::string& description)
{ this->loadexecutor_->setDescription(description); return (*this); }
virtual const std::string& getDescription()
{ return this->loadexecutor_->getDescription(); }
@@ -496,7 +497,7 @@
inline const std::string& getName() const
{ return this->sectionname_; }
- virtual XMLPortObjectContainer& description(const std::string description) = 0;
+ virtual XMLPortObjectContainer& description(const std::string& description) = 0;
virtual const std::string& getDescription() = 0;
bool identifierIsIncludedInLoaderMask(const Identifier* identifier);
@@ -512,7 +513,7 @@
class XMLPortClassObjectContainer : public XMLPortObjectContainer
{
public:
- XMLPortClassObjectContainer(const std::string sectionname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor, bool bApplyLoaderMask, bool bLoadBefore)
+ XMLPortClassObjectContainer(const std::string& sectionname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor, bool bApplyLoaderMask, bool bLoadBefore)
{
this->sectionname_ = sectionname;
this->identifier_ = identifier;
@@ -537,7 +538,7 @@
try
{
Element* xmlsubelement;
- if ((this->sectionname_ != "") && (this->sectionname_.size() > 0))
+ if (!this->sectionname_.empty())
xmlsubelement = xmlelement.FirstChildElement(this->sectionname_, false);
else
xmlsubelement = &xmlelement;
@@ -569,11 +570,11 @@
if (this->bLoadBefore_)
{
newObject->XMLPort(*child, XMLPort::LoadObject);
- COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")" << std::endl;
+ COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl;
}
else
{
- COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")" << std::endl;
+ COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl;
}
COUT(5) << object->getLoaderIndentation();
@@ -608,7 +609,7 @@
}
else
{
- if (this->sectionname_ != "")
+ if (!this->sectionname_.empty())
{
COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
}
@@ -623,7 +624,7 @@
catch (ticpp::Exception& ex)
{
COUT(1) << std::endl;
- 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;
+ 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;
COUT(1) << ex.what() << std::endl;
}
}
@@ -634,7 +635,7 @@
return (*this);
}
- virtual XMLPortObjectContainer& description(const std::string description)
+ virtual XMLPortObjectContainer& description(const std::string& description)
{ this->loadexecutor_->setDescription(description); return (*this); }
virtual const std::string& getDescription()
{ return this->loadexecutor_->getDescription(); }
Modified: code/branches/presentation2/src/libraries/core/input/Button.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/Button.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/Button.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -115,18 +115,18 @@
for (unsigned int iCommand = 0; iCommand < commandStrings.size(); iCommand++)
{
- if (commandStrings[iCommand] != "")
+ if (!commandStrings[iCommand].empty())
{
SubString tokens(commandStrings[iCommand], " ", SubString::WhiteSpaces, false,
'\\', false, '"', false, '(', ')', false, '\0');
KeybindMode::Value mode = KeybindMode::None;
float paramModifier = 1.0f;
- std::string commandStr = "";
+ std::string commandStr;
for (unsigned int iToken = 0; iToken < tokens.size(); ++iToken)
{
- std::string token = getLowercase(tokens[iToken]);
+ const std::string& token = getLowercase(tokens[iToken]);
if (token == "onpress")
mode = KeybindMode::OnPress;
@@ -158,11 +158,11 @@
// no input related argument
// we interpret everything from here as a command string
while (iToken != tokens.size())
- commandStr += tokens[iToken++] + " ";
+ commandStr += tokens[iToken++] + ' ';
}
}
- if (commandStr == "")
+ if (commandStr.empty())
{
parseError("No command string given.", false);
continue;
@@ -241,7 +241,7 @@
}
}
- inline void Button::parseError(std::string message, bool serious)
+ inline void Button::parseError(const std::string& message, bool serious)
{
if (serious)
{
Modified: code/branches/presentation2/src/libraries/core/input/Button.h
===================================================================
--- code/branches/presentation2/src/libraries/core/input/Button.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/Button.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -75,7 +75,7 @@
std::vector<BufferedParamCommand*>* paramCommandBuffer_;
private:
- void parseError(std::string message, bool serious);
+ void parseError(const std::string& message, bool serious);
};
inline bool Button::execute(KeybindMode::Value mode, float abs, float rel)
Modified: code/branches/presentation2/src/libraries/core/input/InputBuffer.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/InputBuffer.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/InputBuffer.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -38,7 +38,6 @@
{
RegisterRootObject(InputBuffer);
- this->buffer_ = "";
this->cursor_ = 0;
this->maxLength_ = 1024;
this->allowedChars_ = "abcdefghijklmnopqrstuvwxyz \
@@ -61,7 +60,6 @@
this->maxLength_ = 1024;
this->allowedChars_ = allowedChars;
- this->buffer_ = "";
this->cursor_ = 0;
this->lastKey_ = KeyCode::Unassigned;
@@ -137,7 +135,7 @@
void InputBuffer::clear(bool update)
{
- this->buffer_ = "";
+ this->buffer_.clear();
this->cursor_ = 0;
if (update)
@@ -187,7 +185,7 @@
bool InputBuffer::charIsAllowed(const char& input)
{
- if (this->allowedChars_ == "")
+ if (this->allowedChars_.empty())
return true;
else
return (this->allowedChars_.find(input) != std::string::npos);
Modified: code/branches/presentation2/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/InputManager.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/InputManager.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -296,7 +296,7 @@
{
if (device == NULL)
continue;
- std::string className = device->getClassName();
+ const std::string& className = device->getClassName();
try
{
delete device;
@@ -578,7 +578,7 @@
InputState* InputManager::createInputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority)
{
- if (name == "")
+ if (name.empty())
return 0;
if (statesByName_.find(name) == statesByName_.end())
{
Modified: code/branches/presentation2/src/libraries/core/input/JoyStick.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/JoyStick.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/JoyStick.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -32,6 +32,7 @@
#include <ois/OISJoyStick.h>
#include <boost/foreach.hpp>
+#include "util/StringUtils.h"
#include "core/ConfigFileManager.h"
#include "core/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
@@ -60,11 +61,11 @@
{
std::string name = oisDevice_->vendor();
replaceCharacters(name, ' ', '_');
- deviceName_ = name + "_";
+ deviceName_ = name + '_';
}
- deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Button)) + "_";
- deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Axis)) + "_";
- deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Slider)) + "_";
+ deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Button)) + '_';
+ deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Axis)) + '_';
+ deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Slider)) + '_';
deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_POV));
//deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Vector3));
@@ -73,7 +74,7 @@
if (deviceName_ == idString)
{
// Make the ID unique for this execution time.
- deviceName_ += "_" + multi_cast<std::string>(this->getDeviceName());
+ deviceName_ += '_' + multi_cast<std::string>(this->getDeviceName());
break;
}
}
Modified: code/branches/presentation2/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/KeyBinder.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/KeyBinder.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -60,11 +60,11 @@
// keys
for (unsigned int i = 0; i < KeyCode::numberOfKeys; i++)
{
- std::string keyname = KeyCode::ByString[i];
+ const std::string& keyname = KeyCode::ByString[i];
if (!keyname.empty())
keys_[i].name_ = std::string("Key") + keyname;
else
- keys_[i].name_ = "";
+ keys_[i].name_.clear();
keys_[i].paramCommandBuffer_ = ¶mCommandBuffer_;
keys_[i].groupName_ = "Keys";
}
@@ -187,10 +187,10 @@
this->joyStickAxes_.resize(joySticks_.size());
this->joyStickButtons_.resize(joySticks_.size());
- // reinitialise all joy stick binings (doesn't overwrite the old ones)
+ // reinitialise all joy stick bindings (doesn't overwrite the old ones)
for (unsigned int iDev = 0; iDev < joySticks_.size(); iDev++)
{
- std::string deviceName = joySticks_[iDev]->getDeviceName();
+ const std::string& deviceName = joySticks_[iDev]->getDeviceName();
// joy stick buttons
for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++)
{
@@ -220,21 +220,21 @@
// Note: Don't include the dummy keys which don't actually exist in OIS but have a number
for (unsigned int i = 0; i < KeyCode::numberOfKeys; i++)
if (!keys_[i].name_.empty())
- allButtons_[keys_[i].groupName_ + "." + keys_[i].name_] = keys_ + i;
+ allButtons_[keys_[i].groupName_ + '.' + keys_[i].name_] = keys_ + i;
for (unsigned int i = 0; i < numberOfMouseButtons_; i++)
- allButtons_[mouseButtons_[i].groupName_ + "." + mouseButtons_[i].name_] = mouseButtons_ + i;
+ allButtons_[mouseButtons_[i].groupName_ + '.' + mouseButtons_[i].name_] = mouseButtons_ + i;
for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
{
- allButtons_[mouseAxes_[i].groupName_ + "." + mouseAxes_[i].name_] = mouseAxes_ + i;
+ allButtons_[mouseAxes_[i].groupName_ + '.' + mouseAxes_[i].name_] = mouseAxes_ + i;
allHalfAxes_.push_back(mouseAxes_ + i);
}
for (unsigned int iDev = 0; iDev < joySticks_.size(); iDev++)
{
for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++)
- allButtons_[(*joyStickButtons_[iDev])[i].groupName_ + "." + (*joyStickButtons_[iDev])[i].name_] = &((*joyStickButtons_[iDev])[i]);
+ allButtons_[(*joyStickButtons_[iDev])[i].groupName_ + '.' + (*joyStickButtons_[iDev])[i].name_] = &((*joyStickButtons_[iDev])[i]);
for (unsigned int i = 0; i < JoyStickAxisCode::numberOfAxes * 2; i++)
{
- allButtons_[(*joyStickAxes_[iDev])[i].groupName_ + "." + (*joyStickAxes_[iDev])[i].name_] = &((*joyStickAxes_[iDev])[i]);
+ allButtons_[(*joyStickAxes_[iDev])[i].groupName_ + '.' + (*joyStickAxes_[iDev])[i].name_] = &((*joyStickAxes_[iDev])[i]);
allHalfAxes_.push_back(&((*joyStickAxes_[iDev])[i]));
}
}
@@ -283,10 +283,10 @@
}
}
- void KeyBinder::addButtonToCommand(std::string command, Button* button)
+ void KeyBinder::addButtonToCommand(const std::string& command, Button* button)
{
std::ostringstream stream;
- stream << button->groupName_ << "." << button->name_;
+ stream << button->groupName_ << '.' << button->name_;
std::vector<std::string>& oldKeynames = this->allCommands_[button->bindingString_];
std::vector<std::string>::iterator it = std::find(oldKeynames.begin(), oldKeynames.end(), stream.str());
@@ -295,7 +295,7 @@
oldKeynames.erase(it);
}
- if(command != "")
+ if (!command.empty())
{
std::vector<std::string>& keynames = this->allCommands_[command];
if( std::find(keynames.begin(), keynames.end(), stream.str()) == keynames.end())
@@ -309,7 +309,7 @@
@brief
Return the first key name for a specific command
*/
- std::string KeyBinder::getBinding(std::string commandName)
+ const std::string& KeyBinder::getBinding(const std::string& commandName)
{
if( this->allCommands_.find(commandName) != this->allCommands_.end())
{
@@ -317,7 +317,7 @@
return keynames.front();
}
- return "";
+ return BLANKSTRING;
}
/**
@@ -328,7 +328,7 @@
@param index
The index at which the key name is returned for.
*/
- std::string KeyBinder::getBinding(std::string commandName, unsigned int index)
+ const std::string& KeyBinder::getBinding(const std::string& commandName, unsigned int index)
{
if( this->allCommands_.find(commandName) != this->allCommands_.end())
{
@@ -338,10 +338,10 @@
return keynames[index];
}
- return "";
+ return BLANKSTRING;
}
- return "";
+ return BLANKSTRING;
}
/**
@@ -350,7 +350,7 @@
@param commandName
The command.
*/
- unsigned int KeyBinder::getNumberOfBindings(std::string commandName)
+ unsigned int KeyBinder::getNumberOfBindings(const std::string& commandName)
{
if( this->allCommands_.find(commandName) != this->allCommands_.end())
{
Modified: code/branches/presentation2/src/libraries/core/input/KeyBinder.h
===================================================================
--- code/branches/presentation2/src/libraries/core/input/KeyBinder.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/KeyBinder.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -65,9 +65,9 @@
void clearBindings();
bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false);
- std::string getBinding(std::string commandName); //tolua_export
- std::string getBinding(std::string commandName, unsigned int index); //tolua_export
- unsigned int getNumberOfBindings(std::string commandName); //tolua_export
+ const std::string& getBinding(const std::string& commandName); //tolua_export
+ const std::string& getBinding(const std::string& commandName, unsigned int index); //tolua_export
+ unsigned int getNumberOfBindings(const std::string& commandName); //tolua_export
const std::string& getBindingsFilename()
{ return this->filename_; }
@@ -159,7 +159,7 @@
ConfigFileType configFile_;
private:
- void addButtonToCommand(std::string command, Button* button);
+ void addButtonToCommand(const std::string& command, Button* button);
//##### ConfigValues #####
//! Whether to filter small value analog input
Modified: code/branches/presentation2/src/libraries/core/input/KeyDetector.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/KeyDetector.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/core/input/KeyDetector.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -66,7 +66,7 @@
clearBindings();
for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
{
- it->second->bindingString_ = callbackCommand_s + " " + it->second->groupName_ + "." + it->second->name_;
+ it->second->bindingString_ = callbackCommand_s + ' ' + it->second->groupName_ + "." + it->second->name_;
it->second->parse();
}
}
Modified: code/branches/presentation2/src/libraries/network/Client.cc
===================================================================
--- code/branches/presentation2/src/libraries/network/Client.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/network/Client.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -138,7 +138,7 @@
if(timeSinceLastUpdate_>=NETWORK_PERIOD)
{
timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
- // COUT(3) << ".";
+ // COUT(3) << '.';
if ( isConnected() && isSynched_ )
{
COUT(4) << "popping partial gamestate: " << std::endl;
Modified: code/branches/presentation2/src/libraries/network/GamestateClient.cc
===================================================================
--- code/branches/presentation2/src/libraries/network/GamestateClient.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/network/GamestateClient.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -136,7 +136,7 @@
std::map<unsigned int, packet::Gamestate*>::iterator it;
COUT(4) << "gamestates: ";
for(it=gamestateMap_.begin(); it!=gamestateMap_.end(); it++){
- COUT(4) << it->first << ":" << it->second << "|";
+ COUT(4) << it->first << ':' << it->second << '|';
}
COUT(4) << std::endl;
Modified: code/branches/presentation2/src/libraries/network/packet/ClassID.cc
===================================================================
--- code/branches/presentation2/src/libraries/network/packet/ClassID.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/network/packet/ClassID.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -47,7 +47,6 @@
ClassID::ClassID( ) : Packet(){
Identifier *id;
- std::string classname;
unsigned int nrOfClasses=0;
unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nrofclasses
uint32_t network_id;
@@ -60,7 +59,7 @@
id = (*it).second;
if(id == NULL || !id->hasFactory())
continue;
- classname = id->getName();
+ const std::string& classname = id->getName();
network_id = id->getNetworkID();
// now push the network id and the classname to the stack
tempQueue.push( std::pair<unsigned int, std::string>(network_id, classname) );
Modified: code/branches/presentation2/src/libraries/network/packet/DeleteObjects.cc
===================================================================
--- code/branches/presentation2/src/libraries/network/packet/DeleteObjects.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/network/packet/DeleteObjects.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -71,7 +71,7 @@
for(unsigned int i=0; i<number; i++){
unsigned int temp = Synchronisable::popDeletedObject();
*reinterpret_cast<uint32_t*>(tdata) = temp;
- COUT(4) << temp << " ";
+ COUT(4) << temp << ' ';
tdata += sizeof(uint32_t);
}
COUT(4) << std::endl;
Modified: code/branches/presentation2/src/libraries/network/packet/FunctionIDs.cc
===================================================================
--- code/branches/presentation2/src/libraries/network/packet/FunctionIDs.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/network/packet/FunctionIDs.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -46,7 +46,6 @@
FunctionIDs::FunctionIDs( ) : Packet(){
- std::string functionname;
unsigned int nrOfFunctions=0;
unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nroffunctions
uint32_t networkID;
@@ -56,7 +55,7 @@
//calculate total needed size (for all strings and integers)
ObjectList<NetworkFunctionBase>::iterator it;
for(it = ObjectList<NetworkFunctionBase>::begin(); it; ++it){
- functionname = it->getName();
+ const std::string& functionname = it->getName();
networkID = it->getNetworkID();
// now push the network id and the classname to the stack
tempQueue.push( std::pair<unsigned int, std::string>(networkID, functionname) );
Modified: code/branches/presentation2/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/branches/presentation2/src/libraries/network/packet/Gamestate.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/network/packet/Gamestate.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -528,7 +528,7 @@
// std::list<obj>::iterator itt;
// COUT(0) << "myvector contains:";
// for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
-// COUT(0) << " " << (*itt).objID;
+// COUT(0) << ' ' << (*itt).objID;
// COUT(0) << endl;
for(it=dataVector_.begin(); it!=dataVector_.end();){
SynchronisableHeader oldobjectheader(origdata);
Modified: code/branches/presentation2/src/libraries/tools/BillboardSet.cc
===================================================================
--- code/branches/presentation2/src/libraries/tools/BillboardSet.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/tools/BillboardSet.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -37,7 +37,6 @@
#include "util/Convert.h"
#include "util/Math.h"
-#include "util/StringUtils.h"
#include "core/GameMode.h"
namespace orxonox
@@ -80,7 +79,7 @@
}
catch (...)
{
- COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
+ COUT(1) << "Error: Couln't load billboard \"" << file << '"' << std::endl;
this->billboardSet_ = 0;
}
@@ -103,7 +102,7 @@
}
catch (...)
{
- COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl;
+ COUT(1) << "Error: Couln't load billboard \"" << file << '"' << std::endl;
this->billboardSet_ = 0;
}
Modified: code/branches/presentation2/src/libraries/tools/Mesh.cc
===================================================================
--- code/branches/presentation2/src/libraries/tools/Mesh.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/tools/Mesh.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -35,7 +35,6 @@
#include <OgreSceneManager.h>
#include "util/Convert.h"
-#include "util/StringUtils.h"
#include "core/GameMode.h"
namespace orxonox
@@ -83,7 +82,7 @@
}
catch (...)
{
- COUT(1) << "Error: Couln't load mesh \"" << meshsource << "\"" << std::endl;
+ COUT(1) << "Error: Couln't load mesh \"" << meshsource << '"' << std::endl;
this->entity_ = 0;
}
}
Modified: code/branches/presentation2/src/libraries/tools/ParticleInterface.cc
===================================================================
--- code/branches/presentation2/src/libraries/tools/ParticleInterface.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/tools/ParticleInterface.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -77,7 +77,7 @@
}
catch (...)
{
- COUT(1) << "Error: Couln't load particle system \"" << templateName << "\"" << std::endl;
+ COUT(1) << "Error: Couln't load particle system \"" << templateName << '"' << std::endl;
this->particleSystem_ = 0;
}
}
Modified: code/branches/presentation2/src/libraries/tools/ResourceLocation.cc
===================================================================
--- code/branches/presentation2/src/libraries/tools/ResourceLocation.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/tools/ResourceLocation.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -91,7 +91,7 @@
void ResourceLocation::unload()
{
// Remove from Ogre paths
- resourceGroup_.erase();
+ resourceGroup_.clear();
try
{
Ogre::ResourceGroupManager::getSingleton().removeResourceLocation(
Modified: code/branches/presentation2/src/libraries/tools/Shader.cc
===================================================================
--- code/branches/presentation2/src/libraries/tools/Shader.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/tools/Shader.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -56,8 +56,6 @@
this->bVisible_ = true;
this->bLoadCompositor_ = GameMode::showsGraphics();
this->bViewportInitialized_ = false;
- this->compositor_ = "";
- this->oldcompositor_ = "";
if (this->bLoadCompositor_ && Ogre::Root::getSingletonPtr())
{
@@ -110,12 +108,12 @@
{
Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
assert(viewport);
- if (this->oldcompositor_ != "")
+ if (!this->oldcompositor_.empty())
{
Ogre::CompositorManager::getSingleton().removeCompositor(viewport, this->oldcompositor_);
this->compositorInstance_ = 0;
}
- if (this->compositor_ != "")
+ if (!this->compositor_.empty())
{
this->compositorInstance_ = Ogre::CompositorManager::getSingleton().addCompositor(viewport, this->compositor_);
if (!this->compositorInstance_)
@@ -297,7 +295,7 @@
if (!pass_pointer)
continue;
- if (pass_pointer->getFragmentProgramName() != "")
+ if (!pass_pointer->getFragmentProgramName().empty())
{
Ogre::GpuProgramParameters* parameter_pointer = pass_pointer->getFragmentProgramParameters().get();
if (!parameter_pointer)
Modified: code/branches/presentation2/src/libraries/tools/TextureGenerator.cc
===================================================================
--- code/branches/presentation2/src/libraries/tools/TextureGenerator.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/tools/TextureGenerator.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -71,7 +71,7 @@
if (it == colourMap.end())
{
- std::string materialName = textureName + "_Material_" + multi_cast<std::string>(materialCount_s++);
+ const std::string& materialName = textureName + "_Material_" + multi_cast<std::string>(materialCount_s++);
Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialName, "General"));
material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
Ogre::TextureUnitState* textureUnitState = material->getTechnique(0)->getPass(0)->createTextureUnitState();
Modified: code/branches/presentation2/src/libraries/util/Clipboard.cc
===================================================================
--- code/branches/presentation2/src/libraries/util/Clipboard.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/Clipboard.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -77,7 +77,7 @@
catch (...)
{
COUT(1) << "Error: Unable to copy the following text to the clipboard:" << std::endl;
- COUT(1) << " \"" << text << "\"" << std::endl;
+ COUT(1) << " \"" << text << '"' << std::endl;
}
return false;
}
@@ -95,7 +95,7 @@
HANDLE hData = GetClipboardData(CF_TEXT);
if (hData == NULL)
return "";
- std::string output = static_cast<char*>(GlobalLock(hData));
+ std::string output(static_cast<char*>(GlobalLock(hData)));
GlobalUnlock(hData);
CloseClipboard();
@@ -118,7 +118,7 @@
namespace orxonox
{
- static std::string clipboard = ""; //!< Keeps the text of our internal clipboard
+ static std::string clipboard; //!< Keeps the text of our internal clipboard
/**
@brief Default implementation if there is no OS-specific implementation or no clipboard. Copies the text into an internal clipboard.
Modified: code/branches/presentation2/src/libraries/util/Convert.h
===================================================================
--- code/branches/presentation2/src/libraries/util/Convert.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/Convert.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -42,7 +42,6 @@
#include <typeinfo>
#include "Debug.h"
-#include "StringUtils.h"
#include "TemplateUtils.h"
////////////////////////////////////
@@ -335,7 +334,7 @@
{
FORCEINLINE static bool convert(std::string* output, const char input)
{
- *output = std::string(1, input);
+ *output = input;
return true;
}
};
@@ -344,16 +343,16 @@
{
FORCEINLINE static bool convert(std::string* output, const unsigned char input)
{
- *output = std::string(1, input);
+ *output = input;
return true;
}
};
template <>
struct ConverterExplicit<std::string, char>
{
- FORCEINLINE static bool convert(char* output, const std::string input)
+ FORCEINLINE static bool convert(char* output, const std::string& input)
{
- if (input != "")
+ if (!input.empty())
*output = input[0];
else
*output = '\0';
@@ -363,9 +362,9 @@
template <>
struct ConverterExplicit<std::string, unsigned char>
{
- FORCEINLINE static bool convert(unsigned char* output, const std::string input)
+ FORCEINLINE static bool convert(unsigned char* output, const std::string& input)
{
- if (input != "")
+ if (!input.empty())
*output = input[0];
else
*output = '\0';
@@ -388,22 +387,26 @@
}
};
+ // Declarations to avoid StringUtils.h include
+ _UtilExport std::string removeTrailingWhitespaces(const std::string& str);
+ _UtilExport std::string getLowercase(const std::string& str);
+
// std::string to bool
template <>
struct ConverterExplicit<std::string, bool>
{
static bool convert(bool* output, const std::string& input)
{
- std::string stripped = getLowercase(removeTrailingWhitespaces(input));
+ const std::string& stripped = getLowercase(removeTrailingWhitespaces(input));
if (stripped == "true" || stripped == "on" || stripped == "yes")
{
- *output = true;
- return true;
+ *output = true;
+ return true;
}
else if (stripped == "false" || stripped == "off" || stripped == "no")
{
- *output = false;
- return true;
+ *output = false;
+ return true;
}
std::istringstream iss(input);
Modified: code/branches/presentation2/src/libraries/util/Exception.cc
===================================================================
--- code/branches/presentation2/src/libraries/util/Exception.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/Exception.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -48,8 +48,6 @@
Exception::Exception(const std::string& description)
: description_(description)
, lineNumber_(0)
- , functionName_("")
- , filename_("")
{ }
/**
@@ -60,29 +58,29 @@
*/
const std::string& Exception::getFullDescription() const
{
- if (fullDescription_ == "")
+ if (fullDescription_.empty())
{
std::ostringstream fullDesc;
fullDesc << this->getTypeName() << "Exception";
- if (this->filename_ != "")
+ if (!this->filename_.empty())
{
fullDesc << " in " << this->filename_;
if (this->lineNumber_)
- fullDesc << "(" << this->lineNumber_ << ")";
+ fullDesc << '(' << this->lineNumber_ << ')';
}
- if (this->functionName_ != "")
- fullDesc << " in function '" << this->functionName_ << "'";
+ if (!this->functionName_.empty())
+ fullDesc << " in function '" << this->functionName_ << '\'';
fullDesc << ": ";
- if (this->description_ != "")
+ if (!this->description_.empty())
fullDesc << this->description_;
else
fullDesc << "No description available.";
- this->fullDescription_ = std::string(fullDesc.str());
+ this->fullDescription_ = fullDesc.str();
}
return fullDescription_;
Modified: code/branches/presentation2/src/libraries/util/Math.h
===================================================================
--- code/branches/presentation2/src/libraries/util/Math.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/Math.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -164,7 +164,7 @@
template <> inline long double zeroise<long double>() { return 0; }
template <> inline bool zeroise<bool>() { return 0; }
template <> inline void* zeroise<void*>() { return 0; }
- template <> inline std::string zeroise<std::string>() { return ""; }
+ template <> inline std::string zeroise<std::string>() { return std::string(); }
template <> inline orxonox::Radian zeroise<orxonox::Radian>() { return orxonox::Radian(0.0f); }
template <> inline orxonox::Degree zeroise<orxonox::Degree>() { return orxonox::Degree(0.0f); }
template <> inline orxonox::Vector2 zeroise<orxonox::Vector2>() { return orxonox::Vector2 (0, 0) ; }
Modified: code/branches/presentation2/src/libraries/util/MathConvert.h
===================================================================
--- code/branches/presentation2/src/libraries/util/MathConvert.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/MathConvert.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -52,7 +52,7 @@
FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input)
{
std::ostringstream ostream;
- if (ostream << input.x << "," << input.y)
+ if (ostream << input.x << ',' << input.y)
{
(*output) = ostream.str();
return true;
@@ -68,7 +68,7 @@
FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input)
{
std::ostringstream ostream;
- if (ostream << input.x << "," << input.y << "," << input.z)
+ if (ostream << input.x << ',' << input.y << ',' << input.z)
{
(*output) = ostream.str();
return true;
@@ -84,7 +84,7 @@
FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input)
{
std::ostringstream ostream;
- if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w)
+ if (ostream << input.x << ',' << input.y << ',' << input.z << ',' << input.w)
{
(*output) = ostream.str();
return true;
@@ -100,7 +100,7 @@
FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input)
{
std::ostringstream ostream;
- if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z)
+ if (ostream << input.w << ',' << input.x << ',' << input.y << ',' << input.z)
{
(*output) = ostream.str();
return true;
@@ -116,7 +116,7 @@
FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input)
{
std::ostringstream ostream;
- if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
+ if (ostream << input.r << ',' << input.g << ',' << input.b << ',' << input.a)
{
(*output) = ostream.str();
return true;
Modified: code/branches/presentation2/src/libraries/util/OutputHandler.cc
===================================================================
--- code/branches/presentation2/src/libraries/util/OutputHandler.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/OutputHandler.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -76,7 +76,7 @@
// Get path for a temporary file
#ifdef ORXONOX_PLATFORM_WINDOWS
char* pTempDir = getenv("TEMP");
- this->logFilename_ = std::string(pTempDir) + "/" + logFileBaseName_g;
+ this->logFilename_ = std::string(pTempDir) + '/' + logFileBaseName_g;
#else
this->logFilename_ = std::string("/tmp/") + logFileBaseName_g;
#endif
Modified: code/branches/presentation2/src/libraries/util/StringUtils.cc
===================================================================
--- code/branches/presentation2/src/libraries/util/StringUtils.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/StringUtils.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -39,7 +39,7 @@
namespace orxonox
{
- std::string BLANKSTRING("");
+ std::string BLANKSTRING;
std::string getUniqueNumberString()
{
@@ -53,11 +53,11 @@
void strip(std::string* str)
{
size_t pos;
- while ((pos = (*str).find(" ")) < (*str).length())
+ while ((pos = (*str).find(' ')) < (*str).length())
(*str).erase(pos, 1);
- while ((pos = (*str).find("\t")) < (*str).length())
+ while ((pos = (*str).find('\t')) < (*str).length())
(*str).erase(pos, 1);
- while ((pos = (*str).find("\n")) < (*str).length())
+ while ((pos = (*str).find('\n')) < (*str).length())
(*str).erase(pos, 1);
}
@@ -68,7 +68,7 @@
*/
std::string getStripped(const std::string& str)
{
- std::string output = std::string(str);
+ std::string output(str);
strip(&output);
return output;
}
@@ -97,7 +97,7 @@
{
size_t quote = start - 1;
- while ((quote = str.find('\"', quote + 1)) != std::string::npos)
+ while ((quote = str.find('"', quote + 1)) != std::string::npos)
{
size_t backslash = quote;
size_t numbackslashes = 0;
@@ -230,7 +230,7 @@
bool isComment(const std::string& str)
{
// Strip the line, whitespaces are disturbing
- std::string teststring = getStripped(str);
+ const std::string& teststring = getStripped(str);
// There are four possible comment-symbols:
// 1) #comment in script-language style
@@ -258,8 +258,7 @@
*/
bool isEmpty(const std::string& str)
{
- std::string temp = getStripped(str);
- return ((temp == "") || (temp.size() == 0));
+ return getStripped(str).empty();
}
/**
@@ -302,7 +301,7 @@
for (size_t pos = 0; (pos = output.find('\r', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\r"); }
for (size_t pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\f"); }
for (size_t pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\a"); }
- for (size_t pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
+ for (size_t pos = 0; (pos = output.find('"' , pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
for (size_t pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\0"); }
return output;
@@ -318,7 +317,7 @@
if (str.size() <= 1)
return str;
- std::string output = "";
+ std::string output;
for (size_t pos = 0; pos < str.size() - 1; )
{
if (str[pos] == '\\')
@@ -362,7 +361,7 @@
*/
std::string getLowercase(const std::string& str)
{
- std::string output = std::string(str);
+ std::string output(str);
lowercase(&output);
return output;
}
@@ -386,7 +385,7 @@
*/
std::string getUppercase(const std::string& str)
{
- std::string output = std::string(str);
+ std::string output(str);
uppercase(&output);
return output;
}
Modified: code/branches/presentation2/src/libraries/util/SubString.cc
===================================================================
--- code/branches/presentation2/src/libraries/util/SubString.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/SubString.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -269,10 +269,7 @@
return retVal;
}
else
- {
- static std::string empty;
- return empty;
- }
+ return "";
}
Modified: code/branches/presentation2/src/libraries/util/UtilPrereqs.h
===================================================================
--- code/branches/presentation2/src/libraries/util/UtilPrereqs.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/libraries/util/UtilPrereqs.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -130,4 +130,11 @@
typedef const ScopeGuardImplBase& ScopeGuard;
}
+// Just so you don't have to include StringUtils.h everywhere just for this
+namespace orxonox
+{
+ extern _UtilExport std::string BLANKSTRING;
+}
+
+
#endif /* _UtilPrereqs_H__ */
Modified: code/branches/presentation2/src/modules/objects/Attacher.cc
===================================================================
--- code/branches/presentation2/src/modules/objects/Attacher.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/objects/Attacher.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -97,7 +97,7 @@
this->targetname_ = target;
this->target_ = 0;
- if (this->targetname_ == "")
+ if (this->targetname_.empty())
return;
for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
@@ -112,7 +112,7 @@
void Attacher::loadedNewXMLName(BaseObject* object)
{
- if (this->target_ || this->targetname_ == "")
+ if (this->target_ || this->targetname_.empty())
return;
WorldEntity* entity = orxonox_cast<WorldEntity*>(object);
Modified: code/branches/presentation2/src/modules/objects/eventsystem/EventFilter.cc
===================================================================
--- code/branches/presentation2/src/modules/objects/eventsystem/EventFilter.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/objects/eventsystem/EventFilter.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -61,7 +61,7 @@
{
if (this->bActive_)
{
- COUT(2) << "Warning: Detected Event loop in EventFilter \"" << this->getName() << "\"" << std::endl;
+ COUT(2) << "Warning: Detected Event loop in EventFilter \"" << this->getName() << '"' << std::endl;
return;
}
Modified: code/branches/presentation2/src/modules/objects/eventsystem/EventListener.cc
===================================================================
--- code/branches/presentation2/src/modules/objects/eventsystem/EventListener.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/objects/eventsystem/EventListener.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -57,7 +57,7 @@
{
if (this->bActive_)
{
- COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << "\"" << std::endl;
+ COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << '"' << std::endl;
return;
}
@@ -70,7 +70,7 @@
{
this->eventName_ = eventname;
- if (this->eventName_ == "")
+ if (this->eventName_.empty())
return;
for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
@@ -80,7 +80,7 @@
void EventListener::loadedNewXMLName(BaseObject* object)
{
- if (this->eventName_ == "")
+ if (this->eventName_.empty())
return;
if (object->getName() == this->eventName_)
Modified: code/branches/presentation2/src/modules/objects/eventsystem/EventTarget.cc
===================================================================
--- code/branches/presentation2/src/modules/objects/eventsystem/EventTarget.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/objects/eventsystem/EventTarget.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -59,7 +59,7 @@
{
if (this->bActive_)
{
- COUT(2) << "Warning: Detected Event loop in EventTarget \"" << this->getName() << "\"" << std::endl;
+ COUT(2) << "Warning: Detected Event loop in EventTarget \"" << this->getName() << '"' << std::endl;
return;
}
@@ -79,7 +79,7 @@
void EventTarget::loadedNewXMLName(BaseObject* object)
{
- if (this->target_ == "")
+ if (this->target_.empty())
return;
if (object->getName() == this->target_)
Modified: code/branches/presentation2/src/modules/objects/triggers/DistanceTrigger.cc
===================================================================
--- code/branches/presentation2/src/modules/objects/triggers/DistanceTrigger.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/objects/triggers/DistanceTrigger.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -91,7 +91,7 @@
if (!targetId)
{
- COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl;
+ COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << std::endl;
return;
}
Modified: code/branches/presentation2/src/modules/objects/triggers/Trigger.cc
===================================================================
--- code/branches/presentation2/src/modules/objects/triggers/Trigger.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/objects/triggers/Trigger.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -279,13 +279,13 @@
std::string Trigger::getModeString() const
{
if (this->mode_ == TriggerMode::EventTriggerAND)
- return std::string("and");
+ return "and";
else if (this->mode_ == TriggerMode::EventTriggerOR)
- return std::string("or");
+ return "or";
else if (this->mode_ == TriggerMode::EventTriggerXOR)
- return std::string("xor");
+ return "xor";
else
- return std::string("and");
+ return "and";
}
void Trigger::addTrigger(Trigger* trigger)
Modified: code/branches/presentation2/src/modules/overlays/GUIOverlay.cc
===================================================================
--- code/branches/presentation2/src/modules/overlays/GUIOverlay.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/overlays/GUIOverlay.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -68,10 +68,9 @@
if (this->isVisible())
{
- std::string str;
- std::stringstream out;
+ std::ostringstream out;
out << reinterpret_cast<long>(this);
- str = out.str();
+ const std::string& str = out.str();
COUT(1) << "GUIManager ptr: " << str << std::endl;
GUIManager::getInstance().showGUIExtra(this->guiName_, str);
Modified: code/branches/presentation2/src/modules/overlays/OverlayText.cc
===================================================================
--- code/branches/presentation2/src/modules/overlays/OverlayText.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/overlays/OverlayText.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -133,7 +133,7 @@
void OverlayText::setFont(const std::string& font)
{
- if (font != "")
+ if (!font.empty())
this->text_->setFontName(font);
}
const std::string& OverlayText::getFont() const
Modified: code/branches/presentation2/src/modules/overlays/hud/HUDBar.cc
===================================================================
--- code/branches/presentation2/src/modules/overlays/hud/HUDBar.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/overlays/hud/HUDBar.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -71,7 +71,7 @@
RegisterObject(HUDBar);
// create new material
- std::string materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
+ const std::string& materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General"));
material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
Modified: code/branches/presentation2/src/modules/overlays/hud/HUDHealthBar.h
===================================================================
--- code/branches/presentation2/src/modules/overlays/hud/HUDHealthBar.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/overlays/hud/HUDHealthBar.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -52,7 +52,7 @@
virtual void changedName();
inline void setTextFont(const std::string& font)
- { if (font != "") { this->textoverlay_->setFont(font); } }
+ { if (!font.empty()) { this->textoverlay_->setFont(font); } }
inline const std::string& getTextFont() const
{ return this->textoverlay_->getFont(); }
Modified: code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -35,7 +35,6 @@
#include <OgrePanelOverlayElement.h>
#include "util/Math.h"
-#include "util/StringUtils.h"
#include "util/Convert.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
@@ -107,7 +106,7 @@
void HUDNavigation::setFont(const std::string& font)
{
- if (this->navText_ && font != "")
+ if (this->navText_ && !font.empty())
this->navText_->setFontName(font);
}
Modified: code/branches/presentation2/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/presentation2/src/modules/overlays/hud/HUDRadar.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/overlays/hud/HUDRadar.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -125,7 +125,7 @@
{
panel = *itRadarDots_;
++itRadarDots_;
- std::string materialName = TextureGenerator::getMaterialName(
+ const std::string& materialName = TextureGenerator::getMaterialName(
shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour());
if (materialName != panel->getMaterialName())
panel->setMaterialName(materialName);
Modified: code/branches/presentation2/src/modules/overlays/hud/TeamBaseMatchScore.cc
===================================================================
--- code/branches/presentation2/src/modules/overlays/hud/TeamBaseMatchScore.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/overlays/hud/TeamBaseMatchScore.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -70,11 +70,11 @@
if (this->owner_)
{
- std::string bases1 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ")";
- std::string bases2 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ")";
+ const std::string& bases1 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ')';
+ const std::string& bases2 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ')';
- std::string score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));
- std::string score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));
+ const std::string& score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));
+ const std::string& score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));
std::string output1;
if (this->bShowLeftTeam_)
@@ -98,11 +98,11 @@
output2 = bases2;
}
- std::string output = "";
+ std::string output;
if (this->bShowBases_ || this->bShowScore_)
{
if (this->bShowLeftTeam_ && this->bShowRightTeam_)
- output = output1 + ":" + output2;
+ output = output1 + ':' + output2;
else if (this->bShowLeftTeam_ || this->bShowRightTeam_)
output = output1 + output2;
}
Modified: code/branches/presentation2/src/modules/pong/PongScore.cc
===================================================================
--- code/branches/presentation2/src/modules/pong/PongScore.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/pong/PongScore.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -76,8 +76,8 @@
std::string name1;
std::string name2;
- std::string score1 = "0";
- std::string score2 = "0";
+ std::string score1("0");
+ std::string score2("0");
if (player1)
{
@@ -113,11 +113,11 @@
output2 = name2;
}
- std::string output = "PONG";
+ std::string output("PONG");
if (this->bShowName_ || this->bShowScore_)
{
if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)
- output = output1 + ":" + output2;
+ output = output1 + ':' + output2;
else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)
output = output1 + output2;
}
Modified: code/branches/presentation2/src/modules/questsystem/QuestDescription.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/QuestDescription.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/QuestDescription.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -49,9 +49,6 @@
QuestDescription::QuestDescription(BaseObject* creator) : BaseObject(creator)
{
RegisterObject(QuestDescription);
-
- this->title_ = "";
- this->description_ = "";
}
/**
@@ -93,24 +90,24 @@
*/
bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const
{
- std::string message = "";
+ std::string message;
if(item == "hint")
{
- message = "You received a hint: '" + this->title_ + "'";
+ message = "You received a hint: '" + this->title_ + '\'';
}
else if(item == "quest")
{
if(status == "start")
{
- message = "You received a new quest: '" + this->title_ + "'";
+ message = "You received a new quest: '" + this->title_ + '\'';
}
else if(status == "fail")
{
- message = "You failed the quest: '" + this->title_ + "'";
+ message = "You failed the quest: '" + this->title_ + '\'';
}
else if(status == "complete")
{
- message = "You successfully completed the quest: '" + this->title_ + "'";
+ message = "You successfully completed the quest: '" + this->title_ + '\'';
}
else
{
Modified: code/branches/presentation2/src/modules/questsystem/QuestGUINode.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/QuestGUINode.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/QuestGUINode.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -133,11 +133,11 @@
{
if(this->window_ != NULL)
{
- buffer = (std::string)(this->window_->getName().c_str());
+ buffer = this->window_->getName().c_str();
}
else
{
- buffer = "";
+ buffer.erase();
}
}
@@ -186,7 +186,7 @@
stream << this->details_->getName() << "/Status";
CEGUI::Window* statusWindow = this->gui_->getWindowManager()->createWindow("TaharezLook/StaticText", stream.str());
window->addChildWindow(statusWindow);
- std::string status = "";
+ std::string status;
if(quest->isActive(this->gui_->getPlayer()))
{
status = "This quest is active.";
Modified: code/branches/presentation2/src/modules/questsystem/QuestItem.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/QuestItem.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/QuestItem.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -46,8 +46,6 @@
QuestItem::QuestItem(BaseObject* creator) : BaseObject(creator)
{
RegisterObject(QuestItem);
-
- this->id_ = "";
}
/**
Modified: code/branches/presentation2/src/modules/questsystem/QuestListener.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/QuestListener.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/QuestListener.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -182,7 +182,7 @@
else
{
COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl;
- return "";
+ return "";
}
}
Modified: code/branches/presentation2/src/modules/questsystem/QuestNotification.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/QuestNotification.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/QuestNotification.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -31,7 +31,7 @@
namespace orxonox {
- const std::string QuestNotification::SENDER = "questsystem";
+ const std::string QuestNotification::SENDER("questsystem");
QuestNotification::QuestNotification(BaseObject* creator) : Notification(creator)
{
Modified: code/branches/presentation2/src/modules/questsystem/notifications/Notification.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/notifications/Notification.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/notifications/Notification.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -74,7 +74,7 @@
*/
void Notification::initialize(void)
{
- this->message_ = "";
+ this->message_.clear();
this->sender_ = NotificationManager::NONE;
this->sent_ = false;
}
Modified: code/branches/presentation2/src/modules/questsystem/notifications/NotificationManager.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/notifications/NotificationManager.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/notifications/NotificationManager.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -43,8 +43,8 @@
namespace orxonox
{
- const std::string NotificationManager::ALL = "all";
- const std::string NotificationManager::NONE = "none";
+ const std::string NotificationManager::ALL("all");
+ const std::string NotificationManager::NONE("none");
ManageScopedSingleton(NotificationManager, ScopeID::Root, false);
Modified: code/branches/presentation2/src/modules/questsystem/notifications/NotificationQueue.cc
===================================================================
--- code/branches/presentation2/src/modules/questsystem/notifications/NotificationQueue.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/modules/questsystem/notifications/NotificationQueue.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -45,9 +45,9 @@
CreateFactory(NotificationQueue);
- const std::string NotificationQueue::DEFAULT_FONT = "VeraMono";
- const Vector2 NotificationQueue::DEFAULT_POSITION = Vector2(0.0,0.0);
- const float NotificationQueue::DEFAULT_FONT_SIZE = 0.025f;
+ const std::string NotificationQueue::DEFAULT_FONT("VeraMono");
+ const Vector2 NotificationQueue::DEFAULT_POSITION(0.0,0.0);
+ const float NotificationQueue::DEFAULT_FONT_SIZE = 0.025f;
/**
@brief
@@ -270,7 +270,7 @@
{
if(!first)
{
- *string += ",";
+ *string += ',';
}
else
{
@@ -299,7 +299,7 @@
unsigned int index = 0;
while( index < targets.size() ) //!< Go through the string, character by character until the end is reached.
{
- pTemp = new std::string("");
+ pTemp = new std::string();
while(index < targets.size() && targets[index] != ',' && targets[index] != ' ')
{
*pTemp += targets[index];
@@ -398,7 +398,7 @@
timeString.erase(timeString.length()-1);
std::ostringstream stream;
stream << reinterpret_cast<unsigned long>(notification);
- std::string addressString = stream.str() ;
+ const std::string& addressString = stream.str();
container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
this->containers_.insert(container);
Modified: code/branches/presentation2/src/orxonox/Level.cc
===================================================================
--- code/branches/presentation2/src/orxonox/Level.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/Level.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -140,13 +140,13 @@
void Level::playerEntered(PlayerInfo* player)
{
- COUT(3) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ")" << std::endl;
+ COUT(3) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << std::endl;
player->setGametype(this->getGametype());
}
void Level::playerLeft(PlayerInfo* player)
{
- COUT(3) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ")" << std::endl;
+ COUT(3) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << std::endl;
player->setGametype(0);
}
}
Modified: code/branches/presentation2/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/presentation2/src/orxonox/LevelManager.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/LevelManager.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -121,10 +121,10 @@
return defaultLevelName_;
}
- std::string LevelManager::getAvailableLevelListItem(unsigned int index) const
+ const std::string& LevelManager::getAvailableLevelListItem(unsigned int index) const
{
if (index >= availableLevels_.size())
- return std::string();
+ return BLANKSTRING;
else
return availableLevels_[index];
}
Modified: code/branches/presentation2/src/orxonox/LevelManager.h
===================================================================
--- code/branches/presentation2/src/orxonox/LevelManager.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/LevelManager.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -59,7 +59,7 @@
void setDefaultLevel(const std::string& levelName); //tolua_export
const std::string& getDefaultLevel() const; //tolua_export
void compileAvailableLevelList(); //tolua_export
- std::string getAvailableLevelListItem(unsigned int index) const; //tolua_export
+ const std::string& getAvailableLevelListItem(unsigned int index) const; //tolua_export
static LevelManager* getInstancePtr() { return singletonPtr_s; }
static LevelManager& getInstance() { return Singleton<LevelManager>::getInstance(); } // tolua_export
Modified: code/branches/presentation2/src/orxonox/Radar.cc
===================================================================
--- code/branches/presentation2/src/orxonox/Radar.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/Radar.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -84,7 +84,7 @@
return 0;
}
- RadarViewable::Shape Radar::addObjectDescription(const std::string name)
+ RadarViewable::Shape Radar::addObjectDescription(const std::string& name)
{
std::map<std::string, RadarViewable::Shape>::iterator it = this->objectTypes_.find(name);
if (it == this->objectTypes_.end())
Modified: code/branches/presentation2/src/orxonox/Radar.h
===================================================================
--- code/branches/presentation2/src/orxonox/Radar.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/Radar.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -54,7 +54,7 @@
virtual void tick(float dt);
const RadarViewable* getFocus();
- RadarViewable::Shape addObjectDescription(const std::string name);
+ RadarViewable::Shape addObjectDescription(const std::string& name);
void listObjects() const;
Modified: code/branches/presentation2/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/presentation2/src/orxonox/gamestates/GSLevel.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/gamestates/GSLevel.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -153,7 +153,7 @@
std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(*it);
if (find == this->staticObjects_.end())
{
- COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << ")" << std::endl;
+ COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << ')' << std::endl;
}
}
COUT(3) << i << " objects remaining.";
Modified: code/branches/presentation2/src/orxonox/gametypes/Asteroids.cc
===================================================================
--- code/branches/presentation2/src/orxonox/gametypes/Asteroids.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/gametypes/Asteroids.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -71,7 +71,7 @@
{
Gametype::start();
- std::string message = "The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...";
+ std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...");
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
@@ -80,7 +80,7 @@
{
Gametype::end();
- std::string message = "The match has ended.";
+ std::string message("The match has ended.");
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
Modified: code/branches/presentation2/src/orxonox/gametypes/Deathmatch.cc
===================================================================
--- code/branches/presentation2/src/orxonox/gametypes/Deathmatch.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/gametypes/Deathmatch.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -46,7 +46,7 @@
{
Gametype::start();
- std::string message = "The match has started!";
+ std::string message("The match has started!");
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
@@ -55,7 +55,7 @@
{
Gametype::end();
- std::string message = "The match has ended.";
+ std::string message("The match has ended.");
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
@@ -64,7 +64,7 @@
{
Gametype::playerEntered(player);
- std::string message = player->getName() + " entered the game";
+ const std::string& message = player->getName() + " entered the game";
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
@@ -75,7 +75,7 @@
if (valid_player)
{
- std::string message = player->getName() + " left the game";
+ const std::string& message = player->getName() + " left the game";
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
@@ -89,7 +89,7 @@
if (valid_player)
{
- std::string message = player->getOldName() + " changed name to " + player->getName();
+ const std::string& message = player->getOldName() + " changed name to " + player->getName();
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
@@ -125,7 +125,7 @@
if (player)
{
- std::string message = player->getName() + " scores!";
+ const std::string& message = player->getName() + " scores!";
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
Modified: code/branches/presentation2/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/presentation2/src/orxonox/gametypes/Gametype.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/gametypes/Gametype.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -70,7 +70,7 @@
this->setConfigValues();
// load the corresponding score board
- if (GameMode::showsGraphics() && this->scoreboardTemplate_ != "")
+ if (GameMode::showsGraphics() && !this->scoreboardTemplate_.empty())
{
this->scoreboard_ = new OverlayGroup(this);
this->scoreboard_->addTemplate(this->scoreboardTemplate_);
Modified: code/branches/presentation2/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- code/branches/presentation2/src/orxonox/gametypes/UnderAttack.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/gametypes/UnderAttack.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -68,7 +68,7 @@
void UnderAttack::killedDestroyer()
{
this->end(); //end gametype
- std::string message = "Ship destroyed! Team 0 has won!";
+ std::string message("Ship destroyed! Team 0 has won!");
COUT(0) << message << std::endl;
Host::Broadcast(message);
this->gameEnded_ = true;
@@ -151,7 +151,7 @@
{
this->gameEnded_ = true;
this->end();
- std::string message = "Time is up! Team 1 has won!";
+ std::string message("Time is up! Team 1 has won!");
COUT(0) << message << std::endl;
Host::Broadcast(message);
@@ -170,7 +170,7 @@
//prints gametime
if ( gameTime_ <= timesequence_ && gameTime_ > 0)
{
- std::string message = multi_cast<std::string>(timesequence_) + " seconds left!";
+ const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
/*
COUT(0) << message << std::endl;
Host::Broadcast(message);
Modified: code/branches/presentation2/src/orxonox/graphics/Billboard.cc
===================================================================
--- code/branches/presentation2/src/orxonox/graphics/Billboard.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/graphics/Billboard.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -41,7 +41,6 @@
{
RegisterObject(Billboard);
- this->material_ = "";
this->colour_ = ColourValue::White;
// this->rotation_ = 0;
@@ -75,7 +74,7 @@
void Billboard::changedMaterial()
{
- if (this->material_ == "")
+ if (this->material_.empty())
return;
if (!this->billboard_.getBillboardSet())
@@ -98,7 +97,7 @@
if (!this->billboard_.getBillboardSet())
{
/*
- if (this->getScene() && GameMode::showsGraphics() && (this->material_ != ""))
+ if (this->getScene() && GameMode::showsGraphics() && !this->material_.empty())
{
this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
if (this->billboard_.getBillboardSet())
Modified: code/branches/presentation2/src/orxonox/infos/HumanPlayer.cc
===================================================================
--- code/branches/presentation2/src/orxonox/infos/HumanPlayer.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/infos/HumanPlayer.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -163,7 +163,7 @@
if (this->isInitialized() && this->isLocalPlayer())
{
- if (this->getGametype() && this->getGametype()->getHUDTemplate() != "")
+ if (this->getGametype() && !this->getGametype()->getHUDTemplate().empty())
this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate());
else
this->setGametypeHUDTemplate("");
@@ -178,7 +178,7 @@
this->humanHud_ = 0;
}
- if (this->isLocalPlayer() && this->humanHudTemplate_ != "" && GameMode::showsGraphics())
+ if (this->isLocalPlayer() && !this->humanHudTemplate_.empty() && GameMode::showsGraphics())
{
this->humanHud_ = new OverlayGroup(this);
this->humanHud_->addTemplate(this->humanHudTemplate_);
@@ -194,7 +194,7 @@
this->gametypeHud_ = 0;
}
- if (this->isLocalPlayer() && this->gametypeHudTemplate_ != "")
+ if (this->isLocalPlayer() && !this->gametypeHudTemplate_.empty())
{
this->gametypeHud_ = new OverlayGroup(this);
this->gametypeHud_->addTemplate(this->gametypeHudTemplate_);
Modified: code/branches/presentation2/src/orxonox/items/Engine.h
===================================================================
--- code/branches/presentation2/src/orxonox/items/Engine.h 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/items/Engine.h 2009-12-22 13:07:44 UTC (rev 6394)
@@ -105,8 +105,6 @@
virtual const Vector3& getDirection() const;
- void loadSound(const std::string filename);
-
private:
void networkcallback_shipID();
Modified: code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc
===================================================================
--- code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -34,7 +34,6 @@
}
#include "util/Convert.h"
-#include "util/StringUtils.h"
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
#include "core/LuaState.h"
@@ -200,7 +199,7 @@
{
if (effect == NULL)
return;
- effect->setLuaState(this->lua_, "f" + multi_cast<std::string>(this->effectContainers_.size()));
+ effect->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
this->effectContainers_.push_back(effect);
if (this->getShip())
{
Modified: code/branches/presentation2/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/branches/presentation2/src/orxonox/overlays/InGameConsole.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/overlays/InGameConsole.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -317,7 +317,7 @@
if (LINES > 0)
this->print(this->shell_->getInput(), Shell::Input, 0);
- if (this->shell_->getInput() == "" || this->shell_->getInput().size() == 0)
+ if (this->shell_->getInput().empty())
this->inputWindowStart_ = 0;
}
Modified: code/branches/presentation2/src/orxonox/overlays/Map.cc
===================================================================
--- code/branches/presentation2/src/orxonox/overlays/Map.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/overlays/Map.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -48,6 +48,7 @@
#include <OgreTextureManager.h>
#include <OgreViewport.h>
+#include "util/StringUtils.h"
#include "core/ConsoleCommand.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
Modified: code/branches/presentation2/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/branches/presentation2/src/orxonox/overlays/OrxonoxOverlay.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/overlays/OrxonoxOverlay.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -44,7 +44,6 @@
#include "util/Convert.h"
#include "util/Exception.h"
-#include "util/StringUtils.h"
#include "core/GameMode.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
@@ -145,7 +144,7 @@
OrxonoxOverlay::overlays_s.erase(this->getOldName());
if (OrxonoxOverlay::overlays_s.find(this->getName()) != OrxonoxOverlay::overlays_s.end())
- COUT(1) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << "\"" << std::endl;
+ COUT(1) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << '"' << std::endl;
OrxonoxOverlay::overlays_s[this->getName()] = this;
}
@@ -153,7 +152,7 @@
//! Only sets the background material name if not ""
void OrxonoxOverlay::setBackgroundMaterial(const std::string& material)
{
- if (this->background_ && material != "")
+ if (this->background_ && !material.empty())
this->background_->setMaterialName(material);
}
Modified: code/branches/presentation2/src/orxonox/pickup/DroppedItem.cc
===================================================================
--- code/branches/presentation2/src/orxonox/pickup/DroppedItem.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/pickup/DroppedItem.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -82,7 +82,7 @@
{
if (this->item_)
{
- COUT(3) << "Delete DroppedItem with '" << this->item_->getPickupIdentifier() << "'" << std::endl;
+ COUT(3) << "Delete DroppedItem with '" << this->item_->getPickupIdentifier() << '\'' << std::endl;
this->item_->destroy();
}
@@ -111,7 +111,7 @@
drop->setTimeToLive(timeToLive);
drop->createTimer();
- COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << "," << position.y << "," << position.z << ")." << std::endl;
+ COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << ',' << position.y << ',' << position.z << ")." << std::endl;
return drop;
}
Modified: code/branches/presentation2/src/orxonox/pickup/PickupInventory.cc
===================================================================
--- code/branches/presentation2/src/orxonox/pickup/PickupInventory.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/pickup/PickupInventory.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -195,14 +195,14 @@
if(!item)
return "";
- std::string name = "pickup_" + item->getGUIImage();
+ const std::string& name = "pickup_" + item->getGUIImage();
if(!CEGUI::ImagesetManager::getSingletonPtr()->isImagesetPresent(name))
{
CEGUI::ImagesetManager::getSingletonPtr()->createImagesetFromImageFile(name, item->getGUIImage(), "");
}
- return "set:" + name + " image:full_image";
+ return ("set:" + name + " image:full_image");
}
void PickupInventory::clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane)
@@ -331,9 +331,9 @@
txt->setVisible(true);
txt->setProperty("Text", item->getGUIText());
- txt->setProperty("TextColours", "tl:" + textColour + " tr:" + textColour + " bl:" + textColour + " br:" + textColour + "");
+ txt->setProperty("TextColours", "tl:" + textColour + " tr:" + textColour + " bl:" + textColour + " br:" + textColour);
- std::string image = PickupInventory::getImageForItem(item);
+ const std::string& image = PickupInventory::getImageForItem(item);
btn->setVisible(true);
btn->setProperty("NormalImage", image);
btn->setProperty("HoverImage", image);
Modified: code/branches/presentation2/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/AmbientSound.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/sound/AmbientSound.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -112,7 +112,7 @@
this->ambientSource_ = source;
if (GameMode::playsSound())
{
- std::string path = "ambient/" + MoodManager::getInstance().getMood() + "/" + source;
+ const std::string& path = "ambient/" + MoodManager::getInstance().getMood() + '/' + source;
shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
if (fileInfo != NULL)
this->setSource(path);
Modified: code/branches/presentation2/src/orxonox/sound/SoundBuffer.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/SoundBuffer.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/sound/SoundBuffer.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -56,7 +56,7 @@
// Open data stream
DataStreamPtr dataStream = Resource::open(fileInfo);
- std::string extension(this->filename_.substr(this->filename_.find_last_of('.') + 1));
+ const std::string& extension = this->filename_.substr(this->filename_.find_last_of('.') + 1);
if (getLowercase(extension) == "ogg")
{
// Try ogg loader
Modified: code/branches/presentation2/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/SoundManager.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/sound/SoundManager.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -91,7 +91,7 @@
while (true)
{
this->deviceNames_.push_back(devices);
- COUT(4) << "\"" << devices << "\", ";
+ COUT(4) << '"' << devices << "\", ";
devices += strlen(devices) + 1;
if (*devices == '\0')
break;
@@ -99,7 +99,7 @@
COUT(4) << std::endl;
// Open the selected device
- COUT(3) << "Sound: Opening device \"" << renderDevice << "\"" << std::endl;
+ COUT(3) << "Sound: Opening device \"" << renderDevice << '\' << std::endl;
this->device_ = alcOpenDevice(renderDevice.c_str());
*/
this->device_ = alcOpenDevice(NULL);
Modified: code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -29,7 +29,6 @@
#include "WeaponMode.h"
-#include "util/StringUtils.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "controllers/Controller.h"
Modified: code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -332,7 +332,7 @@
{
this->camera_ = new Camera(this);
this->camera_->requestFocus();
- if (this->cameraPositionTemplate_ != "")
+ if (!this->cameraPositionTemplate_.empty())
this->addTemplate(this->cameraPositionTemplate_);
if (this->cameraPositions_.size() > 0)
{
@@ -348,7 +348,7 @@
if (!this->hud_ && GameMode::showsGraphics())
{
- if (this->hudtemplate_ != "")
+ if (!this->hudtemplate_.empty())
{
this->hud_ = new OverlayGroup(this);
this->hud_->addTemplate(this->hudtemplate_);
Modified: code/branches/presentation2/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/WorldEntity.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/worldentities/WorldEntity.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -813,7 +813,7 @@
//! Sets the CollisionType by string (used for the XMLPort)
void WorldEntity::setCollisionTypeStr(const std::string& typeStr)
{
- std::string typeStrLower = getLowercase(typeStr);
+ const std::string& typeStrLower = getLowercase(typeStr);
CollisionType type;
if (typeStrLower == "dynamic")
type = Dynamic;
Modified: code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -198,7 +198,7 @@
void Pawn::spawneffect()
{
// play spawn effect
- if (this->spawnparticlesource_ != "")
+ if (!this->spawnparticlesource_.empty())
{
ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
effect->setPosition(this->getPosition());
Modified: code/branches/presentation2/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/pawns/SpaceShip.cc 2009-12-21 15:24:19 UTC (rev 6393)
+++ code/branches/presentation2/src/orxonox/worldentities/pawns/SpaceShip.cc 2009-12-22 13:07:44 UTC (rev 6394)
@@ -186,7 +186,7 @@
void SpaceShip::loadEngineTemplate()
{
- if (this->enginetemplate_ != "")
+ if (!this->enginetemplate_.empty())
{
Template* temp = Template::getTemplate(this->enginetemplate_);
More information about the Orxonox-commit
mailing list