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/PathConfig.cc

    r6105 r6394  
    226226        if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
    227227        {
    228             std::string directory(CommandLineParser::getValue("writingPathSuffix").getString());
     228            const std::string& directory(CommandLineParser::getValue("writingPathSuffix").getString());
    229229            configPath_ = configPath_ / directory;
    230230            logPath_    = logPath_    / directory;
     
    256256
    257257        // We search for helper files with the following extension
    258         std::string moduleextension = specialConfig::moduleExtension;
     258        const std::string& moduleextension = specialConfig::moduleExtension;
    259259        size_t moduleextensionlength = moduleextension.size();
    260260
    261261        // Add that path to the PATH variable in case a module depends on another one
    262         std::string pathVariable = getenv("PATH");
    263         putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + modulePath_.string()).c_str()));
     262        std::string pathVariable(getenv("PATH"));
     263        putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));
    264264
    265265        // Make sure the path exists, otherwise don't load modules
     
    273273        while (file != end)
    274274        {
    275             std::string filename = file->BOOST_LEAF_FUNCTION();
     275            const std::string& filename = file->BOOST_LEAF_FUNCTION();
    276276
    277277            // Check if the file ends with the exension in question
     
    281281                {
    282282                    // We've found a helper file
    283                     std::string library = filename.substr(0, filename.size() - moduleextensionlength);
     283                    const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
    284284                    modulePaths.push_back((modulePath_ / library).file_string());
    285285                }
Note: See TracChangeset for help on using the changeset viewer.