diff options
author | Martin Smith <martin.smith@theqtcompany.com> | 2016-03-03 14:40:57 +0100 |
---|---|---|
committer | Jake Petroules <jake.petroules@theqtcompany.com> | 2016-03-04 22:42:20 +0000 |
commit | 2d07f5db4273d4aea7b9f9d924fdd84ce992052d (patch) | |
tree | ce4eb9171143ea047b495cadf891b9b9121894c9 | |
parent | 2d02c495f2f8b5b9f944545d3d28f2660fbb4582 (diff) | |
download | qttools-2d07f5db4273d4aea7b9f9d924fdd84ce992052d.tar.gz |
qdoc: Fix link disambiguation
The link command allows a qualifier in square brackets,
which tells qdoc the specific kind of page that must be
found to satisfy the link. The square bracket parameter
was being ignored in one case, because it wasn't being
passed to a certain search function. This update passes
that parameter to the search function, and the search
function uses it to disqualify pages that should not be
accepted.
This fix causes qdoc to add 4 new qdoc errors when
generating the docs for my Qt5 installation. I don't
know what these are, but I suspect they are real errors
that qdoc was not reporting because the square bracket
parameter was being ignored in this case.
Change-Id: I45f1fd43039df7bb048711fc5b752a71a006e5de
Task-number: QTBUG-51587
Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com>
-rw-r--r-- | src/qdoc/tree.cpp | 42 | ||||
-rw-r--r-- | src/qdoc/tree.h | 3 |
2 files changed, 26 insertions, 19 deletions
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp index c3360e379..39d838333 100644 --- a/src/qdoc/tree.cpp +++ b/src/qdoc/tree.cpp @@ -734,7 +734,7 @@ const Node* Tree::findNodeForTarget(const QStringList& path, } } - node = findUnambiguousTarget(path.join(QStringLiteral("::")), ref); + node = findUnambiguousTarget(path.join(QStringLiteral("::")), genus, ref); if (node) { if (!target.isEmpty()) { ref = getRef(target, node); @@ -1065,7 +1065,7 @@ void Tree::resolveTargets(Aggregate* root) finds one, it sets \a ref and returns the found node. */ const Node* -Tree::findUnambiguousTarget(const QString& target, QString& ref) const +Tree::findUnambiguousTarget(const QString& target, Node::Genus genus, QString& ref) const { int numBestTargets = 0; TargetRec* bestTarget = 0; @@ -1077,14 +1077,17 @@ Tree::findUnambiguousTarget(const QString& target, QString& ref) const if (i.key() != key) break; TargetRec* candidate = i.value(); - if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) { - bestTarget = candidate; - bestTargetList.clear(); - bestTargetList.append(candidate); - numBestTargets = 1; - } else if (candidate->priority_ == bestTarget->priority_) { - bestTargetList.append(candidate); - ++numBestTargets; + if ((genus == Node::DontCare) || (genus == candidate->genus())) { + if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) { + bestTarget = candidate; + bestTargetList.clear(); + bestTargetList.append(candidate); + numBestTargets = 1; + } + else if (candidate->priority_ == bestTarget->priority_) { + bestTargetList.append(candidate); + ++numBestTargets; + } } ++i; } @@ -1101,14 +1104,17 @@ Tree::findUnambiguousTarget(const QString& target, QString& ref) const if (i.key() != key) break; TargetRec* candidate = i.value(); - if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) { - bestTarget = candidate; - bestTargetList.clear(); - bestTargetList.append(candidate); - numBestTargets = 1; - } else if (candidate->priority_ == bestTarget->priority_) { - bestTargetList.append(candidate); - ++numBestTargets; + if ((genus == Node::DontCare) || (genus == candidate->genus())) { + if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) { + bestTarget = candidate; + bestTargetList.clear(); + bestTargetList.append(candidate); + numBestTargets = 1; + } + else if (candidate->priority_ == bestTarget->priority_) { + bestTargetList.append(candidate); + ++numBestTargets; + } } ++i; } diff --git a/src/qdoc/tree.h b/src/qdoc/tree.h index 35a169a42..1c6ebcf41 100644 --- a/src/qdoc/tree.h +++ b/src/qdoc/tree.h @@ -64,6 +64,7 @@ struct TargetRec } bool isEmpty() const { return ref_.isEmpty(); } + Node::Genus genus() { return (node_ ? node_->genus() : Node::DontCare); } Node* node_; QString ref_; @@ -151,7 +152,7 @@ class Tree Node* node, int priority); void resolveTargets(Aggregate* root); - const Node* findUnambiguousTarget(const QString& target, QString& ref) const; + const Node* findUnambiguousTarget(const QString& target, Node::Genus genus, QString& ref) const; const DocumentNode* findDocumentNodeByTitle(const QString& title) const; void addPropertyFunction(PropertyNode *property, |