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
File:
1 edited

Legend:

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

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