Merge pull request #2119 from akortunov/stringstream

Get rid of unnecessary string streams
This commit is contained in:
Bret Curtis 2019-01-10 11:42:27 +01:00 committed by GitHub
commit 4617dea154
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 111 additions and 176 deletions

View file

@ -3,7 +3,6 @@
#include <stdexcept>
#include <algorithm>
#include <sstream>
#include "intsetting.hpp"
#include "doublesetting.hpp"
@ -393,9 +392,7 @@ CSMPrefs::IntSetting& CSMPrefs::State::declareInt (const std::string& key,
if (mCurrentCategory==mCategories.end())
throw std::logic_error ("no category for setting");
std::ostringstream stream;
stream << default_;
setDefault (key, stream.str());
setDefault(key, std::to_string(default_));
default_ = mSettings.getInt (key, mCurrentCategory->second.getKey());
@ -414,9 +411,7 @@ CSMPrefs::DoubleSetting& CSMPrefs::State::declareDouble (const std::string& key,
if (mCurrentCategory==mCategories.end())
throw std::logic_error ("no category for setting");
std::ostringstream stream;
stream << default_;
setDefault (key, stream.str());
setDefault(key, std::to_string(default_));
default_ = mSettings.getFloat (key, mCurrentCategory->second.getKey());

View file

@ -77,14 +77,9 @@ void CSMTools::Search::searchRecordStateCell (const CSMWorld::IdTableBase *model
{
std::vector<std::string> states =
CSMWorld::Columns::getEnums (CSMWorld::Columns::ColumnId_Modification);
std::ostringstream message;
message << states.at (data);
std::ostringstream hint;
hint << "r: " << model->getColumnId (index.column());
messages.add (id, message.str(), hint.str());
const std::string hint = "r: " + model->getColumnId (index.column());
messages.add (id, states.at(data), hint);
}
}

View file

@ -77,7 +77,7 @@ int CSMWorld::Resources::getIndex (const std::string& id) const
std::ostringstream stream;
stream << "Invalid resource: " << mBaseDirectory << '/' << id;
throw std::runtime_error (stream.str().c_str());
throw std::runtime_error (stream.str());
}
return index;

View file

@ -150,10 +150,8 @@ std::string CSVWorld::SceneSubView::getTitle() const
void CSVWorld::SceneSubView::cellSelectionChanged (const CSMWorld::UniversalId& id)
{
setUniversalId(id);
std::ostringstream stream;
stream << "Scene: " << getUniversalId().getId();
mTitle = stream.str();
mTitle = "Scene: " + getUniversalId().getId();
setWindowTitle (QString::fromUtf8 (mTitle.c_str()));
emit updateTitle();
}