cmDocumentationFormatter.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef _cmDocumentationFormatter_h
  14. #define _cmDocumentationFormatter_h
  15. #include "cmStandardIncludes.h"
  16. /** This is just a helper class to make it build with MSVC 6.0.
  17. Actually the enums and internal classes could directly go into
  18. cmDocumentation, but then MSVC6 complains in RequestedHelpItem that
  19. cmDocumentation is an undefined type and so it doesn't know the enums.
  20. Moving the enums to a class which is then already completely parsed helps
  21. against this. */
  22. class cmDocumentationEnums
  23. {
  24. public:
  25. /** Types of help provided. */
  26. enum Type
  27. { None, Usage, Single, SingleModule, SingleProperty, SingleVariable,
  28. List, ModuleList, PropertyList, VariableList,
  29. Full, Properties, Variables, Modules, CustomModules, Commands,
  30. CompatCommands, Copyright, Version, Policies, SinglePolicy };
  31. /** Forms of documentation output. */
  32. enum Form { TextForm, HTMLForm, ManForm, UsageForm, DocbookForm };
  33. };
  34. class cmDocumentationSection;
  35. /** Base class for printing the documentation in the various supported
  36. formats. */
  37. class cmDocumentationFormatter
  38. {
  39. public:
  40. cmDocumentationFormatter();
  41. virtual ~cmDocumentationFormatter();
  42. void PrintFormatted(std::ostream& os, const char* text);
  43. virtual cmDocumentationEnums::Form GetForm() const = 0;
  44. virtual void PrintHeader(const char* /*name*/, 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. };
  55. #endif