2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2003-02-14 18:53:37 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2003-02-14 18:53:37 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2003-02-14 18:53:37 +03:00
|
|
|
#ifndef _cmDocumentation_h
|
|
|
|
#define _cmDocumentation_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
2007-07-11 23:53:58 +04:00
|
|
|
#include "cmProperty.h"
|
2007-09-19 17:05:28 +04:00
|
|
|
#include "cmDocumentationFormatter.h"
|
2007-10-22 20:49:09 +04:00
|
|
|
#include "cmDocumentationSection.h"
|
2011-11-15 23:24:38 +04:00
|
|
|
#include "cmake.h"
|
2007-07-02 19:24:44 +04:00
|
|
|
|
2007-09-19 21:14:25 +04:00
|
|
|
namespace cmsys
|
|
|
|
{
|
|
|
|
class Directory;
|
|
|
|
}
|
|
|
|
|
2003-02-14 18:53:37 +03:00
|
|
|
/** Class to generate documentation. */
|
2007-07-02 19:24:44 +04:00
|
|
|
class cmDocumentation: public cmDocumentationEnums
|
2003-02-14 18:53:37 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmDocumentation();
|
2012-06-22 01:02:55 +04:00
|
|
|
|
2005-12-14 21:51:08 +03:00
|
|
|
~cmDocumentation();
|
2012-02-04 15:15:57 +04:00
|
|
|
|
2003-02-19 04:42:02 +03:00
|
|
|
/**
|
|
|
|
* Check command line arguments for documentation options. Returns
|
2003-07-08 06:44:18 +04:00
|
|
|
* true if documentation options are found, and false otherwise.
|
|
|
|
* When true is returned, PrintRequestedDocumentation should be
|
2012-06-22 01:02:55 +04:00
|
|
|
* called. exitOpt can be used for things like cmake -E, so that
|
2008-08-19 23:42:48 +04:00
|
|
|
* all arguments after the -E are ignored and not searched for
|
|
|
|
* help arguments.
|
2003-02-19 04:42:02 +03:00
|
|
|
*/
|
2012-06-22 01:02:55 +04:00
|
|
|
bool CheckOptions(int argc, const char* const* argv,
|
2008-08-19 23:42:48 +04:00
|
|
|
const char* exitOpt =0);
|
2012-06-22 01:02:55 +04:00
|
|
|
|
2003-07-08 06:44:18 +04: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-22 01:02:55 +04:00
|
|
|
|
2003-02-19 04:42:02 +03:00
|
|
|
/** Print help of the given type. */
|
2013-09-14 00:31:29 +04:00
|
|
|
bool PrintDocumentation(Type ht, std::ostream& os);
|
2009-11-24 19:46:06 +03:00
|
|
|
|
|
|
|
void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; }
|
2012-06-22 01:02:55 +04:00
|
|
|
|
2003-02-19 04:42:02 +03:00
|
|
|
/** Set the program name for standard document generation. */
|
2003-08-06 22:49:52 +04:00
|
|
|
void SetName(const char* name);
|
|
|
|
|
2007-10-22 20:49:09 +04:00
|
|
|
/** Set a section of the documentation. Typical sections include Name,
|
2013-09-14 00:31:29 +04:00
|
|
|
Usage, Description, Options */
|
2007-10-22 20:49:09 +04:00
|
|
|
void SetSection(const char *sectionName,
|
|
|
|
cmDocumentationSection *section);
|
|
|
|
void SetSection(const char *sectionName,
|
|
|
|
std::vector<cmDocumentationEntry> &docs);
|
|
|
|
void SetSection(const char *sectionName,
|
2013-09-16 22:04:39 +04:00
|
|
|
const char *docs[][2]);
|
2007-10-22 20:49:09 +04:00
|
|
|
void SetSections(std::map<std::string,cmDocumentationSection *>
|
|
|
|
§ions);
|
2007-02-01 18:38:42 +03:00
|
|
|
|
2007-10-22 23:33:19 +04:00
|
|
|
/** Add the documentation to the beginning/end of the section */
|
|
|
|
void PrependSection(const char *sectionName,
|
2013-09-16 22:04:39 +04:00
|
|
|
const char *docs[][2]);
|
2007-10-24 19:36:47 +04:00
|
|
|
void PrependSection(const char *sectionName,
|
|
|
|
std::vector<cmDocumentationEntry> &docs);
|
|
|
|
void PrependSection(const char *sectionName,
|
|
|
|
cmDocumentationEntry &docs);
|
2007-10-22 23:33:19 +04:00
|
|
|
void AppendSection(const char *sectionName,
|
2013-09-16 22:04:39 +04:00
|
|
|
const char *docs[][2]);
|
2007-10-22 23:33:19 +04:00
|
|
|
void AppendSection(const char *sectionName,
|
|
|
|
std::vector<cmDocumentationEntry> &docs);
|
2007-10-24 19:36:47 +04:00
|
|
|
void AppendSection(const char *sectionName,
|
|
|
|
cmDocumentationEntry &docs);
|
2007-10-22 23:33:19 +04:00
|
|
|
|
2011-11-14 01:44:53 +04: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 18:53:37 +03:00
|
|
|
private:
|
2007-10-22 20:49:09 +04:00
|
|
|
|
2013-09-16 19:29:06 +04: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 22:25:43 +04:00
|
|
|
bool PrintVersion(std::ostream& os);
|
2013-09-16 19:29:06 +04: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);
|
2004-04-14 22:25:43 +04:00
|
|
|
bool PrintDocumentationUsage(std::ostream& os);
|
2003-02-19 04:42:02 +03:00
|
|
|
|
2007-01-22 18:52:24 +03:00
|
|
|
const char* GetNameString() const;
|
|
|
|
bool IsOption(const char* arg) const;
|
2003-02-19 04:42:02 +03:00
|
|
|
|
2009-11-24 19:46:06 +03:00
|
|
|
bool ShowGenerators;
|
|
|
|
|
2003-08-06 22:49:52 +04:00
|
|
|
std::string NameString;
|
2007-10-22 20:49:09 +04:00
|
|
|
std::map<std::string,cmDocumentationSection*> AllSections;
|
2012-06-22 01:02:55 +04:00
|
|
|
|
2007-06-28 19:00:57 +04:00
|
|
|
std::string CurrentArgument;
|
|
|
|
|
|
|
|
struct RequestedHelpItem
|
|
|
|
{
|
2013-09-14 00:09:52 +04:00
|
|
|
RequestedHelpItem(): HelpType(None) {}
|
2007-07-03 16:26:32 +04:00
|
|
|
cmDocumentationEnums::Type HelpType;
|
2007-06-28 19:00:57 +04:00
|
|
|
std::string Filename;
|
|
|
|
std::string Argument;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<RequestedHelpItem> RequestedHelpItems;
|
2013-09-14 00:09:52 +04:00
|
|
|
cmDocumentationFormatter Formatter;
|
|
|
|
|
2013-11-19 19:58:16 +04:00
|
|
|
static void WarnFormFromFilename(RequestedHelpItem& request, bool& result);
|
2003-02-14 18:53:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|