diff options
Diffstat (limited to 'src/qdoc/tree.cpp')
-rw-r--r-- | src/qdoc/tree.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp index 0354386ee..9669f3991 100644 --- a/src/qdoc/tree.cpp +++ b/src/qdoc/tree.cpp @@ -1523,4 +1523,53 @@ TargetList* Tree::getTargetList(const QString& module) return targetListMap_->value(module); } +/*! + Search this tree recursively from \a parent to find a function + node with the specified \a tag. If no function node is found + with the required \a tag, return 0. + */ +Node* Tree::findFunctionNodeForTag(const QString &tag, Aggregate* parent) +{ + if (!parent) + parent = root(); + const NodeList& children = parent->childNodes(); + for (Node *n : children) { + if (n && n->isFunction() && n->hasTag(tag)) + return n; + } + for (Node *n : children) { + if (n && n->isAggregate()) { + Aggregate* a = static_cast<Aggregate*>(n); + n = findFunctionNodeForTag(tag, a); + if (n) + return n; + } + } + return 0; +} + +/*! + There should only be one macro node for macro name \a t. + The macro node is not built until the \macro command is seen. + */ +Node *Tree::findMacroNode(const QString &t, const Aggregate *parent) +{ + if (!parent) + parent = root(); + const NodeList &children = parent->childNodes(); + for (Node *n : children) { + if (n && (n->isMacro() || n->isFunction()) && n->name() == t) + return n; + } + for (Node *n : children) { + if (n && n->isAggregate()) { + Aggregate *a = static_cast<Aggregate*>(n); + n = findMacroNode(t, a); + if (n) + return n; + } + } + return 0; +} + QT_END_NAMESPACE |