Avoid direct use of std::(o|)stringstream (#13272)
Older C++ compilers do not provide a standard std::stringstream. Use our compatibility interfaces instead. Also avoid std::stringstream(openmode) signature. Our approximate stringstream implementation provided when the standard one is not available does not support the openmode argument.
This commit is contained in:
parent
eb53bc2773
commit
94de982902
|
@ -66,7 +66,7 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
|
|||
if (std::find_if(ident.begin(), ident.end(),
|
||||
std::not1(std::ptr_fun(IsIdentChar))) != ident.end()) {
|
||||
static unsigned VarNum = 0;
|
||||
std::ostringstream names;
|
||||
cmOStringStream names;
|
||||
names << "ident" << VarNum++;
|
||||
vars << names.str() << " = " << ident << "\n";
|
||||
return "$" + names.str();
|
||||
|
@ -123,7 +123,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
|
|||
|
||||
cmGlobalNinjaGenerator::WriteComment(os, comment);
|
||||
|
||||
std::ostringstream builds;
|
||||
cmOStringStream builds;
|
||||
|
||||
// TODO: Better formatting for when there are multiple input/output files.
|
||||
|
||||
|
@ -825,7 +825,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
|
|||
cmLocalGenerator *lg = this->LocalGenerators[0];
|
||||
cmMakefile* mfRoot = lg->GetMakefile();
|
||||
|
||||
std::ostringstream cmd;
|
||||
cmOStringStream cmd;
|
||||
cmd << lg->ConvertToOutputFormat(
|
||||
mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
|
||||
cmLocalGenerator::SHELL)
|
||||
|
|
|
@ -280,7 +280,7 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
|
|||
// $in variables. A discussion about dealing with multiple commands in
|
||||
// a rule is started here:
|
||||
// groups.google.com/group/ninja-build/browse_thread/thread/d515f23a78986008
|
||||
std::ostringstream cmd;
|
||||
cmOStringStream cmd;
|
||||
for (std::vector<std::string>::const_iterator li = cmdLines.begin();
|
||||
li != cmdLines.end(); ++li) {
|
||||
if (li != cmdLines.begin())
|
||||
|
@ -299,7 +299,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc,
|
|||
if (!wd)
|
||||
wd = this->GetMakefile()->GetStartOutputDirectory();
|
||||
|
||||
std::ostringstream cdCmd;
|
||||
cmOStringStream cdCmd;
|
||||
cdCmd << "cd " << this->ConvertToOutputFormat(wd, SHELL);
|
||||
cmdLines.push_back(cdCmd.str());
|
||||
}
|
||||
|
|
|
@ -215,10 +215,10 @@ cmNinjaNormalTargetGenerator
|
|||
this->GetLocalGenerator()->BuildCommandLine(linkCmds);
|
||||
|
||||
// Write the linker rule.
|
||||
std::ostringstream comment;
|
||||
cmOStringStream comment;
|
||||
comment << "Rule for linking " << this->TargetLinkLanguage << " "
|
||||
<< this->GetVisibleTypeName() << ".";
|
||||
std::ostringstream description;
|
||||
cmOStringStream description;
|
||||
description << "Linking " << this->TargetLinkLanguage << " "
|
||||
<< this->GetVisibleTypeName() << " $out";
|
||||
this->GetGlobalGenerator()->AddRule(ruleName,
|
||||
|
@ -353,7 +353,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
/*implib=*/true).c_str());
|
||||
|
||||
// Compute the comment.
|
||||
std::ostringstream comment;
|
||||
cmOStringStream comment;
|
||||
comment << "Link the " << this->GetVisibleTypeName() << " "
|
||||
<< targetOutputReal;
|
||||
|
||||
|
|
|
@ -365,9 +365,9 @@ cmNinjaTargetGenerator
|
|||
this->GetLocalGenerator()->BuildCommandLine(compileCmds);
|
||||
|
||||
// Write the rule for compiling file of the given language.
|
||||
std::ostringstream comment;
|
||||
cmOStringStream comment;
|
||||
comment << "Rule for compiling " << language << " files.";
|
||||
std::ostringstream description;
|
||||
cmOStringStream description;
|
||||
description << "Building " << language << " object $out";
|
||||
this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(language),
|
||||
cmdLine,
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "cmSystemTools.h"
|
||||
|
||||
#include <cmsys/Terminal.h>
|
||||
#include <cmsys/ios/sstream>
|
||||
|
||||
#include <string.h>
|
||||
#if defined(__APPLE__)
|
||||
|
@ -549,7 +550,7 @@ bool cmQtAutomoc::RunAutomoc()
|
|||
this->GenerateMoc(it->first, it->second);
|
||||
}
|
||||
|
||||
std::stringstream outStream(std::stringstream::out);
|
||||
cmsys_ios::stringstream outStream;
|
||||
outStream << "/* This file is autogenerated, do not edit*/\n";
|
||||
|
||||
bool automocCppChanged = false;
|
||||
|
@ -1077,7 +1078,7 @@ bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with)
|
|||
std::string cmQtAutomoc::ReadAll(const std::string& filename)
|
||||
{
|
||||
std::ifstream file(filename.c_str());
|
||||
std::stringstream stream;
|
||||
cmsys_ios::stringstream stream;
|
||||
stream << file.rdbuf();
|
||||
file.close();
|
||||
return stream.str();
|
||||
|
|
Loading…
Reference in New Issue