| 198 | } |
| 199 | |
| 200 | bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) |
| 201 | { |
| 202 | int count = 0; |
| 203 | bool result = true; |
| 204 | |
| 205 | // Loop over requested documentation types. |
| 206 | for (RequestedHelpItem const& rhi : this->RequestedHelpItems) { |
| 207 | this->CurrentArgument = rhi.Argument; |
| 208 | // If a file name was given, use it. Otherwise, default to the |
| 209 | // given stream. |
| 210 | cmsys::ofstream fout; |
| 211 | std::ostream* s = &os; |
| 212 | if (!rhi.Filename.empty()) { |
| 213 | fout.open(rhi.Filename.c_str()); |
| 214 | s = &fout; |
| 215 | } else if (++count > 1) { |
| 216 | os << "\n\n"; |
| 217 | } |
| 218 | |
| 219 | // Print this documentation type to the stream. |
| 220 | if (!this->PrintDocumentation(rhi.HelpType, *s) || s->fail()) { |
| 221 | result = false; |
| 222 | } |
| 223 | } |
| 224 | return result; |
| 225 | } |
| 226 | |
| 227 | void cmDocumentation::WarnFormFromFilename( |
| 228 | cmDocumentation::RequestedHelpItem& request, bool& result) |