Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 22, 2009, 2:07:44 PM (14 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/util/Exception.cc

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