From 100ffb60ef07e026a054b9df9007ec1b25698c90 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 4 Mar 2015 11:48:51 +0100 Subject: qdoc: Teach qdoc to resolve namespaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It turns out this bug was caused by modularization, which created the situation where members of the Qt namespace are in different modules. Most are in QtCore, but a few are in QtGui. qdoc was creating a namespace node for the Qt namespace in the node tree for QtCore, and another namespace node in the node tree for QtGui. This meant that there were two NamespaceNodes for the Qt namespace. Correctly, only one of these nodes contained the text for the \namespace command for the Qt namespace. This was the namespace node that was being used to create the HTML reference page for the Qt namespace. Unfortunately, the Qt namespace node in the tree for QtGui was not being merged into the Qt namespace node in QtCore, so some of the members of the Qt namespace were not being shown on the reference page. This update teches qdoc how to merge namespace nodes to ensure that all the members appear on the reference page for the namespace. There can be a namespace node for the namespace xxx in any number of modules, but they will all be merged into the namespace node for namespace xxx that contains the qdoc comment for \namespace xxx. Change-Id: I0f6a653ea6f920aacd5d8e13f9865488d95f6458 Task-number: QTBUG-44688 Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/cppcodemarker.cpp | 119 +++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 60 deletions(-) (limited to 'src/tools/qdoc/cppcodemarker.cpp') diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index 400c4808ed..1546b5226e 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -442,75 +442,73 @@ QList
CppCodeMarker::sections(const InnerNode *inner, { QList
sections; - if (inner->type() == Node::Class) { - const ClassNode *classNode = static_cast(inner); - + if (inner->isClass()) { if (style == Summary) { - FastSection privateFunctions(classNode, + FastSection privateFunctions(inner, "Private Functions", QString(), "private function", "private functions"); - FastSection privateSlots(classNode, "Private Slots", QString(), "private slot", "private slots"); - FastSection privateTypes(classNode, "Private Types", QString(), "private type", "private types"); - FastSection protectedFunctions(classNode, + FastSection privateSlots(inner, "Private Slots", QString(), "private slot", "private slots"); + FastSection privateTypes(inner, "Private Types", QString(), "private type", "private types"); + FastSection protectedFunctions(inner, "Protected Functions", QString(), "protected function", "protected functions"); - FastSection protectedSlots(classNode, + FastSection protectedSlots(inner, "Protected Slots", QString(), "protected slot", "protected slots"); - FastSection protectedTypes(classNode, + FastSection protectedTypes(inner, "Protected Types", QString(), "protected type", "protected types"); - FastSection protectedVariables(classNode, + FastSection protectedVariables(inner, "Protected Variables", QString(), "protected type", "protected variables"); - FastSection publicFunctions(classNode, + FastSection publicFunctions(inner, "Public Functions", QString(), "public function", "public functions"); - FastSection publicSignals(classNode, "Signals", QString(), "signal", "signals"); - FastSection publicSlots(classNode, "Public Slots", QString(), "public slot", "public slots"); - FastSection publicTypes(classNode, "Public Types", QString(), "public type", "public types"); - FastSection publicVariables(classNode, + FastSection publicSignals(inner, "Signals", QString(), "signal", "signals"); + FastSection publicSlots(inner, "Public Slots", QString(), "public slot", "public slots"); + FastSection publicTypes(inner, "Public Types", QString(), "public type", "public types"); + FastSection publicVariables(inner, "Public Variables", QString(), "public variable", "public variables"); - FastSection properties(classNode, "Properties", QString(), "property", "properties"); - FastSection relatedNonMembers(classNode, + FastSection properties(inner, "Properties", QString(), "property", "properties"); + FastSection relatedNonMembers(inner, "Related Non-Members", QString(), "related non-member", "related non-members"); - FastSection staticPrivateMembers(classNode, + FastSection staticPrivateMembers(inner, "Static Private Members", QString(), "static private member", "static private members"); - FastSection staticProtectedMembers(classNode, + FastSection staticProtectedMembers(inner, "Static Protected Members", QString(), "static protected member", "static protected members"); - FastSection staticPublicMembers(classNode, + FastSection staticPublicMembers(inner, "Static Public Members", QString(), "static public member", "static public members"); FastSection macros(inner, "Macros", QString(), "macro", "macros"); - NodeList::ConstIterator r = classNode->relatedNodes().constBegin(); - while (r != classNode->relatedNodes().constEnd()) { + NodeList::ConstIterator r = inner->relatedNodes().constBegin(); + while (r != inner->relatedNodes().constEnd()) { if ((*r)->type() == Node::Function) { FunctionNode *func = static_cast(*r); if (func->isMacro()) @@ -524,13 +522,13 @@ QList
CppCodeMarker::sections(const InnerNode *inner, ++r; } - QStack stack; - stack.push(classNode); + QStack stack; + stack.push(inner); while (!stack.isEmpty()) { - const ClassNode *ancestorClass = stack.pop(); + const InnerNode* ancestor = stack.pop(); - NodeList::ConstIterator c = ancestorClass->childNodes().constBegin(); - while (c != ancestorClass->childNodes().constEnd()) { + NodeList::ConstIterator c = ancestor->childNodes().constBegin(); + while (c != ancestor->childNodes().constEnd()) { bool isSlot = false; bool isSignal = false; bool isStatic = false; @@ -620,15 +618,16 @@ QList
CppCodeMarker::sections(const InnerNode *inner, ++c; } - QList::ConstIterator r = - ancestorClass->baseClasses().constBegin(); - while (r != ancestorClass->baseClasses().constEnd()) { - if ((*r).node_) - stack.prepend((*r).node_); - ++r; + if (ancestor->isClass()) { + const ClassNode* cn = static_cast(ancestor); + QList::ConstIterator r = cn->baseClasses().constBegin(); + while (r != cn->baseClasses().constEnd()) { + if ((*r).node_) + stack.prepend((*r).node_); + ++r; + } } } - append(sections, publicTypes); append(sections, properties); append(sections, publicFunctions); @@ -649,15 +648,15 @@ QList
CppCodeMarker::sections(const InnerNode *inner, append(sections, macros); } else if (style == Detailed) { - FastSection memberFunctions(classNode,"Member Function Documentation","func","member","members"); - FastSection memberTypes(classNode,"Member Type Documentation","types","member","members"); - FastSection memberVariables(classNode,"Member Variable Documentation","vars","member","members"); - FastSection properties(classNode,"Property Documentation","prop","member","members"); - FastSection relatedNonMembers(classNode,"Related Non-Members","relnonmem","member","members"); - FastSection macros(classNode,"Macro Documentation","macros","member","members"); - - NodeList::ConstIterator r = classNode->relatedNodes().constBegin(); - while (r != classNode->relatedNodes().constEnd()) { + FastSection memberFunctions(inner,"Member Function Documentation","func","member","members"); + FastSection memberTypes(inner,"Member Type Documentation","types","member","members"); + FastSection memberVariables(inner,"Member Variable Documentation","vars","member","members"); + FastSection properties(inner,"Property Documentation","prop","member","members"); + FastSection relatedNonMembers(inner,"Related Non-Members","relnonmem","member","members"); + FastSection macros(inner,"Macro Documentation","macros","member","members"); + + NodeList::ConstIterator r = inner->relatedNodes().constBegin(); + while (r != inner->relatedNodes().constEnd()) { if ((*r)->type() == Node::Function) { FunctionNode *func = static_cast(*r); if (func->isMacro()) @@ -671,8 +670,8 @@ QList
CppCodeMarker::sections(const InnerNode *inner, ++r; } - NodeList::ConstIterator c = classNode->childNodes().constBegin(); - while (c != classNode->childNodes().constEnd()) { + NodeList::ConstIterator c = inner->childNodes().constBegin(); + while (c != inner->childNodes().constEnd()) { if ((*c)->type() == Node::Enum || (*c)->type() == Node::Typedef) { insert(memberTypes, *c, style, status); @@ -700,28 +699,28 @@ QList
CppCodeMarker::sections(const InnerNode *inner, append(sections, macros); } else { - FastSection all(classNode,QString(),QString(),"member","members"); + FastSection all(inner,QString(),QString(),"member","members"); - QStack stack; - stack.push(classNode); + QStack stack; + stack.push(inner); while (!stack.isEmpty()) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().constBegin(); - while (c != ancestorClass->childNodes().constEnd()) { - if ((*c)->access() != Node::Private && - (*c)->type() != Node::Property) + const InnerNode* ancestor = stack.pop(); + NodeList::ConstIterator c = ancestor->childNodes().constBegin(); + while (c != ancestor->childNodes().constEnd()) { + if ((*c)->access() != Node::Private && (*c)->type() != Node::Property) insert(all, *c, style, status); ++c; } - QList::ConstIterator r = - ancestorClass->baseClasses().constBegin(); - while (r != ancestorClass->baseClasses().constEnd()) { - if ((*r).node_) - stack.prepend((*r).node_); - ++r; + if (ancestor->isClass()) { + const ClassNode* cn = static_cast(ancestor); + QList::ConstIterator r = cn->baseClasses().constBegin(); + while (r != cn->baseClasses().constEnd()) { + if ((*r).node_) + stack.prepend((*r).node_); + ++r; + } } } append(sections, all); -- cgit v1.2.3