diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2022-08-23 02:42:34 (GMT) |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2022-11-17 12:23:35 (GMT) |
commit | f074e2bd49d449233205adfaa10ad94947d5f66b (patch) | |
tree | 619e0773c89efa9c4cc42fa551fc77dad84d9389 | |
parent | 8ab0168cbca815454c70da37e41d3eec9d52c461 (diff) | |
download | CMake-f074e2bd49d449233205adfaa10ad94947d5f66b.zip CMake-f074e2bd49d449233205adfaa10ad94947d5f66b.tar.gz CMake-f074e2bd49d449233205adfaa10ad94947d5f66b.tar.bz2 |
cmDocumentation: Optimize `std::ostream::operator<<()` calls
-rw-r--r-- | Source/cmDocumentation.cxx | 16 | ||||
-rw-r--r-- | Source/cmDocumentationFormatter.cxx | 22 |
2 files changed, 19 insertions, 19 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 1e37f52..77bc7c6 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -469,7 +469,7 @@ void cmDocumentation::PrintNames(std::ostream& os, std::string const& pattern) } std::sort(names.begin(), names.end()); for (std::string const& n : names) { - os << n << "\n"; + os << n << '\n'; } } @@ -505,7 +505,7 @@ bool cmDocumentation::PrintHelpOneManual(std::ostream& os) // Argument was not a manual. Complain. os << "Argument \"" << this->CurrentArgument << "\" to --help-manual is not an available manual. " - << "Use --help-manual-list to see all available manuals.\n"; + "Use --help-manual-list to see all available manuals.\n"; return false; } @@ -524,7 +524,7 @@ bool cmDocumentation::PrintHelpOneCommand(std::ostream& os) // Argument was not a command. Complain. os << "Argument \"" << this->CurrentArgument << "\" to --help-command is not a CMake command. " - << "Use --help-command-list to see all commands.\n"; + "Use --help-command-list to see all commands.\n"; return false; } @@ -557,7 +557,7 @@ bool cmDocumentation::PrintHelpListModules(std::ostream& os) } std::sort(modules.begin(), modules.end()); for (std::string const& m : modules) { - os << m << "\n"; + os << m << '\n'; } return true; } @@ -571,7 +571,7 @@ bool cmDocumentation::PrintHelpOneProperty(std::ostream& os) // Argument was not a property. Complain. os << "Argument \"" << this->CurrentArgument << "\" to --help-property is not a CMake property. " - << "Use --help-property-list to see all properties.\n"; + "Use --help-property-list to see all properties.\n"; return false; } @@ -620,7 +620,7 @@ bool cmDocumentation::PrintHelpOneVariable(std::ostream& os) // Argument was not a variable. Complain. os << "Argument \"" << this->CurrentArgument << "\" to --help-variable is not a defined variable. " - << "Use --help-variable-list to see all defined variables.\n"; + "Use --help-variable-list to see all defined variables.\n"; return false; } @@ -689,7 +689,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os) } else if ((ext.length() == 2) && (ext[1] >= '1') && (ext[1] <= '9')) { /* clang-format off */ os << - ".TH " << name << " " << ext[1] << " \"" << + ".TH " << name << ' ' << ext[1] << " \"" << cmSystemTools::GetCurrentDateTime("%B %d, %Y") << "\" \"cmake " << cmVersion::GetCMakeVersion() << "\"\n" ".SH NAME\n" @@ -702,7 +702,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os) ; /* clang-format on */ } else { - os << name << "\n\n" << summary << "\n" << detail; + os << name << "\n\n" << summary << '\n' << detail; } return true; } diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 732637e..fdc6304 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -67,7 +67,7 @@ void cmDocumentationFormatter::PrintPreformatted(std::ostream& os, newline = true; } } - os << "\n"; + os << '\n'; } void cmDocumentationFormatter::PrintParagraph(std::ostream& os, @@ -75,7 +75,7 @@ void cmDocumentationFormatter::PrintParagraph(std::ostream& os, { os << this->TextIndent; this->PrintColumn(os, text); - os << "\n"; + os << '\n'; } void cmDocumentationFormatter::SetIndent(const char* indent) @@ -111,7 +111,7 @@ void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text) os << " "; column += 2; } else { - os << " "; + os << ' '; column += 1; } } else { @@ -127,7 +127,7 @@ void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text) if (*r == '\n') { // Text provided a newline. Start a new line. - os << "\n"; + os << '\n'; ++r; column = 0; firstLine = false; @@ -137,7 +137,7 @@ void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text) } } else { // Word does not fit on this line. Start a new line. - os << "\n"; + os << '\n'; firstLine = false; if (r > l) { os << this->TextIndent; @@ -160,7 +160,7 @@ void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text) void cmDocumentationFormatter::PrintSection( std::ostream& os, cmDocumentationSection const& section) { - os << section.GetName() << "\n"; + os << section.GetName() << '\n'; const std::vector<cmDocumentationEntry>& entries = section.GetEntries(); for (cmDocumentationEntry const& entry : entries) { @@ -169,20 +169,20 @@ void cmDocumentationFormatter::PrintSection( this->TextIndent = " "; int align = static_cast<int>(strlen(this->TextIndent)) - 4; for (int i = static_cast<int>(entry.Name.size()); i < align; ++i) { - os << " "; + os << ' '; } if (entry.Name.size() > strlen(this->TextIndent) - 4) { - os << "\n"; + os << '\n'; os.write(this->TextIndent, strlen(this->TextIndent) - 2); } os << "= "; this->PrintColumn(os, entry.Brief.c_str()); - os << "\n"; + os << '\n'; } else { - os << "\n"; + os << '\n'; this->TextIndent = ""; this->PrintFormatted(os, entry.Brief.c_str()); } } - os << "\n"; + os << '\n'; } |