From e9954e31624c77d986077ec5431c7ec4a9b058e0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jan 2014 12:57:17 +0100 Subject: qdoc: Teach qdoc to use multiple trees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qdoc now builds a separate Node Tree for each index file it parsed. The main Node Tree now contains only the Nodes of things being documented in the current module. This should make qdoc run a little faster. qdoc now uses these separate trees to make intra-module and inter-module linking more robust by searching the trees in an order that depends on the type of link it is searching for. The tree for the current module is always searched first. Then qdoc searches the trees for either the C++ modules or the QML modules, depending on whether it is looking for a C++ link or a QML link. In preparation for this update, qdoc was also simplified a lot. Many functions became obsolete and were removed. Others were combined. Task-number: QTBUG-35377 Change-Id: Iea4e49869ff6a6ff0f4d53090728770d40d892f3 Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/htmlgenerator.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/tools/qdoc/htmlgenerator.cpp') diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 641e59f018..ca52d98596 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -1923,18 +1923,20 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker) r = classe->baseClasses().constBegin(); index = 0; while (r != classe->baseClasses().constEnd()) { - text << Atom(Atom::LinkNode, CodeMarker::stringForNode((*r).node)) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << Atom(Atom::String, (*r).dataTypeWithTemplateArgs) - << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); - - if ((*r).access == Node::Protected) { - text << " (protected)"; - } - else if ((*r).access == Node::Private) { - text << " (private)"; + if ((*r).node_) { + text << Atom(Atom::LinkNode, CodeMarker::stringForNode((*r).node_)) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, (*r).signature_) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + + if ((*r).access_ == Node::Protected) { + text << " (protected)"; + } + else if ((*r).access_ == Node::Private) { + text << " (private)"; + } + text << separator(index++, classe->baseClasses().count()); } - text << separator(index++, classe->baseClasses().count()); ++r; } text << Atom::ParaRight; @@ -2448,8 +2450,8 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap& classM NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { - if (d.access != Node::Private && !d.node->doc().isEmpty()) - newTop.insert(d.node->name(), d.node); + if (d.node_ && (d.access_ != Node::Private && !d.node_->doc().isEmpty())) + newTop.insert(d.node_->name(), d.node_); } if (!newTop.isEmpty()) { stack.push(newTop); @@ -2786,7 +2788,7 @@ void HtmlGenerator::generateQmlItem(const Node *node, marked.remove("<@type>"); marked.remove(""); } - out() << highlightedCode(marked, relative, false, node); + out() << highlightedCode(marked, relative, false); } void HtmlGenerator::generateOverviewList(const Node *relative) @@ -3099,8 +3101,7 @@ void HtmlGenerator::generateSynopsis(const Node *node, QString HtmlGenerator::highlightedCode(const QString& markedCode, const Node* relative, - bool alignNames, - const Node* self) + bool alignNames) { QString src = markedCode; QString html; @@ -3174,7 +3175,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, bool handled = false; if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) { par1 = QStringRef(); - const Node* n = qdb_->resolveTarget(arg.toString(), relative, self); + const Node* n = qdb_->resolveTarget(arg.toString(), relative); html += QLatin1String(""); if (n && n->subType() == Node::QmlBasicType) { if (relative && relative->subType() == Node::QmlClass) @@ -3751,7 +3752,7 @@ QString HtmlGenerator::getLink(const Atom *atom, const Node *relative, const Nod node, which must be a direct child of the tree root. */ - *node = qdb_->treeRoot()->findChildNodeByNameAndType(first, Node::Document); + *node = qdb_->findNodeByNameAndType(QStringList(first), Node::Document, Node::NoSubType); } else { *node = qdb_->resolveTarget(first, relative); -- cgit v1.2.3