diff options
author | Martin Smith <martin.smith@digia.com> | 2014-01-06 12:57:17 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-31 21:04:43 +0200 |
commit | e9954e31624c77d986077ec5431c7ec4a9b058e0 (patch) | |
tree | ce07acd32f8a03c07fa0f16cfc9ab186459c13fa /src/tools/qdoc/ditaxmlgenerator.cpp | |
parent | 4f50be8d1885e685ec8df3796e4156eb015affa7 (diff) |
qdoc: Teach qdoc to use multiple trees
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ƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/tools/qdoc/ditaxmlgenerator.cpp')
-rw-r--r-- | src/tools/qdoc/ditaxmlgenerator.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
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(); // </cxxClassDerivationAccessSpecifier> + ClassNode* bcn = (*r).node_; + if (bcn) { + writeStartTag(DT_cxxClassDerivation); + writeStartTag(DT_cxxClassDerivationAccessSpecifier); + xmlWriter().writeAttribute("value",(*r).accessString()); + writeEndTag(); // </cxxClassDerivationAccessSpecifier> - // not included: <cxxClassDerivationVirtual> + // not included: <cxxClassDerivationVirtual> - writeStartTag(DT_cxxClassBaseClass); - QString attr = fileName((*r).node) + QLatin1Char('#') + (*r).node->guid(); - xmlWriter().writeAttribute("href",attr); - writeCharacters((*r).node->plainFullName()); - writeEndTag(); // </cxxClassBaseClass> + writeStartTag(DT_cxxClassBaseClass); + QString attr = fileName(bcn) + QLatin1Char('#') + bcn->guid(); + xmlWriter().writeAttribute("href",attr); + writeCharacters(bcn->plainFullName()); + writeEndTag(); // </cxxClassBaseClass> - // not included: <ClassBaseStruct> or <cxxClassBaseUnion> + // not included: <ClassBaseStruct> or <cxxClassBaseUnion> - writeEndTag(); // </cxxClassDerivation> - - // not included: <cxxStructDerivation> + writeEndTag(); // </cxxClassDerivation> + // not included: <cxxStructDerivation> + } ++r; } writeEndTag(); // </cxxClassDerivations> @@ -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) |