Changeset 846 for trunk/tools/qdoc3/tree.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/tools/qdoc3/tree.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 44 44 */ 45 45 46 #include <QtCore>47 46 #include <QDomDocument> 48 47 … … 54 53 #include "text.h" 55 54 #include "tree.h" 55 56 57 56 58 57 59 QT_BEGIN_NAMESPACE … … 124 126 /*! 125 127 */ 126 Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags )128 Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags) 127 129 { 128 130 return const_cast<Node*>(const_cast<const Tree*>(this)->findNode(path, 129 131 relative, 130 findFlags)); 131 } 132 133 /*! 134 */ 135 const Node *Tree::findNode(const QStringList &path, 136 const Node *relative, 137 int findFlags) const 138 { 139 if (!relative) 140 relative = root(); 132 findFlags, 133 self)); 134 } 135 136 /*! 137 */ 138 const Node* Tree::findNode(const QStringList &path, 139 const Node* start, 140 int findFlags, 141 const Node* self) const 142 { 143 const Node* current = start; 144 if (!current) 145 current = root(); 141 146 142 147 do { 143 const Node *node = relative;148 const Node *node = ; 144 149 int i; 145 150 … … 150 155 const Node *next = 151 156 static_cast<const InnerNode*>(node)->findNode(path.at(i)); 157 152 158 if (!next && (findFlags & SearchEnumValues) && i == path.size()-1) 153 159 next = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(i)); … … 168 174 if (node && i == path.size() 169 175 && (!(findFlags & NonFunction) || node->type() != Node::Function 170 || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) 171 return node; 172 relative = relative->parent(); 173 } while (relative); 176 || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) { 177 if ((node != self) && (node->subType() != Node::QmlPropertyGroup)) { 178 return node; 179 } 180 } 181 current = current->parent(); 182 } while (current); 174 183 175 184 return 0; … … 461 470 NodeList::ConstIterator c = rootNode->childNodes().begin(); 462 471 while (c != rootNode->childNodes().end()) { 463 if ((*c)->type() == Node::Class) 472 if ((*c)->type() == Node::Class) 464 473 resolveInheritance(pass, (ClassNode *) *c); 474 465 475 else if ((*c)->type() == Node::Namespace) { 466 476 NamespaceNode *ns = static_cast<NamespaceNode*>(*c); … … 534 544 ClassNode *baseClass = (ClassNode*)findNode((*b).basePath, 535 545 Node::Class); 536 if (!baseClass && (*b).parent) 546 if (!baseClass && (*b).parent) 537 547 baseClass = (ClassNode*)findNode((*b).basePath, 538 548 Node::Class, 539 549 (*b).parent); 540 if (baseClass) 550 } 551 if (baseClass) { 541 552 classe->addBaseClass((*b).access, 542 553 baseClass, 543 554 (*b).dataTypeWithTemplateArgs); 555 544 556 ++b; 545 557 } … … 1119 1131 nodeName = "target"; 1120 1132 break; 1133 1134 1135 1136 1137 1138 1139 1140 1141 1121 1142 default: 1122 1143 return false; … … 1208 1229 writer.writeAttribute("fullname", fullName); 1209 1230 writer.writeAttribute("href", fullDocumentLocation(node)); 1210 if ( node->type() != Node::Fake)1231 if () 1211 1232 writer.writeAttribute("location", node->location().fileName()); 1212 1233 … … 1262 1283 case Node::ExternalPage: 1263 1284 writer.writeAttribute("subtype", "externalpage"); 1285 1286 1287 1288 1289 1290 1264 1291 break; 1265 1292 default: … … 1335 1362 break; 1336 1363 1364 1365 1366 1367 1368 1369 1337 1370 case Node::Property: 1338 1371 { … … 1522 1555 const InnerNode *inner = static_cast<const InnerNode *>(node); 1523 1556 1524 // Recurse to write an element for this child node and all its children. 1525 foreach (const Node *child, inner->childNodes()) 1526 generateIndexSections(writer, child, generateInternalNodes); 1557 foreach (const Node *child, inner->childNodes()) { 1558 /* 1559 Don't generate anything for a QML property group node. 1560 It is just a place holder for a collection of QML property 1561 nodes. Recurse to its children, which are the QML property 1562 nodes. 1563 */ 1564 if (child->subType() == Node::QmlPropertyGroup) { 1565 const InnerNode *pgn = static_cast<const InnerNode*>(child); 1566 foreach (const Node *c, pgn->childNodes()) { 1567 generateIndexSections(writer, c, generateInternalNodes); 1568 } 1569 } 1570 else 1571 generateIndexSections(writer, child, generateInternalNodes); 1572 } 1527 1573 1528 1574 /* … … 1915 1961 else if (node->type() == Node::Fake) { 1916 1962 #ifdef QDOC_QML 1917 if (node->subType() == Node::QmlClass) 1918 return "qml-" + node->fileBase() + ".html"; 1919 else 1963 if ((node->subType() == Node::QmlClass) || 1964 (node->subType() == Node::QmlBasicType)) { 1965 QString fb = node->fileBase(); 1966 if (fb.startsWith(QLatin1String("qml-"))) 1967 return fb + ".html"; 1968 else 1969 return "qml-" + node->fileBase() + ".html"; 1970 } else 1920 1971 #endif 1921 1972 parentName = node->fileBase() + ".html"; … … 1928 1979 if ((parentNode = node->relates())) 1929 1980 parentName = fullDocumentLocation(node->relates()); 1930 else if ((parentNode = node->parent())) 1931 parentName = fullDocumentLocation(node->parent()); 1932 1981 else if ((parentNode = node->parent())) { 1982 if (parentNode->subType() == Node::QmlPropertyGroup) { 1983 parentNode = parentNode->parent(); 1984 parentName = fullDocumentLocation(parentNode); 1985 } 1986 else 1987 parentName = fullDocumentLocation(node->parent()); 1988 } 1989 #if 0 1990 if (node->type() == Node::QmlProperty) { 1991 qDebug() << "Node::QmlProperty:" << node->name() 1992 << "parentName:" << parentName; 1993 if (parentNode) 1994 qDebug() << "PARENT NODE" << parentNode->type() 1995 << parentNode->subType() << parentNode->name(); 1996 } 1997 #endif 1933 1998 switch (node->type()) { 1934 1999 case Node::Class: … … 1976 2041 case Node::Property: 1977 2042 anchorRef = "#" + node->name() + "-prop"; 2043 2044 2045 2046 2047 2048 2049 2050 2051 1978 2052 break; 1979 2053 case Node::Variable: … … 2016 2090 2017 2091 /*! 2092 2093 2018 2094 */ 2019 2095 QString Tree::fullDocumentName(const Node *node) const … … 2026 2102 2027 2103 do { 2028 if (!n->name().isEmpty()) 2104 if (!n->name().isEmpty() && 2105 ((n->type() != Node::Fake) || (n->subType() != Node::QmlPropertyGroup))) 2029 2106 pieces.insert(0, n->name()); 2030 2107 2031 if ( n->type() == Node::Fake)2108 if () 2032 2109 break; 2033 2110
Note:
See TracChangeset
for help on using the changeset viewer.