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/questsystem
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/modules/questsystem/QuestDescription.cc

    r6387 r6394  
    5050    {
    5151        RegisterObject(QuestDescription);
    52 
    53         this->title_ = "";
    54         this->description_ = "";
    5552    }
    5653
     
    9491    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const
    9592    {
    96         std::string message = "";
     93        std::string message;
    9794        if(item == "hint")
    9895        {
    99             message = "You received a hint: '" + this->title_ + "'";
     96            message = "You received a hint: '" + this->title_ + '\'';
    10097        }
    10198        else if(item == "quest")
     
    103100            if(status == "start")
    104101            {
    105                 message = "You received a new quest: '" + this->title_ + "'";
     102                message = "You received a new quest: '" + this->title_ + '\'';
    106103            }
    107104            else if(status == "fail")
    108105            {
    109                 message = "You failed the quest: '" + this->title_ + "'";
     106                message = "You failed the quest: '" + this->title_ + '\'';
    110107            }
    111108            else if(status == "complete")
    112109            {
    113                 message = "You successfully completed the quest: '" + this->title_ + "'";
     110                message = "You successfully completed the quest: '" + this->title_ + '\'';
    114111            }
    115112            else
  • code/branches/presentation2/src/modules/questsystem/QuestGUINode.cc

    r6388 r6394  
    134134        if(this->window_ != NULL)
    135135        {
    136             buffer = (std::string)(this->window_->getName().c_str());
     136            buffer = this->window_->getName().c_str();
    137137        }
    138138        else
    139139        {
    140             buffer = "";
     140            buffer.erase();
    141141        }
    142142    }
     
    187187                CEGUI::Window* statusWindow = this->gui_->getWindowManager()->createWindow("TaharezLook/StaticText", stream.str());
    188188                window->addChildWindow(statusWindow);
    189                 std::string status = "";
     189                std::string status;
    190190                if(quest->isActive(this->gui_->getPlayer()))
    191191                {
  • code/branches/presentation2/src/modules/questsystem/QuestItem.cc

    r6387 r6394  
    4747    {
    4848        RegisterObject(QuestItem);
    49 
    50         this->id_ = "";
    5149    }
    5250
  • code/branches/presentation2/src/modules/questsystem/QuestListener.cc

    r6388 r6394  
    183183        {
    184184            COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl;
    185         return "";
     185            return "";
    186186        }
    187187    }
  • code/branches/presentation2/src/modules/questsystem/QuestNotification.cc

    r6387 r6394  
    3232namespace orxonox {
    3333
    34     const std::string QuestNotification::SENDER = "questsystem";
     34    const std::string QuestNotification::SENDER("questsystem");
    3535
    3636    QuestNotification::QuestNotification(BaseObject* creator) : Notification(creator)
  • code/branches/presentation2/src/modules/questsystem/notifications/Notification.cc

    r6387 r6394  
    7575    void Notification::initialize(void)
    7676    {
    77         this->message_ = "";
     77        this->message_.clear();
    7878        this->sender_ = NotificationManager::NONE;
    7979        this->sent_ = false;
  • code/branches/presentation2/src/modules/questsystem/notifications/NotificationManager.cc

    r6182 r6394  
    4444{
    4545
    46     const std::string NotificationManager::ALL = "all";
    47     const std::string NotificationManager::NONE = "none";
     46    const std::string NotificationManager::ALL("all");
     47    const std::string NotificationManager::NONE("none");
    4848
    4949    ManageScopedSingleton(NotificationManager, ScopeID::Root, false);
  • code/branches/presentation2/src/modules/questsystem/notifications/NotificationQueue.cc

    r5929 r6394  
    4646    CreateFactory(NotificationQueue);
    4747
    48     const std::string NotificationQueue::DEFAULT_FONT = "VeraMono";
    49     const Vector2 NotificationQueue::DEFAULT_POSITION = Vector2(0.0,0.0);
    50     const float NotificationQueue::DEFAULT_FONT_SIZE  = 0.025f;
     48    const std::string NotificationQueue::DEFAULT_FONT("VeraMono");
     49    const Vector2 NotificationQueue::DEFAULT_POSITION(0.0,0.0);
     50    const float NotificationQueue::DEFAULT_FONT_SIZE = 0.025f;
    5151
    5252    /**
     
    271271            if(!first)
    272272            {
    273                 *string += ",";
     273                *string += ',';
    274274            }
    275275            else
     
    300300        while( index < targets.size() ) //!< Go through the string, character by character until the end is reached.
    301301        {
    302             pTemp = new std::string("");
     302            pTemp = new std::string();
    303303            while(index < targets.size() && targets[index] != ',' && targets[index] != ' ')
    304304            {
     
    399399        std::ostringstream stream;
    400400        stream << reinterpret_cast<unsigned long>(notification);
    401         std::string addressString = stream.str() ;
     401        const std::string& addressString = stream.str();
    402402        container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
    403403
Note: See TracChangeset for help on using the changeset viewer.