summaryrefslogtreecommitdiff
path: root/Source/cmDocumentation.h
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-09-19 09:05:28 -0400
committerAlexander Neundorf <neundorf@kde.org>2007-09-19 09:05:28 -0400
commitc5f249bdbdb894d72db8211021ac2b9ff8b02fa7 (patch)
tree9378751765b4e994d93ba99cfa7e737a180e6513 /Source/cmDocumentation.h
parentb4f02ec0bd8e102fb93230ed2ffe15c90bb33a81 (diff)
downloadcmake-c5f249bdbdb894d72db8211021ac2b9ff8b02fa7.tar.gz
STYLE: move the code for the different formats of the generated help into
their own classes, making cmDocumentation smaller and also making it easier to eventually add another format Alex
Diffstat (limited to 'Source/cmDocumentation.h')
-rw-r--r--Source/cmDocumentation.h65
1 files changed, 13 insertions, 52 deletions
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index bac58b931e..90e6e69835 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -19,26 +19,11 @@
#include "cmStandardIncludes.h"
#include "cmProperty.h"
-
-/** This is just a helper class to make it build with MSVC 6.0.
-Actually the enums and internal classes could directly go into
-cmDocumentation, but then MSVC6 complains in RequestedHelpItem that
-cmDocumentation is an undefined type and so it doesn't know the enums.
-Moving the enums to a class which is then already completely parsed helps.
-against this. */
-class cmDocumentationEnums
-{
-public:
- /** Types of help provided. */
- enum Type
- { None, Usage, Single, SingleModule, SingleProperty,
- List, ModuleList, PropertyList,
- Full, Properties, Modules, Commands, CompatCommands,
- Copyright, Version };
-
- /** Forms of documentation output. */
- enum Form { TextForm, HTMLForm, ManForm, UsageForm };
-};
+#include "cmDocumentationFormatter.h"
+#include "cmDocumentationFormatterHTML.h"
+#include "cmDocumentationFormatterMan.h"
+#include "cmDocumentationFormatterText.h"
+#include "cmDocumentationFormatterUsage.h"
/** Class to generate documentation. */
@@ -176,34 +161,7 @@ public:
static Form GetFormFromFilename(const std::string& filename);
private:
- void PrintHeader(const char* title, std::ostream& os);
- void PrintFooter(std::ostream& os);
-
- void PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name);
- void PrintSectionText(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name);
- void PrintSectionHTML(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name);
- void PrintSectionMan(std::ostream& os, const cmDocumentationEntry* section,
- const char* name);
- void PrintSectionUsage(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name);
- void PrintFormatted(std::ostream& os, const char* text);
- void PrintPreformatted(std::ostream& os, const char* text);
- void PrintPreformattedText(std::ostream& os, const char* text);
- void PrintPreformattedHTML(std::ostream& os, const char* text);
- void PrintPreformattedMan(std::ostream& os, const char* text);
- void PrintParagraph(std::ostream& os, const char* text);
- void PrintParagraphText(std::ostream& os, const char* text);
- void PrintParagraphHTML(std::ostream& os, const char* text);
- void PrintParagraphMan(std::ostream& os, const char* text);
- void PrintColumn(std::ostream& os, const char* text);
- void PrintHTMLEscapes(std::ostream& os, const char* text);
+ void SetForm(Form f);
bool CreateSingleModule(const char* fname, const char* moduleName);
bool CreateModulesSection();
@@ -223,7 +181,7 @@ private:
bool PrintDocumentationCompatCommands(std::ostream& os);
void PrintDocumentationCommand(std::ostream& os,
const cmDocumentationEntry* entry);
-
+
void CreateUsageDocumentation();
void CreateFullDocumentation();
void CreateCurrentCommandsDocumentation();
@@ -264,10 +222,7 @@ private:
std::vector< char* > ModuleStrings;
std::vector< const char* > Names;
std::vector< const cmDocumentationEntry* > Sections;
- Form CurrentForm;
std::string CurrentArgument;
- const char* TextIndent;
- int TextWidth;
struct RequestedHelpItem
{
@@ -279,6 +234,12 @@ private:
};
std::vector<RequestedHelpItem> RequestedHelpItems;
+ cmDocumentationFormatter* CurrentFormatter;
+ cmDocumentationFormatterHTML HTMLFormatter;
+ cmDocumentationFormatterMan ManFormatter;
+ cmDocumentationFormatterText TextFormatter;
+ cmDocumentationFormatterUsage UsageFormatter;
+
};
#endif