diff options
Diffstat (limited to 'src/tools/qdoc/tree.cpp')
-rw-r--r-- | src/tools/qdoc/tree.cpp | 92 |
1 files changed, 48 insertions, 44 deletions
diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index 1b0aba1a0c..d64903e61e 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -181,9 +181,9 @@ FunctionNode* Tree::findFunctionNode(const QStringList& parentPath, const Functi parent = findClassNode(parentPath, 0); if (parent == 0) parent = findNode(parentPath, 0, 0, Node::DontCare); - if (parent == 0 || !parent->isInnerNode()) + if (parent == 0 || !parent->isAggregate()) return 0; - return ((const InnerNode*)parent)->findFunctionNode(clone); + return ((const Aggregate*)parent)->findFunctionNode(clone); } @@ -220,6 +220,7 @@ QmlTypeNode* Tree::findQmlTypeNode(const QStringList& path) used as the starting point. */ const FunctionNode* Tree::findFunctionNode(const QStringList& path, + const QString& params, const Node* relative, int findFlags, Node::Genus genus) const @@ -234,7 +235,7 @@ const FunctionNode* Tree::findFunctionNode(const QStringList& path, qcn = static_cast<QmlTypeNode*>(n); } if (qcn) - return static_cast<const FunctionNode*>(qcn->findFunctionNode(path[2])); + return static_cast<const FunctionNode*>(qcn->findFunctionNode(path[2], params)); } if (!relative) @@ -249,22 +250,22 @@ const FunctionNode* Tree::findFunctionNode(const QStringList& path, int i; for (i = 0; i < path.size(); ++i) { - if (node == 0 || !node->isInnerNode()) + if (node == 0 || !node->isAggregate()) break; const Node* next; if (i == path.size() - 1) - next = ((const InnerNode*) node)->findFunctionNode(path.at(i)); + next = ((const Aggregate*) node)->findFunctionNode(path.at(i), params); else - next = ((const InnerNode*) node)->findChildNode(path.at(i), genus); + next = ((const Aggregate*) node)->findChildNode(path.at(i), genus); if (!next && node->isClass() && (findFlags & SearchBaseClasses)) { NodeList baseClasses = allBaseClasses(static_cast<const ClassNode*>(node)); foreach (const Node* baseClass, baseClasses) { if (i == path.size() - 1) - next = static_cast<const InnerNode*>(baseClass)->findFunctionNode(path.at(i)); + next = static_cast<const Aggregate*>(baseClass)->findFunctionNode(path.at(i), params); else - next = static_cast<const InnerNode*>(baseClass)->findChildNode(path.at(i), genus); + next = static_cast<const Aggregate*>(baseClass)->findChildNode(path.at(i), genus); if (next) break; @@ -301,8 +302,8 @@ static const NodeTypeList& relatesTypes() { if (t.isEmpty()) { t.reserve(3); - t.append(NodeTypePair(Node::Class, Node::NoSubType)); - t.append(NodeTypePair(Node::Namespace, Node::NoSubType)); + t.append(NodeTypePair(Node::Class, Node::NoSubtype)); + t.append(NodeTypePair(Node::Namespace, Node::NoSubtype)); t.append(NodeTypePair(Node::Document, Node::HeaderFile)); } return t; @@ -320,13 +321,15 @@ static const NodeTypeList& relatesTypes() If a matching node is found, a pointer to it is returned. Otherwise 0 is returned. */ -InnerNode* Tree::findRelatesNode(const QStringList& path) +Aggregate* Tree::findRelatesNode(const QStringList& path) { Node* n = findNodeRecursive(path, 0, root(), relatesTypes()); - return ((n && n->isInnerNode()) ? static_cast<InnerNode*>(n) : 0); + return ((n && n->isAggregate()) ? static_cast<Aggregate*>(n) : 0); } /*! + Inserts function name \a funcName and function role \a funcRole into + the property function map for the specified \a property. */ void Tree::addPropertyFunction(PropertyNode* property, const QString& funcName, @@ -344,7 +347,7 @@ void Tree::addPropertyFunction(PropertyNode* property, This function does not resolve QML inheritance. */ -void Tree::resolveInheritance(InnerNode* n) +void Tree::resolveInheritance(Aggregate* n) { if (!n) n = root(); @@ -399,7 +402,7 @@ void Tree::resolveInheritanceHelper(int pass, ClassNode* cn) node) using the unqualified base class name. */ if (!n) { - InnerNode* parent = cn->parent(); + Aggregate* parent = cn->parent(); if (parent) // Exclude the root namespace if (parent->isNamespace() && !parent->name().isEmpty()) @@ -422,7 +425,7 @@ void Tree::resolveInheritanceHelper(int pass, ClassNode* cn) FunctionNode* from = findVirtualFunctionInBaseClasses(cn, func); if (from != 0) { if (func->virtualness() == FunctionNode::NonVirtual) - func->setVirtualness(FunctionNode::ImpureVirtual); + func->setVirtualness(FunctionNode::NormalVirtual); func->setReimplementedFrom(from); } } @@ -442,7 +445,7 @@ void Tree::resolveProperties() propEntry = unresolvedPropertyMap.constBegin(); while (propEntry != unresolvedPropertyMap.constEnd()) { PropertyNode* property = propEntry.key(); - InnerNode* parent = property->parent(); + Aggregate* parent = property->parent(); QString getterName = (*propEntry)[PropertyNode::Getter]; QString setterName = (*propEntry)[PropertyNode::Setter]; QString resetterName = (*propEntry)[PropertyNode::Resetter]; @@ -587,7 +590,7 @@ NodeList Tree::allBaseClasses(const ClassNode* classNode) const search at the tree root. \a subtype is not used unless \a type is \c{Document}. */ -Node* Tree::findNodeByNameAndType(const QStringList& path, Node::Type type) const +Node* Tree::findNodeByNameAndType(const QStringList& path, Node::NodeType type) const { return findNodeRecursive(path, 0, root(), type); } @@ -611,7 +614,7 @@ Node* Tree::findNodeByNameAndType(const QStringList& path, Node::Type type) cons Node* Tree::findNodeRecursive(const QStringList& path, int pathIndex, const Node* start, - Node::Type type) const + Node::NodeType type) const { if (!start || path.isEmpty()) return 0; // no place to start, or nothing to search for. @@ -622,7 +625,7 @@ Node* Tree::findNodeRecursive(const QStringList& path, return 0; // premature leaf } - InnerNode* current = static_cast<InnerNode*>(node); + Aggregate* current = static_cast<Aggregate*>(node); const NodeList& children = current->childNodes(); const QString& name = path.at(pathIndex); for (int i=0; i<children.size(); ++i) { @@ -678,7 +681,7 @@ Node* Tree::findNodeRecursive(const QStringList& path, if (pathIndex >= path.size()) return 0; - InnerNode* current = static_cast<InnerNode*>(start); + Aggregate* current = static_cast<Aggregate*>(start); const NodeList& children = current->childNodes(); for (int i=0; i<children.size(); ++i) { Node* n = children.at(i); @@ -778,7 +781,7 @@ const Node* Tree::findNodeForTarget(const QStringList& path, } while (current) { - if (current->isInnerNode()) { + if (current->isAggregate()) { const Node* node = matchPathAndTarget(path, path_idx, target, current, flags, genus, ref); if (node) return node; @@ -848,8 +851,8 @@ const Node* Tree::matchPathAndTarget(const QStringList& path, return t; } if (target.isEmpty()) { - if ((idx) == (path.size()-1) && node->isInnerNode() && (flags & SearchEnumValues)) { - t = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(idx)); + if ((idx) == (path.size()-1) && node->isAggregate() && (flags & SearchEnumValues)) { + t = static_cast<const Aggregate*>(node)->findEnumNodeForValue(path.at(idx)); if (t) return t; } @@ -863,7 +866,7 @@ const Node* Tree::matchPathAndTarget(const QStringList& path, return t; if (target.isEmpty()) { if ((idx) == (path.size()-1) && (flags & SearchEnumValues)) { - t = static_cast<const InnerNode*>(bc)->findEnumNodeForValue(path.at(idx)); + t = static_cast<const Aggregate*>(bc)->findEnumNodeForValue(path.at(idx)); if (t) return t; } @@ -915,20 +918,20 @@ const Node* Tree::findNode(const QStringList& path, } for (i = start_idx; i < path.size(); ++i) { - if (node == 0 || !node->isInnerNode()) + if (node == 0 || !node->isAggregate()) break; - const Node* next = static_cast<const InnerNode*>(node)->findChildNode(path.at(i), genus); + const Node* next = static_cast<const Aggregate*>(node)->findChildNode(path.at(i), genus); if (!next && (findFlags & SearchEnumValues) && i == path.size()-1) { - next = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(i)); + next = static_cast<const Aggregate*>(node)->findEnumNodeForValue(path.at(i)); } if (!next && ((genus == Node::CPP) || (genus == Node::DontCare)) && node->isClass() && (findFlags & SearchBaseClasses)) { NodeList baseClasses = allBaseClasses(static_cast<const ClassNode*>(node)); foreach (const Node* baseClass, baseClasses) { - next = static_cast<const InnerNode*>(baseClass)->findChildNode(path.at(i), genus); + next = static_cast<const Aggregate*>(baseClass)->findChildNode(path.at(i), genus); if (!next && (findFlags & SearchEnumValues) && i == path.size() - 1) - next = static_cast<const InnerNode*>(baseClass)->findEnumNodeForValue(path.at(i)); + next = static_cast<const Aggregate*>(baseClass)->findEnumNodeForValue(path.at(i)); if (next) { break; } @@ -980,7 +983,7 @@ QString Tree::getRef(const QString& target, const Node* node) const */ void Tree::insertTarget(const QString& name, const QString& title, - TargetRec::Type type, + TargetRec::TargetType type, Node* node, int priority) { @@ -991,9 +994,8 @@ void Tree::insertTarget(const QString& name, /*! */ -void Tree::resolveTargets(InnerNode* root) +void Tree::resolveTargets(Aggregate* root) { - // need recursion foreach (Node* child, root->childNodes()) { if (child->type() == Node::Document) { DocumentNode* node = static_cast<DocumentNode*>(child); @@ -1005,7 +1007,7 @@ void Tree::resolveTargets(InnerNode* root) bool alreadyThere = false; if (!nodes.empty()) { for (int i=0; i< nodes.size(); ++i) { - if (nodes[i]->subType() == Node::ExternalPage) { + if (nodes[i]->docSubtype() == Node::ExternalPage) { if (node->name() == nodes[i]->name()) { alreadyThere = true; break; @@ -1037,9 +1039,8 @@ void Tree::resolveTargets(InnerNode* root) QString ref = refForAtom(keywords.at(i)); QString title = keywords.at(i)->string(); if (!ref.isEmpty() && !title.isEmpty()) { - QString key = Doc::canonicalTitle(title); TargetRec* target = new TargetRec(ref, title, TargetRec::Keyword, child, 1); - nodesByTargetRef_.insert(key, target); + nodesByTargetRef_.insert(Doc::canonicalTitle(title), target); nodesByTargetTitle_.insert(title, target); } } @@ -1057,6 +1058,8 @@ void Tree::resolveTargets(InnerNode* root) } } } + if (child->isAggregate()) + resolveTargets(static_cast<Aggregate*>(child)); } } @@ -1140,18 +1143,15 @@ const DocumentNode* Tree::findDocumentNodeByTitle(const QString& title) const DocumentNodeMultiMap::const_iterator j = i; ++j; if (j != docNodesByTitle_.constEnd() && j.key() == i.key()) { - QList<Location> internalLocations; while (j != docNodesByTitle_.constEnd()) { if (j.key() == i.key() && j.value()->url().isEmpty()) { - internalLocations.append(j.value()->location()); break; // Just report one duplicate for now. } ++j; } - if (internalLocations.size() > 0) { + if (j != docNodesByTitle_.cend()) { i.value()->location().warning("This page title exists in more than one file: " + title); - foreach (const Location &location, internalLocations) - location.warning("[It also exists here]"); + j.value()->location().warning("[It also exists here]"); } } return i.value(); @@ -1252,7 +1252,7 @@ CollectionNode* Tree::findCollection(const QString& name, Node::Genus genus) CNMap::const_iterator i = m->constFind(name); if (i != m->cend()) return i.value(); - Node::Type t = Node::NoType; + Node::NodeType t = Node::NoType; switch (genus) { case Node::DOC: t = Node::Group; @@ -1453,13 +1453,17 @@ void Tree::insertQmlType(const QString& key, QmlTypeNode* n) Split \a target on "::" and find the function node with that path. */ -const Node* Tree::findFunctionNode(const QString& target, const Node* relative, Node::Genus genus) +const Node* Tree::findFunctionNode(const QString& target, + const QString& params, + const Node* relative, + Node::Genus genus) const { QString t = target; - if (t.endsWith("()")) + if (t.endsWith("()")) { t.chop(2); + } QStringList path = t.split("::"); - const FunctionNode* fn = findFunctionNode(path, relative, SearchBaseClasses, genus); + const FunctionNode* fn = findFunctionNode(path, params, relative, SearchBaseClasses, genus); if (fn && fn->metaness() != FunctionNode::MacroWithoutParams) return fn; return 0; |