From 03b8f9d935ec0c4227c02fee1b73db037cc1932a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 20 Apr 2018 12:46:35 +0200 Subject: qdoc: Document a namespace in multiple modules qdoc didn't handle this. This update fixes most of what was wrong, but tuning the details of the namespace reference pages might follow. We have namespace Qt as an example. Most of the elements in the Qt namespace are in QtCore, but a few functions are declared in QtGui. Before this update, qdoc used the hack of using #ifdef to remove the declarations from qtextdocument.h in QtGui and .cpp and then added them back into qtnamespace.h and .cpp in QtCore. Now that hack is no longer necessary. The functions in the Qt namespace that are declared in QtGui are documented there, but the documentation is linked to from the namespace reference page, which remains in QtCore. That is, only one \namespace command is used to document the Qt namespace, and it appears in qnamespace.qdoc where it always did, but the documentation for the Qt namespace functions declared in QtGui is now appears in qtextdocument.cpp where it belongs. This also allows qdoc to report when a namespace contains elements that are public and documented, but the namespace itself is not documented, which was not possible before this change. qdoc also reports if a namespace is documented in more than one module. That is, for example, when \namespace Qt is used in both QtCore and QtGui. Note that this change will increase the number of qdoc warnings in QtBase, but the new warnings are expacted. Change-Id: If978a59209b7b2ae90713d3ae809ae03361df72f Task-number: QTBUG-67267 Reviewed-by: Martin Smith --- src/qdoc/cppcodeparser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/qdoc/cppcodeparser.cpp') diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 9df4cc678..3471e2cc1 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -239,8 +239,8 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, without including the namespace qualifier. */ Node::NodeType type = nodeTypeMap[command]; - QStringList paths = arg.first.split(QLatin1Char(' ')); - QStringList path = paths[0].split("::"); + QStringList words = arg.first.split(QLatin1Char(' ')); + QStringList path = words[0].split("::"); Node *node = 0; node = qdb_->findNodeInOpenNamespace(path, type); @@ -258,6 +258,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, if (type == Node::Namespace) { NamespaceNode* ns = static_cast(node); ns->markSeen(); + ns->setWhereDocumented(ns->tree()->camelCaseModuleName()); } /* This treats a class as a namespace. -- cgit v1.2.1