summaryrefslogtreecommitdiffstats
path: root/Source/cmDocumentation.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmDocumentation.h')
-rw-r--r--Source/cmDocumentation.h169
1 files changed, 23 insertions, 146 deletions
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 218f44d..a4072c5 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -15,11 +15,6 @@
#include "cmStandardIncludes.h"
#include "cmProperty.h"
#include "cmDocumentationFormatter.h"
-#include "cmDocumentationFormatterHTML.h"
-#include "cmDocumentationFormatterDocbook.h"
-#include "cmDocumentationFormatterMan.h"
-#include "cmDocumentationFormatterText.h"
-#include "cmDocumentationFormatterUsage.h"
#include "cmDocumentationSection.h"
#include "cmake.h"
@@ -37,22 +32,6 @@ public:
~cmDocumentation();
/**
- * An helper type pair for [structured] documented modules.
- * The comment of those module contains structure markup
- * which makes it possible to retrieve the documentation
- * of variables, macros and functions defined in the module.
- * - first is the filename of the module
- * - second is the section of the doc the module belongs too
- */
- typedef std::pair<std::string,std::string> documentedModuleSectionPair_t;
- /**
- * A list of documented module(s).
- */
- typedef std::list<documentedModuleSectionPair_t> documentedModulesList_t;
-
- // High-level interface for standard documents:
-
- /**
* Check command line arguments for documentation options. Returns
* true if documentation options are found, and false otherwise.
* When true is returned, PrintRequestedDocumentation should be
@@ -72,7 +51,7 @@ public:
bool PrintRequestedDocumentation(std::ostream& os);
/** Print help of the given type. */
- bool PrintDocumentation(Type ht, std::ostream& os, const char* docname=0);
+ bool PrintDocumentation(Type ht, std::ostream& os);
void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; }
@@ -80,62 +59,33 @@ public:
void SetName(const char* name);
/** Set a section of the documentation. Typical sections include Name,
- Usage, Description, Options, SeeAlso */
+ Usage, Description, Options */
void SetSection(const char *sectionName,
cmDocumentationSection *section);
void SetSection(const char *sectionName,
std::vector<cmDocumentationEntry> &docs);
void SetSection(const char *sectionName,
- const char *docs[][3]);
+ const char *docs[][2]);
void SetSections(std::map<std::string,cmDocumentationSection *>
&sections);
/** Add the documentation to the beginning/end of the section */
void PrependSection(const char *sectionName,
- const char *docs[][3]);
+ const char *docs[][2]);
void PrependSection(const char *sectionName,
std::vector<cmDocumentationEntry> &docs);
void PrependSection(const char *sectionName,
cmDocumentationEntry &docs);
void AppendSection(const char *sectionName,
- const char *docs[][3]);
+ const char *docs[][2]);
void AppendSection(const char *sectionName,
std::vector<cmDocumentationEntry> &docs);
void AppendSection(const char *sectionName,
cmDocumentationEntry &docs);
- /**
- * Print documentation in the given form. All previously added
- * sections will be generated.
- */
- void Print(Form f, int manSection, std::ostream& os);
-
- /**
- * Print documentation in the current form. All previously added
- * sections will be generated.
- */
- void Print(std::ostream& os);
-
- /**
- * Add a section of documentation. This can be used to generate custom help
- * documents.
- */
- void AddSectionToPrint(const char *section);
-
- void SetSeeAlsoList(const char *data[][3]);
-
- /** Clear all previously added sections of help. */
- void ClearSections();
-
/** Set cmake root so we can find installed files */
void SetCMakeRoot(const char* root) { this->CMakeRoot = root;}
- /** Set CMAKE_MODULE_PATH so we can find additional cmake modules */
- void SetCMakeModulePath(const char* path) { this->CMakeModulePath = path;}
-
- static Form GetFormFromFilename(const std::string& filename,
- int* ManSection);
-
/** Add common (to all tools) documentation section(s) */
void addCommonStandardDocSections();
@@ -148,123 +98,50 @@ public:
/** Add the CPack standard documentation section(s) */
void addCPackStandardDocSections();
- /** Add automatic variables sections */
- void addAutomaticVariableSections(const std::string& section);
-
- /**
- * Retrieve the list of documented module located in
- * path which match the globing expression globExpr.
- * @param[in] path directory where to start the search
- * we will recurse into it.
- * @param[in] globExpr the globing expression used to
- * match the file in path.
- * @param[out] docModuleList the list of obtained pairs (may be empty)
- * @return 0 on success 1 on error or empty list
- */
- int getDocumentedModulesListInDir(
- std::string path,
- std::string globExpr,
- documentedModulesList_t& docModuleList);
-
- /**
- * Get the documentation of macros, functions and variable documented
- * with CMake structured documentation in a CMake script.
- * (in fact it may be in any file which follow the structured doc format)
- * Structured documentation begin with
- * ## (double sharp) in column 1 & 2 immediately followed
- * by a markup. Those ## are ignored by the legacy module
- * documentation parser @see CreateSingleModule.
- * Current markup are ##section, ##module,
- * ##macro, ##function, ##variable and ##end.
- * ##end is closing either of the previous ones.
- * @param[in] fname the script file name to be parsed for documentation
- * @param[in,out] commands the vector of command/macros documentation
- * entry found in the script file.
- * @param[in,out] cm the cmake object instance to which variable
- * documentation will be attached
- * (using @see cmake::DefineProperty)
- * @return the number of documented items (command and variable)
- * found in the file.
- */
- int GetStructuredDocFromFile(const char* fname,
- std::vector<cmDocumentationEntry>& commands,
- cmake* cm);
private:
- void SetForm(Form f, int manSection);
- void SetDocName(const char* docname);
-
- bool CreateSingleModule(const char* fname,
- const char* moduleName,
- cmDocumentationSection &sec);
- void CreateModuleDocsForDir(cmsys::Directory& dir,
- cmDocumentationSection &moduleSection);
- bool CreateModulesSection();
- bool CreateCustomModulesSection();
- void CreateFullDocumentation();
- void AddDocumentIntroToPrint(const char* intro[2]);
+ void GlobHelp(std::vector<std::string>& files, std::string const& pattern);
+ void PrintNames(std::ostream& os, std::string const& pattern);
+ bool PrintFiles(std::ostream& os, std::string const& pattern);
- bool PrintCopyright(std::ostream& os);
bool PrintVersion(std::ostream& os);
- bool PrintDocumentationGeneric(std::ostream& os, const char *section);
- bool PrintDocumentationList(std::ostream& os, const char *section);
- bool PrintDocumentationSingle(std::ostream& os);
- bool PrintDocumentationSingleModule(std::ostream& os);
- bool PrintDocumentationSingleProperty(std::ostream& os);
- bool PrintDocumentationSinglePolicy(std::ostream& os);
- bool PrintDocumentationSingleVariable(std::ostream& os);
+ bool PrintHelpOneManual(std::ostream& os);
+ bool PrintHelpOneCommand(std::ostream& os);
+ bool PrintHelpOneModule(std::ostream& os);
+ bool PrintHelpOnePolicy(std::ostream& os);
+ bool PrintHelpOneProperty(std::ostream& os);
+ bool PrintHelpOneVariable(std::ostream& os);
+ bool PrintHelpListManuals(std::ostream& os);
+ bool PrintHelpListCommands(std::ostream& os);
+ bool PrintHelpListModules(std::ostream& os);
+ bool PrintHelpListProperties(std::ostream& os);
+ bool PrintHelpListVariables(std::ostream& os);
+ bool PrintHelpListPolicies(std::ostream& os);
bool PrintDocumentationUsage(std::ostream& os);
- bool PrintDocumentationFull(std::ostream& os);
- bool PrintDocumentationModules(std::ostream& os);
- bool PrintDocumentationCustomModules(std::ostream& os);
- bool PrintDocumentationPolicies(std::ostream& os);
- bool PrintDocumentationProperties(std::ostream& os);
- bool PrintDocumentationVariables(std::ostream& os);
- bool PrintDocumentationCurrentCommands(std::ostream& os);
- bool PrintDocumentationCompatCommands(std::ostream& os);
- void PrintDocumentationCommand(std::ostream& os,
- const cmDocumentationEntry &entry);
-
const char* GetNameString() const;
- const char* GetDocName(bool fallbackToNameString = true) const;
- const char* GetDefaultDocName(Type ht) const;
bool IsOption(const char* arg) const;
bool ShowGenerators;
std::string NameString;
- std::string DocName;
std::map<std::string,cmDocumentationSection*> AllSections;
- std::string SeeAlsoString;
std::string CMakeRoot;
- std::string CMakeModulePath;
- std::set<std::string> ModulesFound;
- std::vector< char* > ModuleStrings;
- std::vector<const cmDocumentationSection *> PrintSections;
std::string CurrentArgument;
struct RequestedHelpItem
{
- RequestedHelpItem():HelpForm(TextForm), HelpType(None), ManSection(1) {}
- cmDocumentationEnums::Form HelpForm;
+ RequestedHelpItem(): HelpType(None) {}
cmDocumentationEnums::Type HelpType;
std::string Filename;
std::string Argument;
- int ManSection;
};
std::vector<RequestedHelpItem> RequestedHelpItems;
- cmDocumentationFormatter* CurrentFormatter;
- cmDocumentationFormatterHTML HTMLFormatter;
- cmDocumentationFormatterDocbook DocbookFormatter;
- cmDocumentationFormatterMan ManFormatter;
- cmDocumentationFormatterText TextFormatter;
- cmDocumentationFormatterUsage UsageFormatter;
+ cmDocumentationFormatter Formatter;
- std::vector<std::string> PropertySections;
- std::vector<std::string> VariableSections;
+ static void WarnFormFromFilename(RequestedHelpItem& request);
};
#endif