From d8f1736dccbb860a1b6b1382d17fa732bb1cc28a Mon Sep 17 00:00:00 2001 From: Vitaly Stakhovsky Date: Sun, 15 Dec 2019 10:08:17 -0500 Subject: cmVisualStudio10TargetGenerator: improve XML element generation When an element is emitted, the newline will be printed first, not last --- Source/cmVisualStudio10TargetGenerator.cxx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8fc40a79..ec15dd6 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -71,7 +71,7 @@ struct cmVisualStudio10TargetGenerator::Elem void SetHasElements() { if (!HasElements) { - this->S << ">\n"; + this->S << ">"; HasElements = true; } } @@ -103,15 +103,10 @@ struct cmVisualStudio10TargetGenerator::Elem if (HasElements) { this->WriteString("Tag << ">"; - if (this->Indent > 0) { - this->S << '\n'; - } else { - // special case: don't print EOL at EOF - } } else if (HasContent) { - this->S << "Tag << ">\n"; + this->S << "Tag << ">"; } else { - this->S << " />\n"; + this->S << " />"; } } @@ -282,6 +277,7 @@ void cmVisualStudio10TargetGenerator::Elem::WritePlatformConfigTag( std::ostream& cmVisualStudio10TargetGenerator::Elem::WriteString( const char* line) { + this->S << '\n'; this->S.fill(' '); this->S.width(this->Indent * 2); // write an empty string to get the fill level indent to print @@ -376,8 +372,7 @@ void cmVisualStudio10TargetGenerator::Generate() char magic[] = { char(0xEF), char(0xBB), char(0xBF) }; BuildFileStream.write(magic, 3); BuildFileStream << "GlobalGenerator->Encoding() << "\"?>" - << "\n"; + << this->GlobalGenerator->Encoding() << "\"?>"; { Elem e0(BuildFileStream, "Project"); e0.Attribute("DefaultTargets", "Build"); @@ -1611,8 +1606,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() fout.write(magic, 3); fout << "GlobalGenerator->Encoding() << "\"?>" - << "\n"; + << this->GlobalGenerator->Encoding() << "\"?>"; { Elem e0(fout, "Project"); e0.Attribute("ToolsVersion", this->GlobalGenerator->GetToolsVersion()); -- cgit v0.12