cmDocumentationFormatter.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef _cmDocumentationFormatter_h
  11. #define _cmDocumentationFormatter_h
  12. #include "cmStandardIncludes.h"
  13. /** This is just a helper class to make it build with MSVC 6.0.
  14. Actually the enums and internal classes could directly go into
  15. cmDocumentation, but then MSVC6 complains in RequestedHelpItem that
  16. cmDocumentation is an undefined type and so it doesn't know the enums.
  17. Moving the enums to a class which is then already completely parsed helps
  18. against this. */
  19. class cmDocumentationEnums
  20. {
  21. public:
  22. /** Types of help provided. */
  23. enum Type
  24. {
  25. None, Version, Usage, ListManuals,
  26. ListCommands, ListModules, ListProperties, ListVariables, ListPolicies,
  27. OneManual, OneCommand, OneModule, OneProperty, OneVariable, OnePolicy
  28. };
  29. /** Forms of documentation output. */
  30. enum Form { TextForm, HTMLForm, RSTForm, ManForm, UsageForm, DocbookForm };
  31. };
  32. class cmDocumentationSection;
  33. /** Base class for printing the documentation in the various supported
  34. formats. */
  35. class cmDocumentationFormatter
  36. {
  37. public:
  38. cmDocumentationFormatter();
  39. virtual ~cmDocumentationFormatter();
  40. void PrintFormatted(std::ostream& os, const char* text);
  41. virtual cmDocumentationEnums::Form GetForm() const = 0;
  42. virtual void PrintHeader(const char* /*docname*/,
  43. const char* /*appname*/,
  44. std::ostream& /*os*/) {}
  45. virtual void PrintFooter(std::ostream& /*os*/) {}
  46. virtual void PrintSection(std::ostream& os,
  47. const cmDocumentationSection& section,
  48. const char* name) = 0;
  49. virtual void PrintPreformatted(std::ostream& os, const char* text) = 0;
  50. virtual void PrintParagraph(std::ostream& os, const char* text) = 0;
  51. virtual void PrintIndex(std::ostream& ,
  52. std::vector<const cmDocumentationSection *>&)
  53. {}
  54. /** Compute a prefix for links into a section (#\<prefix\>_SOMETHING). */
  55. std::string ComputeSectionLinkPrefix(std::string const& name);
  56. };
  57. #endif