/src/CMake/Source/cmDocumentationFormatter.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <cstddef> |
8 | | #include <iosfwd> |
9 | | #include <string> |
10 | | |
11 | | #include <cm/string_view> |
12 | | |
13 | | class cmDocumentationSection; |
14 | | |
15 | | /** Print documentation in a simple text format. */ |
16 | | class cmDocumentationFormatter |
17 | | { |
18 | | public: |
19 | | std::string Format(cm::string_view text) const; |
20 | | void PrintSection(std::ostream& os, cmDocumentationSection const& section); |
21 | | void PrintFormatted(std::ostream& os, std::string const& text) const; |
22 | 1 | void SetIndent(std::size_t indent) { this->TextIndent = indent; } |
23 | | |
24 | | static constexpr std::size_t TEXT_WIDTH = 77u; |
25 | | |
26 | | private: |
27 | | void PrintPreformatted(std::ostream& os, std::string const&) const; |
28 | | void PrintParagraph(std::ostream& os, std::string const&) const; |
29 | | void PrintColumn(std::ostream& os, std::string const&) const; |
30 | | |
31 | | std::size_t TextIndent = 0u; |
32 | | }; |