MCPcopy Create free account
hub / github.com/Kitware/CMake / PrintSection

Method PrintSection

Source/cmDocumentationFormatter.cxx:147–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void cmDocumentationFormatter::PrintSection(
148 std::ostream& os, cmDocumentationSection const& section)
149{
150 std::size_t const PREFIX_SIZE =
151 sizeof(cmDocumentationEntry::CustomNamePrefix) + 1u;
152 // length of the "= " literal (see below)
153 std::size_t const SUFFIX_SIZE = 2u;
154 // legacy magic number ;-)
155 std::size_t const NAME_SIZE = 29u;
156
157 std::size_t const PADDING_SIZE = PREFIX_SIZE + SUFFIX_SIZE;
158 std::size_t const TITLE_SIZE = NAME_SIZE + PADDING_SIZE;
159
160 auto const savedIndent = this->TextIndent;
161
162 os << section.GetName() << '\n';
163
164 for (cmDocumentationEntry const& entry : section.GetEntries()) {
165 if (!entry.Name.empty()) {
166 this->TextIndent = TITLE_SIZE;
167 os << std::setw(PREFIX_SIZE) << std::left << entry.CustomNamePrefix
168 << std::setw(int(std::max(NAME_SIZE, entry.Name.size())))
169 << entry.Name;
170 if (entry.Name.size() > NAME_SIZE) {
171 os << '\n' << std::setw(int(this->TextIndent - PREFIX_SIZE)) << ' ';
172 }
173 os << "= " << this->Format(entry.Brief).substr(this->TextIndent);
174 } else {
175 this->TextIndent = 0u;
176 os << '\n' << this->Format(entry.Brief);
177 }
178 }
179
180 os << '\n';
181
182 this->TextIndent = savedIndent;
183}
184
185void cmDocumentationFormatter::PrintFormatted(std::ostream& os,
186 std::string const& text) const

Callers 3

PrintUsageMethod · 0.80
PrintHelpMethod · 0.80

Calls 5

FormatMethod · 0.95
GetNameMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected