From 9b0c0823c067eb0c072a6f35caec5cb31809a1b4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 30 Mar 2012 13:43:46 +0200 Subject: qdoc: Allow documenting a C++ class as a QML type. Now qdoc can handle the case where a C++ class is documented as a QML type of the same name, or as both a C++ class and a QML type of the same name. And collisions pages are created for both the HTML and the DITA XML output. A collision page is created when two items have the same name. The collision pages will be augmented later to include the list of pages where ambiguous links to one of the items listed on the collision page are actually located, so the writer can go back to those links and add the appropriate qualifier. Change-Id: I5a9632b2d2209e0784392047056bed8962005624 Reviewed-by: Martin Smith Reviewed-by: Casper van Donderen --- src/tools/qdoc/cppcodemarker.cpp | 57 ++++++++++++---------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) (limited to 'src/tools/qdoc/cppcodemarker.cpp') diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index 3e7d190fe43..aea8ed2119d 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -826,61 +826,38 @@ QList
CppCodeMarker::sections(const InnerNode *inner, return sections; } +/*! + Search the \a tree for a node named \a target + */ const Node *CppCodeMarker::resolveTarget(const QString& target, const Tree* tree, const Node* relative, const Node* self) { + const Node* node = 0; if (target.endsWith("()")) { - const FunctionNode *func; QString funcName = target; funcName.chop(2); - QStringList path = funcName.split("::"); - if ((func = tree->findFunctionNode(path, - relative, - Tree::SearchBaseClasses)) - && func->metaness() != FunctionNode::MacroWithoutParams) - return func; + const FunctionNode* fn = tree->findFunctionNode(path, relative, Tree::SearchBaseClasses); + if (fn) { + /* + Why is this case not accepted? + */ + if (fn->metaness() != FunctionNode::MacroWithoutParams) + node = fn; + } } else if (target.contains(QLatin1Char('#'))) { - // ### this doesn't belong here; get rid of TargetNode hack - int hashAt = target.indexOf(QLatin1Char('#')); - QString link = target.left(hashAt); - QString ref = target.mid(hashAt + 1); - const Node *node; - if (link.isEmpty()) { - node = relative; - } - else { - QStringList path(link); - node = tree->findNode(path, tree->root(), Tree::SearchBaseClasses); - } - if (node && node->isInnerNode()) { - const Atom *atom = node->doc().body().firstAtom(); - while (atom) { - if (atom->type() == Atom::Target && atom->string() == ref) { - Node *parentNode = const_cast(node); - return new TargetNode(static_cast(parentNode), - ref); - } - atom = atom->next(); - } - } + // This error message is never printed; I think we can remove the case. + qDebug() << "qdoc: target case not handled:" << target; } else { QStringList path = target.split("::"); - const Node *node; - int flags = Tree::SearchBaseClasses | - Tree::SearchEnumValues | - Tree::NonFunction; - if ((node = tree->findNode(path, - relative, - flags, - self))) - return node; + int flags = Tree::SearchBaseClasses | Tree::SearchEnumValues | Tree::NonFunction; + node = tree->findNode(path, relative, flags, self); } - return 0; + return node; } static const char * const typeTable[] = { -- cgit v1.2.3