From 89be197b9225c5b0079425b0c0daf72fbe4f8a9c Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Fri, 23 Mar 2012 14:09:33 +0100 Subject: qdoc: Add CLI option to not generate example docs. Change-Id: I059ae76430adada020d338905b39ba3089c89615 Reviewed-by: Martin Smith --- src/tools/qdoc/config.cpp | 1 + src/tools/qdoc/config.h | 1 + src/tools/qdoc/cppcodeparser.cpp | 8 +++++--- src/tools/qdoc/main.cpp | 19 ++++++++++++------- 4 files changed, 19 insertions(+), 10 deletions(-) (limited to 'src/tools') diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index f97b6ca93f..8b356d1536 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -148,6 +148,7 @@ QStringList MetaStack::getExpanded(const Location& location) } QT_STATIC_CONST_IMPL QString Config::dot = QLatin1String("."); +bool Config::generateExamples = true; QString Config::overrideOutputDir; QSet Config::overrideOutputFormats; QMap Config::extractedDirs; diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h index 6a89684e79..f36389eb32 100644 --- a/src/tools/qdoc/config.h +++ b/src/tools/qdoc/config.h @@ -110,6 +110,7 @@ public: QT_STATIC_CONST QString dot; + static bool generateExamples; static QString overrideOutputDir; static QSet overrideOutputFormats; diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index 86e57a0372..a308da1f98 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -684,9 +684,11 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, return node; } else if (command == COMMAND_EXAMPLE) { - ExampleNode* en = new ExampleNode(tre->root(), arg); - createExampleFileNodes(en); - return en; + if (Config::generateExamples) { + ExampleNode* en = new ExampleNode(tre->root(), arg); + createExampleFileNodes(en); + return en; + } } else if (command == COMMAND_EXTERNALPAGE) { return new FakeNode(tre->root(), arg, Node::ExternalPage, Node::ArticlePage); diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 85e97cdec9..de268e1177 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -108,22 +108,24 @@ static void printHelp() { Location::information(tr("Usage: qdoc [options] file1.qdocconf ...\n" "Options:\n" - " -help " - "Display this information and exit\n" - " -version " - "Display version of qdoc and exit\n" " -D " "Define as a macro while parsing sources\n" + " -help " + "Display this information and exit\n" " -highlighting " "Turn on syntax highlighting (makes qdoc run slower)\n" - " -showinternal " - "Include stuff marked internal\n" + " -no-examples " + "Do not generate documentation for examples" " -obsoletelinks " "Report links from obsolete items to non-obsolete items\n" " -outputdir " "Specify output directory, overrides setting in qdocconf file\n" " -outputformat " - "Specify output format, overrides setting in qdocconf file") ); + "Specify output format, overrides setting in qdocconf file" + " -showinternal " + "Include content marked internal\n" + " -version " + "Display version of qdoc and exit\n") ); } /*! @@ -427,6 +429,9 @@ int main(int argc, char **argv) else if (opt == "-showinternal") { showInternal = true; } + else if (opt == "-no-examples") { + Config::generateExamples = false; + } else if (opt == "-obsoletelinks") { obsoleteLinks = true; } -- cgit v1.2.3