summaryrefslogtreecommitdiffstats
path: root/src/qdoc/qdoc/src/qdoc/tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qdoc/qdoc/src/qdoc/tree.cpp')
-rw-r--r--src/qdoc/qdoc/src/qdoc/tree.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/qdoc/qdoc/src/qdoc/tree.cpp b/src/qdoc/qdoc/src/qdoc/tree.cpp
index 18f836062..d1b518fd2 100644
--- a/src/qdoc/qdoc/src/qdoc/tree.cpp
+++ b/src/qdoc/qdoc/src/qdoc/tree.cpp
@@ -751,6 +751,12 @@ void Tree::insertTarget(const QString &name, const QString &title, TargetRec::Ta
}
/*!
+ \internal
+
+ \a root is the root node of the tree to resolve targets for. This function
+ traverses the tree starting from the root node and processes each child
+ node. If the child node is an aggregate node, this function is called
+ recursively on the child node.
*/
void Tree::resolveTargets(Aggregate *root)
{
@@ -758,20 +764,8 @@ void Tree::resolveTargets(Aggregate *root)
addToPageNodeByTitleMap(child);
populateTocSectionTargetMap(child);
addKeywordsToTargetMaps(child);
+ addTargetsToTargetMap(child);
- if (child->doc().hasTargets()) {
- const QList<Atom *> &targets = child->doc().targets();
- for (Atom *i : targets) {
- QString ref = refForAtom(i);
- QString title = i->string();
- if (!ref.isEmpty() && !title.isEmpty()) {
- QString key = Utilities::asAsciiPrintable(title);
- auto *target = new TargetRec(ref, TargetRec::Target, child, 2);
- m_nodesByTargetRef.insert(key, target);
- m_nodesByTargetTitle.insert(title, target);
- }
- }
- }
if (child->isAggregate())
resolveTargets(static_cast<Aggregate *>(child));
}
@@ -780,6 +774,27 @@ void Tree::resolveTargets(Aggregate *root)
/*!
\internal
+ Updates the target maps for targets associated with the given \a node.
+ */
+void Tree::addTargetsToTargetMap(Node *node) {
+ if (!node || !node->doc().hasTargets())
+ return;
+
+ for (Atom *i : std::as_const(node->doc().targets())) {
+ const QString ref = refForAtom(i);
+ const QString title = i->string();
+ if (!ref.isEmpty() && !title.isEmpty()) {
+ QString key = Utilities::asAsciiPrintable(title);
+ auto *target = new TargetRec(ref, TargetRec::Target, node, 2);
+ m_nodesByTargetRef.insert(key, target);
+ m_nodesByTargetTitle.insert(title, target);
+ }
+ }
+}
+
+/*!
+ \internal
+
Updates the target maps for keywords associated with the given \a node.
*/
void Tree::addKeywordsToTargetMaps(Node *node) {