tools/qdoc3/tree.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   123     delete priv;
   123     delete priv;
   124 }
   124 }
   125 
   125 
   126 /*!
   126 /*!
   127  */
   127  */
   128 Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags)
   128 Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags, const Node* self)
   129 {
   129 {
   130     return const_cast<Node*>(const_cast<const Tree*>(this)->findNode(path,
   130     return const_cast<Node*>(const_cast<const Tree*>(this)->findNode(path,
   131                                                                      relative,
   131                                                                      relative,
   132                                                                      findFlags));
   132                                                                      findFlags,
   133 }
   133                                                                      self));
   134 
   134 }
   135 /*!
   135 
   136  */
   136 /*!
   137 const Node *Tree::findNode(const QStringList &path,
   137  */
   138                            const Node *relative,
   138 const Node* Tree::findNode(const QStringList &path,
   139                            int findFlags) const
   139                            const Node* start,
   140 {
   140                            int findFlags,
   141     if (!relative)
   141                            const Node* self) const
   142         relative = root();
   142 {
       
   143     const Node* current = start;
       
   144     if (!current)
       
   145         current = root();
   143 
   146 
   144     do {
   147     do {
   145         const Node *node = relative;
   148         const Node *node = current;
   146         int i;
   149         int i;
   147 
   150 
   148         for (i = 0; i < path.size(); ++i) {
   151         for (i = 0; i < path.size(); ++i) {
   149             if (node == 0 || !node->isInnerNode())
   152             if (node == 0 || !node->isInnerNode())
   150                 break;
   153                 break;
   168             }
   171             }
   169             node = next;
   172             node = next;
   170         }
   173         }
   171         if (node && i == path.size()
   174         if (node && i == path.size()
   172                 && (!(findFlags & NonFunction) || node->type() != Node::Function
   175                 && (!(findFlags & NonFunction) || node->type() != Node::Function
   173                     || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams))
   176                     || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) {
   174             return node;
   177             if ((node != self) && (node->subType() != Node::QmlPropertyGroup)) {
   175         relative = relative->parent();
   178                 return node;
   176     } while (relative);
   179             }
       
   180         }
       
   181         current = current->parent();
       
   182     } while (current);
   177 
   183 
   178     return 0;
   184     return 0;
   179 }
   185 }
   180 
   186 
   181 /*!
   187 /*!
   461         rootNode = root();
   467         rootNode = root();
   462 
   468 
   463     for (int pass = 0; pass < 2; pass++) {
   469     for (int pass = 0; pass < 2; pass++) {
   464         NodeList::ConstIterator c = rootNode->childNodes().begin();
   470         NodeList::ConstIterator c = rootNode->childNodes().begin();
   465         while (c != rootNode->childNodes().end()) {
   471         while (c != rootNode->childNodes().end()) {
   466             if ((*c)->type() == Node::Class)
   472             if ((*c)->type() == Node::Class) {
   467                 resolveInheritance(pass, (ClassNode *) *c);
   473                 resolveInheritance(pass, (ClassNode *) *c);
       
   474             }
   468             else if ((*c)->type() == Node::Namespace) {
   475             else if ((*c)->type() == Node::Namespace) {
   469                 NamespaceNode *ns = static_cast<NamespaceNode*>(*c);
   476                 NamespaceNode *ns = static_cast<NamespaceNode*>(*c);
   470                 resolveInheritance(ns);
   477                 resolveInheritance(ns);
   471             }
   478             }
   472             ++c;
   479             ++c;
   534 	QList<InheritanceBound> bounds = priv->unresolvedInheritanceMap[classe];
   541 	QList<InheritanceBound> bounds = priv->unresolvedInheritanceMap[classe];
   535 	QList<InheritanceBound>::ConstIterator b = bounds.begin();
   542 	QList<InheritanceBound>::ConstIterator b = bounds.begin();
   536 	while (b != bounds.end()) {
   543 	while (b != bounds.end()) {
   537 	    ClassNode *baseClass = (ClassNode*)findNode((*b).basePath,
   544 	    ClassNode *baseClass = (ClassNode*)findNode((*b).basePath,
   538                                                         Node::Class);
   545                                                         Node::Class);
   539             if (!baseClass && (*b).parent)
   546             if (!baseClass && (*b).parent) {
   540                 baseClass = (ClassNode*)findNode((*b).basePath,
   547                 baseClass = (ClassNode*)findNode((*b).basePath,
   541                                                  Node::Class,
   548                                                  Node::Class,
   542                                                  (*b).parent);
   549                                                  (*b).parent);
   543 	    if (baseClass)
   550             }
       
   551 	    if (baseClass) {
   544 		classe->addBaseClass((*b).access,
   552 		classe->addBaseClass((*b).access,
   545                                      baseClass,
   553                                      baseClass,
   546                                      (*b).dataTypeWithTemplateArgs);
   554                                      (*b).dataTypeWithTemplateArgs);
       
   555             }
   547 	    ++b;
   556 	    ++b;
   548 	}
   557 	}
   549     }
   558     }
   550     else {
   559     else {
   551 	NodeList::ConstIterator c = classe->childNodes().begin();
   560 	NodeList::ConstIterator c = classe->childNodes().begin();
  1950             return "";
  1959             return "";
  1951     }
  1960     }
  1952     else if (node->type() == Node::Fake) {
  1961     else if (node->type() == Node::Fake) {
  1953 #ifdef QDOC_QML
  1962 #ifdef QDOC_QML
  1954         if ((node->subType() == Node::QmlClass) ||
  1963         if ((node->subType() == Node::QmlClass) ||
  1955             (node->subType() == Node::QmlBasicType))
  1964             (node->subType() == Node::QmlBasicType)) {
  1956             return "qml-" + node->fileBase() + ".html";
  1965             QString fb = node->fileBase();
  1957         else
  1966             if (fb.startsWith(QLatin1String("QML:")))
       
  1967                 return node->fileBase() + ".html";
       
  1968             else
       
  1969                 return "qml-" + node->fileBase() + ".html";
       
  1970         } else
  1958 #endif
  1971 #endif
  1959         parentName = node->fileBase() + ".html";
  1972         parentName = node->fileBase() + ".html";
  1960     }
  1973     }
  1961     else if (node->fileBase().isEmpty())
  1974     else if (node->fileBase().isEmpty())
  1962         return "";
  1975         return "";