2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2003-02-14 15:53:37 +00:00
|
|
|
#ifndef _cmDocumentation_h
|
|
|
|
#define _cmDocumentation_h
|
|
|
|
|
2017-04-11 20:00:21 +00:00
|
|
|
#include "cmConfigure.h"
|
2016-09-01 18:05:48 +00:00
|
|
|
|
2007-09-19 13:05:28 +00:00
|
|
|
#include "cmDocumentationFormatter.h"
|
2007-07-02 15:24:44 +00:00
|
|
|
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <iosfwd>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class cmDocumentationSection;
|
|
|
|
struct cmDocumentationEntry;
|
2007-09-19 17:14:25 +00:00
|
|
|
|
2003-02-14 15:53:37 +00:00
|
|
|
/** Class to generate documentation. */
|
2016-05-16 14:34:04 +00:00
|
|
|
class cmDocumentation : public cmDocumentationEnums
|
2003-02-14 15:53:37 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmDocumentation();
|
2012-06-21 21:02:55 +00:00
|
|
|
|
2005-12-14 18:51:08 +00:00
|
|
|
~cmDocumentation();
|
2012-02-04 11:15:57 +00:00
|
|
|
|
2003-02-19 01:42:02 +00:00
|
|
|
/**
|
|
|
|
* Check command line arguments for documentation options. Returns
|
2003-07-08 02:44:18 +00:00
|
|
|
* true if documentation options are found, and false otherwise.
|
|
|
|
* When true is returned, PrintRequestedDocumentation should be
|
2012-06-21 21:02:55 +00:00
|
|
|
* called. exitOpt can be used for things like cmake -E, so that
|
2008-08-19 19:42:48 +00:00
|
|
|
* all arguments after the -E are ignored and not searched for
|
|
|
|
* help arguments.
|
2003-02-19 01:42:02 +00:00
|
|
|
*/
|
2012-06-21 21:02:55 +00:00
|
|
|
bool CheckOptions(int argc, const char* const* argv,
|
2016-06-27 20:44:16 +00:00
|
|
|
const char* exitOpt = CM_NULLPTR);
|
2012-06-21 21:02:55 +00:00
|
|
|
|
2003-07-08 02:44:18 +00:00
|
|
|
/**
|
|
|
|
* Print help requested on the command line. Call after
|
|
|
|
* CheckOptions returns true. Returns true on success, and false
|
|
|
|
* otherwise. Failure can occur when output files specified on the
|
|
|
|
* command line cannot be written.
|
|
|
|
*/
|
|
|
|
bool PrintRequestedDocumentation(std::ostream& os);
|
2012-06-21 21:02:55 +00:00
|
|
|
|
2003-02-19 01:42:02 +00:00
|
|
|
/** Print help of the given type. */
|
2013-09-13 20:31:29 +00:00
|
|
|
bool PrintDocumentation(Type ht, std::ostream& os);
|
2009-11-24 16:46:06 +00:00
|
|
|
|
|
|
|
void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; }
|
2012-06-21 21:02:55 +00:00
|
|
|
|
2003-02-19 01:42:02 +00:00
|
|
|
/** Set the program name for standard document generation. */
|
2014-02-07 20:35:30 +00:00
|
|
|
void SetName(const std::string& name);
|
2003-08-06 18:49:52 +00:00
|
|
|
|
2007-10-22 16:49:09 +00:00
|
|
|
/** Set a section of the documentation. Typical sections include Name,
|
2013-09-13 20:31:29 +00:00
|
|
|
Usage, Description, Options */
|
2016-05-16 14:34:04 +00:00
|
|
|
void SetSection(const char* sectionName, cmDocumentationSection* section);
|
|
|
|
void SetSection(const char* sectionName,
|
|
|
|
std::vector<cmDocumentationEntry>& docs);
|
|
|
|
void SetSection(const char* sectionName, const char* docs[][2]);
|
|
|
|
void SetSections(std::map<std::string, cmDocumentationSection*>& sections);
|
2007-02-01 15:38:42 +00:00
|
|
|
|
2007-10-22 19:33:19 +00:00
|
|
|
/** Add the documentation to the beginning/end of the section */
|
2016-05-16 14:34:04 +00:00
|
|
|
void PrependSection(const char* sectionName, 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[][2]);
|
|
|
|
void AppendSection(const char* sectionName,
|
|
|
|
std::vector<cmDocumentationEntry>& docs);
|
|
|
|
void AppendSection(const char* sectionName, cmDocumentationEntry& docs);
|
2007-10-22 19:33:19 +00:00
|
|
|
|
2011-11-13 21:44:53 +00:00
|
|
|
/** Add common (to all tools) documentation section(s) */
|
|
|
|
void addCommonStandardDocSections();
|
|
|
|
|
|
|
|
/** Add the CMake standard documentation section(s) */
|
|
|
|
void addCMakeStandardDocSections();
|
|
|
|
|
|
|
|
/** Add the CTest standard documentation section(s) */
|
|
|
|
void addCTestStandardDocSections();
|
|
|
|
|
|
|
|
/** Add the CPack standard documentation section(s) */
|
|
|
|
void addCPackStandardDocSections();
|
|
|
|
|
2003-02-14 15:53:37 +00:00
|
|
|
private:
|
2013-09-16 15:29:06 +00:00
|
|
|
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);
|
|
|
|
|
2004-04-14 18:25:43 +00:00
|
|
|
bool PrintVersion(std::ostream& os);
|
2014-06-12 20:18:32 +00:00
|
|
|
bool PrintUsage(std::ostream& os);
|
|
|
|
bool PrintHelp(std::ostream& os);
|
2014-04-24 19:05:38 +00:00
|
|
|
bool PrintHelpFull(std::ostream& os);
|
2013-09-16 15:29:06 +00:00
|
|
|
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);
|
2015-03-29 18:28:30 +00:00
|
|
|
bool PrintHelpListGenerators(std::ostream& os);
|
2014-01-08 16:14:06 +00:00
|
|
|
bool PrintOldCustomModules(std::ostream& os);
|
2003-02-19 01:42:02 +00:00
|
|
|
|
2007-01-22 15:52:24 +00:00
|
|
|
const char* GetNameString() const;
|
|
|
|
bool IsOption(const char* arg) const;
|
2003-02-19 01:42:02 +00:00
|
|
|
|
2009-11-24 16:46:06 +00:00
|
|
|
bool ShowGenerators;
|
|
|
|
|
2003-08-06 18:49:52 +00:00
|
|
|
std::string NameString;
|
2016-05-16 14:34:04 +00:00
|
|
|
std::map<std::string, cmDocumentationSection*> AllSections;
|
2012-06-21 21:02:55 +00:00
|
|
|
|
2007-06-28 15:00:57 +00:00
|
|
|
std::string CurrentArgument;
|
|
|
|
|
|
|
|
struct RequestedHelpItem
|
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
RequestedHelpItem()
|
|
|
|
: HelpType(None)
|
|
|
|
{
|
|
|
|
}
|
2007-07-03 12:26:32 +00:00
|
|
|
cmDocumentationEnums::Type HelpType;
|
2007-06-28 15:00:57 +00:00
|
|
|
std::string Filename;
|
|
|
|
std::string Argument;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<RequestedHelpItem> RequestedHelpItems;
|
2013-09-13 20:09:52 +00:00
|
|
|
cmDocumentationFormatter Formatter;
|
|
|
|
|
2013-11-19 15:58:16 +00:00
|
|
|
static void WarnFormFromFilename(RequestedHelpItem& request, bool& result);
|
2003-02-14 15:53:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|