cmDocumentationFormatter.h 884 B

12345678910111213141516171819202122232425262728
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <cstddef>
  6. #include <iosfwd>
  7. #include <string>
  8. class cmDocumentationSection;
  9. /** Print documentation in a simple text format. */
  10. class cmDocumentationFormatter
  11. {
  12. public:
  13. void SetIndent(std::size_t indent) { this->TextIndent = indent; }
  14. void PrintFormatted(std::ostream& os, std::string const& text) const;
  15. void PrintSection(std::ostream& os, cmDocumentationSection const& section);
  16. private:
  17. void PrintPreformatted(std::ostream& os, std::string const&) const;
  18. void PrintParagraph(std::ostream& os, std::string const&) const;
  19. void PrintColumn(std::ostream& os, std::string const&) const;
  20. std::size_t TextWidth = 77u;
  21. std::size_t TextIndent = 0u;
  22. };