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/ditaxmlgenerator.cpp | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/tools/qdoc/ditaxmlgenerator.cpp') diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index e3b9bdd264..c4f08e45df 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -2696,8 +2696,8 @@ void DitaXmlGenerator::generateClassHierarchy(const Node* relative, NodeMap& cla 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); @@ -3858,7 +3858,7 @@ QString DitaXmlGenerator::getLink(const Atom* atom, const Node* relative, const *node = relative; } else if (first.endsWith(".html")) { - *node = qdb_->treeRoot()->findChildNodeByNameAndType(first, Node::Document); + *node = qdb_->findNodeByNameAndType(QStringList(first), Node::Document, Node::NoSubType); } else { *node = qdb_->resolveTarget(first, relative); @@ -4365,25 +4365,27 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn) writeStartTag(DT_cxxClassDerivations); r = cn->baseClasses().constBegin(); while (r != cn->baseClasses().constEnd()) { - writeStartTag(DT_cxxClassDerivation); - writeStartTag(DT_cxxClassDerivationAccessSpecifier); - xmlWriter().writeAttribute("value",(*r).accessString()); - writeEndTag(); // + ClassNode* bcn = (*r).node_; + if (bcn) { + writeStartTag(DT_cxxClassDerivation); + writeStartTag(DT_cxxClassDerivationAccessSpecifier); + xmlWriter().writeAttribute("value",(*r).accessString()); + writeEndTag(); // - // not included: + // not included: - writeStartTag(DT_cxxClassBaseClass); - QString attr = fileName((*r).node) + QLatin1Char('#') + (*r).node->guid(); - xmlWriter().writeAttribute("href",attr); - writeCharacters((*r).node->plainFullName()); - writeEndTag(); // + writeStartTag(DT_cxxClassBaseClass); + QString attr = fileName(bcn) + QLatin1Char('#') + bcn->guid(); + xmlWriter().writeAttribute("href",attr); + writeCharacters(bcn->plainFullName()); + writeEndTag(); // - // not included: or + // not included: or - writeEndTag(); // - - // not included: + writeEndTag(); // + // not included: + } ++r; } writeEndTag(); // @@ -4623,7 +4625,7 @@ void DitaXmlGenerator::replaceTypesWithLinks(const Node* n, const InnerNode* par } i += 2; if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) { - const Node* tn = qdb_->resolveTarget(arg.toString(), parent, n); + const Node* tn = qdb_->resolveTarget(arg.toString(), parent); if (tn) { //Do not generate a link from a C++ function to a QML Basic Type (such as int) if (n->type() == Node::Function && tn->subType() == Node::QmlBasicType) -- cgit v1.2.3