Prefer istringstream and ostringstream over stringstream.

Use istringsream for parsing, ostringstream for generation.
This commit is contained in:
Daniel Pfeifer 2016-06-14 22:37:36 +02:00
parent ab8b77dd33
commit 24ab29b882
17 changed files with 55 additions and 55 deletions

View File

@ -567,7 +567,7 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout) void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout)
{ {
std::stringstream comment; std::ostringstream comment;
comment << "Generated by CPack " << CMake_VERSION << " IFW generator " comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
<< "for QtIFW "; << "for QtIFW ";
if (IsVersionLess("2.0")) { if (IsVersionLess("2.0")) {

View File

@ -422,7 +422,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
} }
// Write dependencies // Write dependencies
if (!compDepSet.empty()) { if (!compDepSet.empty()) {
std::stringstream dependencies; std::ostringstream dependencies;
std::set<DependenceStruct>::iterator it = compDepSet.begin(); std::set<DependenceStruct>::iterator it = compDepSet.begin();
dependencies << it->NameWithCompare(); dependencies << it->NameWithCompare();
++it; ++it;

View File

@ -90,7 +90,7 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile,
return false; return false;
} }
std::stringstream command; std::ostringstream command;
command << QuotePath(executable); command << QuotePath(executable);
command << " -nologo"; command << " -nologo";
command << " -arch " << GetArchitecture(); command << " -arch " << GetArchitecture();
@ -115,7 +115,7 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles)
return false; return false;
} }
std::stringstream command; std::ostringstream command;
command << QuotePath(executable); command << QuotePath(executable);
command << " -nologo"; command << " -nologo";
command << " -out " << QuotePath(packageFileNames.at(0)); command << " -out " << QuotePath(packageFileNames.at(0));
@ -254,7 +254,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
std::set<std::string> usedBaseNames; std::set<std::string> usedBaseNames;
std::stringstream objectFiles; std::ostringstream objectFiles;
for (size_t i = 0; i < this->WixSources.size(); ++i) { for (size_t i = 0; i < this->WixSources.size(); ++i) {
std::string const& sourceFilename = this->WixSources[i]; std::string const& sourceFilename = this->WixSources[i];
@ -265,7 +265,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
std::string uniqueBaseName = baseName; std::string uniqueBaseName = baseName;
while (usedBaseNames.find(uniqueBaseName) != usedBaseNames.end()) { while (usedBaseNames.find(uniqueBaseName) != usedBaseNames.end()) {
std::stringstream tmp; std::ostringstream tmp;
tmp << baseName << ++counter; tmp << baseName << ++counter;
uniqueBaseName = tmp.str(); uniqueBaseName = tmp.str();
} }
@ -403,7 +403,7 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source,
std::string const& name, std::string const& name,
std::string const& value) std::string const& value)
{ {
std::stringstream tmp; std::ostringstream tmp;
tmp << name << "=\"" << value << '"'; tmp << name << "=\"" << value << '"';
source.AddProcessingInstruction( source.AddProcessingInstruction(
@ -1019,7 +1019,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path)
idPrefix = "H"; idPrefix = "H";
} }
std::stringstream result; std::ostringstream result;
result << idPrefix << "_" << identifier; result << idPrefix << "_" << identifier;
size_t ambiguityCount = ++IdAmbiguityCounter[identifier]; size_t ambiguityCount = ++IdAmbiguityCounter[identifier];

View File

@ -127,7 +127,7 @@ void cmWIXAccessControlList::EmitBooleanAttribute(std::string const& entry,
std::string const& name) std::string const& name)
{ {
if (!this->IsBooleanAttribute(name)) { if (!this->IsBooleanAttribute(name)) {
std::stringstream message; std::ostringstream message;
message << "Unknown boolean attribute '" << name << "'"; message << "Unknown boolean attribute '" << name << "'";
this->ReportError(entry, message.str()); this->ReportError(entry, message.str());
} }

View File

@ -69,7 +69,7 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
if (i == installRoot.size() - 1) { if (i == installRoot.size() - 1) {
AddAttribute("Id", "INSTALL_ROOT"); AddAttribute("Id", "INSTALL_ROOT");
} else { } else {
std::stringstream tmp; std::ostringstream tmp;
tmp << "INSTALL_PREFIX_" << i; tmp << "INSTALL_PREFIX_" << i;
AddAttribute("Id", tmp.str()); AddAttribute("Id", tmp.str());
} }

View File

@ -31,7 +31,7 @@ void cmWIXFilesSourceWriter::EmitShortcut(std::string const& id,
std::string const& shortcutPrefix, std::string const& shortcutPrefix,
size_t shortcutIndex) size_t shortcutIndex)
{ {
std::stringstream shortcutId; std::ostringstream shortcutId;
shortcutId << shortcutPrefix << id; shortcutId << shortcutPrefix << id;
if (shortcutIndex > 0) { if (shortcutIndex > 0) {

View File

@ -88,7 +88,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
if (key == "Id") { if (key == "Id") {
if (Fragments.find(value) != Fragments.end()) { if (Fragments.find(value) != Fragments.end()) {
std::stringstream tmp; std::ostringstream tmp;
tmp << "Invalid reuse of 'CPackWixFragment' 'Id': " << value; tmp << "Invalid reuse of 'CPackWixFragment' 'Id': " << value;
ReportValidationError(tmp.str()); ReportValidationError(tmp.str());
} }

View File

@ -1677,7 +1677,7 @@ void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml,
xml.Attribute(measurementfile.match(3).c_str(), xml.Attribute(measurementfile.match(3).c_str(),
measurementfile.match(4)); measurementfile.match(4));
xml.Attribute("encoding", "base64"); xml.Attribute("encoding", "base64");
std::stringstream ostr; std::ostringstream ostr;
for (size_t cc = 0; cc < rlen; cc++) { for (size_t cc = 0; cc < rlen; cc++) {
ostr << encoded_buffer[cc]; ostr << encoded_buffer[cc];
if (cc % 60 == 0 && cc) { if (cc % 60 == 0 && cc) {

View File

@ -45,7 +45,7 @@ void cmCLocaleEnvironmentScope::SetEnv(std::string const& key,
if (value.empty()) { if (value.empty()) {
cmSystemTools::UnsetEnv(key.c_str()); cmSystemTools::UnsetEnv(key.c_str());
} else { } else {
std::stringstream tmp; std::ostringstream tmp;
tmp << key << "=" << value; tmp << key << "=" << value;
cmSystemTools::PutEnv(tmp.str()); cmSystemTools::PutEnv(tmp.str());
} }
@ -55,7 +55,7 @@ cmCLocaleEnvironmentScope::~cmCLocaleEnvironmentScope()
{ {
for (backup_map_t::const_iterator i = this->EnvironmentBackup.begin(); for (backup_map_t::const_iterator i = this->EnvironmentBackup.begin();
i != this->EnvironmentBackup.end(); ++i) { i != this->EnvironmentBackup.end(); ++i) {
std::stringstream tmp; std::ostringstream tmp;
tmp << i->first << "=" << i->second; tmp << i->first << "=" << i->second;
cmSystemTools::PutEnv(tmp.str()); cmSystemTools::PutEnv(tmp.str());
} }

View File

@ -84,7 +84,7 @@ bool cmCMakeHostSystemInformationCommand::GetValue(
std::string cmCMakeHostSystemInformationCommand::ValueToString( std::string cmCMakeHostSystemInformationCommand::ValueToString(
size_t value) const size_t value) const
{ {
std::stringstream tmp; std::ostringstream tmp;
tmp << value; tmp << value;
return tmp.str(); return tmp.str();
} }

View File

@ -311,7 +311,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
"false"); "false");
// set project specific environment // set project specific environment
std::stringstream environment; std::ostringstream environment;
environment << "VERBOSE=1|CMAKE_NO_VERBOSE=1|"; // verbose Makefile output environment << "VERBOSE=1|CMAKE_NO_VERBOSE=1|"; // verbose Makefile output
// set vsvars32.bat environment available at CMake time, // set vsvars32.bat environment available at CMake time,
// but not necessarily when eclipse is open // but not necessarily when eclipse is open
@ -341,7 +341,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
AppendDictionary(xml, "org.eclipse.cdt.make.core.autoBuildTarget", "all"); AppendDictionary(xml, "org.eclipse.cdt.make.core.autoBuildTarget", "all");
// set error parsers // set error parsers
std::stringstream errorOutputParser; std::ostringstream errorOutputParser;
if (compilerId == "MSVC") { if (compilerId == "MSVC") {
errorOutputParser << "org.eclipse.cdt.core.VCErrorParser;"; errorOutputParser << "org.eclipse.cdt.core.VCErrorParser;";

View File

@ -1527,7 +1527,7 @@ public:
if (item.find("::") != std::string::npos) { if (item.find("::") != std::string::npos) {
bool noMessage = false; bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR; cmake::MessageType messageType = cmake::FATAL_ERROR;
std::stringstream e; std::ostringstream e;
switch (this->Target->GetLocalGenerator()->GetPolicyStatus( switch (this->Target->GetLocalGenerator()->GetPolicyStatus(
cmPolicies::CMP0028)) { cmPolicies::CMP0028)) {
case cmPolicies::WARN: { case cmPolicies::WARN: {
@ -1628,7 +1628,7 @@ public:
if (this->Preferred.empty()) { if (this->Preferred.empty()) {
return ""; return "";
} else if (this->Preferred.size() > 1) { } else if (this->Preferred.size() > 1) {
std::stringstream e; std::ostringstream e;
e << "Target " << this->Target->GetName() e << "Target " << this->Target->GetName()
<< " contains multiple languages with the highest linker preference" << " contains multiple languages with the highest linker preference"
<< " (" << this->Preference << "):\n"; << " (" << this->Preference << "):\n";

View File

@ -623,7 +623,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
std::string darwin_major_version_s = std::string darwin_major_version_s =
mf->GetSafeDefinition("DARWIN_MAJOR_VERSION"); mf->GetSafeDefinition("DARWIN_MAJOR_VERSION");
std::stringstream ss(darwin_major_version_s); std::istringstream ss(darwin_major_version_s);
int darwin_major_version; int darwin_major_version;
ss >> darwin_major_version; ss >> darwin_major_version;
if (!ss.fail() && darwin_major_version <= 9 && if (!ss.fail() && darwin_major_version <= 9 &&

View File

@ -464,7 +464,7 @@ static std::string cmQtAutoGeneratorsStripCR(std::string const& line)
static std::string ReadAll(const std::string& filename) static std::string ReadAll(const std::string& filename)
{ {
cmsys::ifstream file(filename.c_str()); cmsys::ifstream file(filename.c_str());
std::stringstream stream; std::ostringstream stream;
stream << file.rdbuf(); stream << file.rdbuf();
file.close(); file.close();
return stream.str(); return stream.str();
@ -508,7 +508,7 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
bool result = cmSystemTools::RunSingleCommand( bool result = cmSystemTools::RunSingleCommand(
command, &rccStdOut, &rccStdErr, &retVal, 0, cmSystemTools::OUTPUT_NONE); command, &rccStdOut, &rccStdErr, &retVal, 0, cmSystemTools::OUTPUT_NONE);
if (!result || retVal) { if (!result || retVal) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath() err << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath()
<< " failed:\n" << " failed:\n"
<< rccStdOut << "\n" << rccStdOut << "\n"
@ -538,7 +538,7 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
std::string::size_type pos = eline.find(searchString); std::string::size_type pos = eline.find(searchString);
if (pos == std::string::npos) { if (pos == std::string::npos) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: Rcc lists unparsable output " << eline err << "AUTOGEN: error: Rcc lists unparsable output " << eline
<< std::endl; << std::endl;
std::cerr << err.str(); std::cerr << err.str();

View File

@ -432,7 +432,7 @@ void cmQtAutoGenerators::Init()
static std::string ReadAll(const std::string& filename) static std::string ReadAll(const std::string& filename)
{ {
cmsys::ifstream file(filename.c_str()); cmsys::ifstream file(filename.c_str());
std::stringstream stream; std::ostringstream stream;
stream << file.rdbuf(); stream << file.rdbuf();
file.close(); file.close();
return stream.str(); return stream.str();
@ -477,7 +477,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
skipUic ? skippedUis : includedUis; skipUic ? skippedUis : includedUis;
const std::string& absFilename = *it; const std::string& absFilename = *it;
if (this->Verbose) { if (this->Verbose) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: Checking " << absFilename << std::endl; err << "AUTOGEN: Checking " << absFilename << std::endl;
this->LogInfo(err.str()); this->LogInfo(err.str());
} }
@ -499,7 +499,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
uicSkipped.end()) { uicSkipped.end()) {
const std::string& absFilename = *it; const std::string& absFilename = *it;
if (this->Verbose) { if (this->Verbose) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: Checking " << absFilename << std::endl; err << "AUTOGEN: Checking " << absFilename << std::endl;
this->LogInfo(err.str()); this->LogInfo(err.str());
} }
@ -527,19 +527,19 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
} }
if (this->RunMocFailed) { if (this->RunMocFailed) {
std::stringstream err; std::ostringstream err;
err << "moc failed..." << std::endl; err << "moc failed..." << std::endl;
this->LogError(err.str()); this->LogError(err.str());
return false; return false;
} }
if (this->RunUicFailed) { if (this->RunUicFailed) {
std::stringstream err; std::ostringstream err;
err << "uic failed..." << std::endl; err << "uic failed..." << std::endl;
this->LogError(err.str()); this->LogError(err.str());
return false; return false;
} }
if (this->RunRccFailed) { if (this->RunRccFailed) {
std::stringstream err; std::ostringstream err;
err << "rcc failed..." << std::endl; err << "rcc failed..." << std::endl;
this->LogError(err.str()); this->LogError(err.str());
return false; return false;
@ -560,7 +560,7 @@ void cmQtAutoGenerators::ParseCppFile(
const std::string contentsString = ReadAll(absFilename); const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty()) { if (contentsString.empty()) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
<< std::endl; << std::endl;
this->LogError(err.str()); this->LogError(err.str());
@ -620,7 +620,7 @@ void cmQtAutoGenerators::ParseCppFile(
ownMocHeaderFile = headerToMoc; ownMocHeaderFile = headerToMoc;
} }
} else { } else {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file " err << "AUTOGEN: error: " << absFilename << ": The file "
<< "includes the moc file \"" << currentMoc << "\", " << "includes the moc file \"" << currentMoc << "\", "
<< "but could not find header \"" << basename << '{' << "but could not find header \"" << basename << '{'
@ -644,7 +644,7 @@ void cmQtAutoGenerators::ParseCppFile(
// this is for KDE4 compatibility: // this is for KDE4 compatibility:
fileToMoc = headerToMoc; fileToMoc = headerToMoc;
if (!requiresMoc && basename == scannedFileBasename) { if (!requiresMoc && basename == scannedFileBasename) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename err << "AUTOGEN: warning: " << absFilename
<< ": The file " << ": The file "
"includes the moc file \"" "includes the moc file \""
@ -656,7 +656,7 @@ void cmQtAutoGenerators::ParseCppFile(
<< std::endl; << std::endl;
this->LogError(err.str()); this->LogError(err.str());
} else { } else {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename err << "AUTOGEN: warning: " << absFilename
<< ": The file " << ": The file "
"includes the moc file \"" "includes the moc file \""
@ -670,7 +670,7 @@ void cmQtAutoGenerators::ParseCppFile(
this->LogError(err.str()); this->LogError(err.str());
} }
} else { } else {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: " << absFilename err << "AUTOGEN: error: " << absFilename
<< ": The file " << ": The file "
"includes the moc file \"" "includes the moc file \""
@ -699,7 +699,7 @@ void cmQtAutoGenerators::ParseCppFile(
if (!dotMocIncluded && requiresMoc) { if (!dotMocIncluded && requiresMoc) {
if (mocUnderscoreIncluded) { if (mocUnderscoreIncluded) {
// this is for KDE4 compatibility: // this is for KDE4 compatibility:
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": The file " err << "AUTOGEN: warning: " << absFilename << ": The file "
<< "contains a " << macroName << " macro, but does not " << "contains a " << macroName << " macro, but does not "
"include " "include "
@ -717,7 +717,7 @@ void cmQtAutoGenerators::ParseCppFile(
includedMocs.erase(ownMocHeaderFile); includedMocs.erase(ownMocHeaderFile);
} else { } else {
// otherwise always error out since it will not compile: // otherwise always error out since it will not compile:
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file " err << "AUTOGEN: error: " << absFilename << ": The file "
<< "contains a " << macroName << " macro, but does not " << "contains a " << macroName << " macro, but does not "
"include " "include "
@ -742,7 +742,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
const std::string contentsString = ReadAll(absFilename); const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty()) { if (contentsString.empty()) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
<< std::endl; << std::endl;
this->LogError(err.str()); this->LogError(err.str());
@ -791,7 +791,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
if (!headerToMoc.empty()) { if (!headerToMoc.empty()) {
includedMocs[headerToMoc] = currentMoc; includedMocs[headerToMoc] = currentMoc;
} else { } else {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << " The file " err << "AUTOGEN: error: " << absFilename << " The file "
<< "includes the moc file \"" << currentMoc << "\", " << "includes the moc file \"" << currentMoc << "\", "
<< "but could not find header \"" << basename << '{' << "but could not find header \"" << basename << '{'
@ -807,7 +807,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
} }
} else { } else {
if (basename != scannedFileBasename) { if (basename != scannedFileBasename) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: " << absFilename err << "AUTOGEN: error: " << absFilename
<< ": The file " << ": The file "
"includes the moc file \"" "includes the moc file \""
@ -835,7 +835,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
std::string macroName; std::string macroName;
if (!dotMocIncluded && requiresMocing(contentsString, macroName)) { if (!dotMocIncluded && requiresMocing(contentsString, macroName)) {
// otherwise always error out since it will not compile: // otherwise always error out since it will not compile:
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file " err << "AUTOGEN: error: " << absFilename << ": The file "
<< "contains a " << macroName << " macro, but does not include " << "contains a " << macroName << " macro, but does not include "
<< "\"" << scannedFileBasename << ".moc\" !\n" << "\"" << scannedFileBasename << ".moc\" !\n"
@ -854,7 +854,7 @@ void cmQtAutoGenerators::ParseForUic(
} }
const std::string contentsString = ReadAll(absFilename); const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty()) { if (contentsString.empty()) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" err << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
<< std::endl; << std::endl;
this->LogError(err.str()); this->LogError(err.str());
@ -942,7 +942,7 @@ void cmQtAutoGenerators::ParseHeaders(
if (!this->MocExecutable.empty() && if (!this->MocExecutable.empty() &&
includedMocs.find(headerName) == includedMocs.end()) { includedMocs.find(headerName) == includedMocs.end()) {
if (this->Verbose) { if (this->Verbose) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: Checking " << headerName << std::endl; err << "AUTOGEN: Checking " << headerName << std::endl;
this->LogInfo(err.str()); this->LogInfo(err.str());
} }
@ -972,7 +972,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
std::map<std::string, std::string> mergedMocs(includedMocs); std::map<std::string, std::string> mergedMocs(includedMocs);
mergedMocs.insert(notIncludedMocs.begin(), notIncludedMocs.end()); mergedMocs.insert(notIncludedMocs.begin(), notIncludedMocs.end());
if (this->NameCollisionTest(mergedMocs, collisions)) { if (this->NameCollisionTest(mergedMocs, collisions)) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: " err << "AUTOGEN: error: "
"The same moc file will be generated " "The same moc file will be generated "
"from different sources." "from different sources."
@ -1013,7 +1013,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
// compose _automoc.cpp content // compose _automoc.cpp content
std::string automocSource; std::string automocSource;
{ {
std::stringstream outStream; std::ostringstream outStream;
outStream << "/* This file is autogenerated, do not edit*/\n"; outStream << "/* This file is autogenerated, do not edit*/\n";
if (notIncludedMocs.empty()) { if (notIncludedMocs.empty()) {
outStream << "enum some_compilers { need_more_than_nothing };\n"; outStream << "enum some_compilers { need_more_than_nothing };\n";
@ -1035,7 +1035,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
if (oldContents == automocSource) { if (oldContents == automocSource) {
// nothing changed: don't touch the _automoc.cpp file // nothing changed: don't touch the _automoc.cpp file
if (this->Verbose) { if (this->Verbose) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: " << this->OutMocCppFilenameRel << " still up to date" err << "AUTOGEN: " << this->OutMocCppFilenameRel << " still up to date"
<< std::endl; << std::endl;
this->LogInfo(err.str()); this->LogInfo(err.str());
@ -1106,7 +1106,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
bool result = bool result =
cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
if (!result || retVal) { if (!result || retVal) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: process for " << mocFilePath << " failed:\n" err << "AUTOGEN: error: process for " << mocFilePath << " failed:\n"
<< output << std::endl; << output << std::endl;
this->LogError(err.str()); this->LogError(err.str());
@ -1147,7 +1147,7 @@ bool cmQtAutoGenerators::GenerateUiFiles(
{ {
std::multimap<std::string, std::string> collisions; std::multimap<std::string, std::string> collisions;
if (this->NameCollisionTest(testMap, collisions)) { if (this->NameCollisionTest(testMap, collisions)) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: The same ui_NAME.h file will be generated " err << "AUTOGEN: error: The same ui_NAME.h file will be generated "
"from different sources." "from different sources."
<< std::endl << std::endl
@ -1223,7 +1223,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
bool result = bool result =
cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
if (!result || retVal) { if (!result || retVal) {
std::stringstream err; std::ostringstream err;
err << "AUTOUIC: error: process for " << uiOutputFile err << "AUTOUIC: error: process for " << uiOutputFile
<< " needed by\n \"" << realName << "\"\nfailed:\n" << " needed by\n \"" << realName << "\"\nfailed:\n"
<< output << std::endl; << output << std::endl;
@ -1275,7 +1275,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
{ {
std::multimap<std::string, std::string> collisions; std::multimap<std::string, std::string> collisions;
if (this->NameCollisionTest(qrcGenMap, collisions)) { if (this->NameCollisionTest(qrcGenMap, collisions)) {
std::stringstream err; std::ostringstream err;
err << "AUTOGEN: error: The same qrc_NAME.cpp file" err << "AUTOGEN: error: The same qrc_NAME.cpp file"
" will be generated from different sources." " will be generated from different sources."
<< std::endl << std::endl
@ -1344,7 +1344,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
bool result = bool result =
cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); cmSystemTools::RunSingleCommand(command, &output, &output, &retVal);
if (!result || retVal) { if (!result || retVal) {
std::stringstream err; std::ostringstream err;
err << "AUTORCC: error: process for " << qrcOutputFile << " failed:\n" err << "AUTORCC: error: process for " << qrcOutputFile << " failed:\n"
<< output << std::endl; << output << std::endl;
this->LogError(err.str()); this->LogError(err.str());
@ -1435,7 +1435,7 @@ void cmQtAutoGenerators::NameCollisionLog(
{ {
typedef std::multimap<std::string, std::string>::const_iterator Iter; typedef std::multimap<std::string, std::string>::const_iterator Iter;
std::stringstream err; std::ostringstream err;
// Add message // Add message
err << message; err << message;
// Append collision list // Append collision list
@ -1457,7 +1457,7 @@ void cmQtAutoGenerators::LogError(const std::string& message)
void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command) void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command)
{ {
std::stringstream sbuf; std::ostringstream sbuf;
for (std::vector<std::string>::const_iterator cmdIt = command.begin(); for (std::vector<std::string>::const_iterator cmdIt = command.begin();
cmdIt != command.end(); ++cmdIt) { cmdIt != command.end(); ++cmdIt) {
if (cmdIt != command.begin()) { if (cmdIt != command.begin()) {

View File

@ -152,7 +152,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag,
return std::string(); return std::string();
} }
std::stringstream ss; std::ostringstream ss;
ss << static_cast<long int>(difftime(timeT, unixEpoch)); ss << static_cast<long int>(difftime(timeT, unixEpoch));
return ss.str(); return ss.str();
} }

View File

@ -213,7 +213,7 @@ static int process(const std::string& srcfilename, const std::string& dfile,
dir.c_str(), cmSystemTools::OUTPUT_NONE); dir.c_str(), cmSystemTools::OUTPUT_NONE);
// process the include directives and output everything else // process the include directives and output everything else
std::stringstream ss(output); std::istringstream ss(output);
std::string line; std::string line;
std::vector<std::string> includes; std::vector<std::string> includes;
bool isFirstLine = true; // cl prints always first the source filename bool isFirstLine = true; // cl prints always first the source filename