Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

std::string tweaks:

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

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/modules/overlays/hud/HUDBar.cc

    r6223 r6394  
    7272
    7373        // create new material
    74         std::string materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
     74        const std::string& materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
    7575        Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General"));
    7676        material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
  • code/branches/presentation2/src/modules/overlays/hud/HUDHealthBar.h

    r6054 r6394  
    5353
    5454            inline void setTextFont(const std::string& font)
    55                 { if (font != "") { this->textoverlay_->setFont(font); } }
     55                { if (!font.empty()) { this->textoverlay_->setFont(font); } }
    5656            inline const std::string& getTextFont() const
    5757                { return this->textoverlay_->getFont(); }
  • code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc

    r6378 r6394  
    3636
    3737#include "util/Math.h"
    38 #include "util/StringUtils.h"
    3938#include "util/Convert.h"
    4039#include "core/CoreIncludes.h"
     
    108107    void HUDNavigation::setFont(const std::string& font)
    109108    {
    110         if (this->navText_ && font != "")
     109        if (this->navText_ && !font.empty())
    111110            this->navText_->setFontName(font);
    112111    }
  • code/branches/presentation2/src/modules/overlays/hud/HUDRadar.cc

    r5781 r6394  
    126126            panel = *itRadarDots_;
    127127            ++itRadarDots_;
    128             std::string materialName = TextureGenerator::getMaterialName(
     128            const std::string& materialName = TextureGenerator::getMaterialName(
    129129                shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour());
    130130            if (materialName != panel->getMaterialName())
  • code/branches/presentation2/src/modules/overlays/hud/TeamBaseMatchScore.cc

    r5929 r6394  
    7171        if (this->owner_)
    7272        {
    73             std::string bases1 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ")";
    74             std::string bases2 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ")";
     73            const std::string& bases1 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ')';
     74            const std::string& bases2 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ')';
    7575
    76             std::string score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));
    77             std::string score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));
     76            const std::string& score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));
     77            const std::string& score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));
    7878
    7979            std::string output1;
     
    9999            }
    100100
    101             std::string output = "";
     101            std::string output;
    102102            if (this->bShowBases_ || this->bShowScore_)
    103103            {
    104104                if (this->bShowLeftTeam_ && this->bShowRightTeam_)
    105                     output = output1 + ":" + output2;
     105                    output = output1 + ':' + output2;
    106106                else if (this->bShowLeftTeam_ || this->bShowRightTeam_)
    107107                    output = output1 + output2;
Note: See TracChangeset for help on using the changeset viewer.