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