summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/codeparser.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2012-11-20 10:08:29 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2012-11-20 10:12:44 +0100
commit0dc61c4216697a2c4066d4735b4be941e869e514 (patch)
tree8a3876897fc5144cc2f9b28223ff9548944a8775 /src/tools/qdoc/codeparser.cpp
parentb98b11fa036ea301d1483df6f533ec55be727d9d (diff)
parenta769a212e0c22283fc05d3f49c252f8e2a62ba3f (diff)
Merge branch 'newdocs'
Added prepare_docs to qt_build_config.prf (it was added directly in configure in the source branch) Conflicts: configure tools/configure/configureapp.cpp Change-Id: I1337c69fc62b1c934e3e39b4409e4857440c9db8
Diffstat (limited to 'src/tools/qdoc/codeparser.cpp')
-rw-r--r--src/tools/qdoc/codeparser.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp
index 6ecca78a70..ea3bdc25f4 100644
--- a/src/tools/qdoc/codeparser.cpp
+++ b/src/tools/qdoc/codeparser.cpp
@@ -387,4 +387,80 @@ bool CodeParser::isParsingQdoc() const
return currentFile_.endsWith(".qdoc");
}
+/*!
+ For each node that will produce a documentation page, this function
+ ensures that the node belongs to a module. Normally, the qdoc comment
+ for an entity that will produce a documentation page will contain an
+ \inmodule command to tell qdoc which module the entity belongs to.
+
+ But now that we normally run qdoc on each module in two passes. The
+ first produces an index file; the second pass generates the docs
+ after reading all the index files it needs.
+
+ This means that all the pages generated during each pass 2 run of
+ qdoc almost certainly belong to a single module, and the name of
+ that module is, as a rule, used as the project name in the qdocconf
+ file used when running qdoc on the module.
+
+ So this function first asks if the node \a n has a non-empty module
+ name. If it it does not have a non-empty module name, it sets the
+ module name to be the project name.
+
+ In some cases it prints a qdoc warning that it has done this. Namely,
+ for C++ classes and namespaces.
+ */
+void CodeParser::checkModuleInclusion(Node* n)
+{
+ if (n->moduleName().isEmpty()) {
+ switch (n->type()) {
+ case Node::Class:
+ if (n->access() != Node::Private && !n->doc().isEmpty()) {
+ n->setModuleName(Generator::defaultModuleName());
+ n->doc().location().warning(tr("Class %1 has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->name()).arg(Generator::defaultModuleName()));
+ }
+ break;
+ case Node::Namespace:
+ if (n->access() != Node::Private && !n->name().isEmpty() && !n->doc().isEmpty()) {
+ n->setModuleName(Generator::defaultModuleName());
+ n->doc().location().warning(tr("Namespace %1 has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->name()).arg(Generator::defaultModuleName()));
+ }
+ break;
+ case Node::Document:
+ if (n->access() != Node::Private && !n->doc().isEmpty()) {
+ if (n->subType() == Node::HeaderFile) {
+ n->setModuleName(Generator::defaultModuleName());
+#if 0
+ n->doc().location().warning(tr("Header file with title \"%1\" has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->title()).arg(Generator::defaultModuleName()));
+#endif
+ }
+ else if (n->subType() == Node::Page) {
+ n->setModuleName(Generator::defaultModuleName());
+#if 0
+ n->doc().location().warning(tr("Page with title \"%1\" has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->title()).arg(Generator::defaultModuleName()));
+#endif
+ }
+ else if (n->subType() == Node::Example) {
+ n->setModuleName(Generator::defaultModuleName());
+#if 0
+ n->doc().location().warning(tr("Example with title \"%1\" has no \\inmodule command; "
+ "using project name by default: %2")
+ .arg(n->title()).arg(Generator::defaultModuleName()));
+#endif
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
QT_END_NAMESPACE