Changeset 561 for trunk/tools/qdoc3/tree.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/tools/qdoc3/tree.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the tools applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 177 177 178 178 /*! 179 Find the node with the specified \a path name of the 180 specified \a type. 179 181 */ 180 182 Node *Tree::findNode(const QStringList &path, … … 190 192 191 193 /*! 194 Find the node with the specified \a path name of the 195 specified \a type. 192 196 */ 193 197 const Node *Tree::findNode(const QStringList &path, … … 209 213 { 210 214 return const_cast<FunctionNode *>( 211 const_cast<const Tree *>(this)->findFunctionNode(path, relative, findFlags)); 215 const_cast<const Tree *>(this)->findFunctionNode(path, 216 relative, 217 findFlags)); 212 218 } 213 219 … … 220 226 if (!relative) 221 227 relative = root(); 228 222 229 do { 223 230 const Node *node = relative; … … 234 241 next = ((InnerNode *) node)->findNode(path.at(i)); 235 242 236 if (!next && node->type() == Node::Class && (findFlags & SearchBaseClasses)) { 243 if (!next && node->type() == Node::Class && 244 (findFlags & SearchBaseClasses)) { 237 245 NodeList baseClasses = allBaseClasses(static_cast<const ClassNode *>(node)); 238 246 foreach (const Node *baseClass, baseClasses) { 239 247 if (i == path.size() - 1) 240 next = static_cast<const InnerNode *>(baseClass)-> 241 findFunctionNode(path.at(i)); 248 next = static_cast<const InnerNode *>(baseClass)->findFunctionNode(path.at(i)); 242 249 else 243 250 next = static_cast<const InnerNode *>(baseClass)->findNode(path.at(i)); … … 250 257 node = next; 251 258 } 252 if (node && i == path.size() && node-> type() == Node::Function) {259 if (node && i == path.size() && node->isFunction()) { 253 260 // CppCodeParser::processOtherMetaCommand ensures that reimplemented 254 261 // functions are private. 255 262 const FunctionNode *func = static_cast<const FunctionNode*>(node); 256 257 263 while (func->access() == Node::Private) { 258 264 const FunctionNode *from = func->reimplementedFrom(); … … 262 268 else 263 269 func = from; 264 } else 270 } 271 else 265 272 break; 266 273 } … … 297 304 if (parent == 0 || !parent->isInnerNode()) { 298 305 return 0; 299 } else { 306 } 307 else { 300 308 return ((InnerNode *)parent)->findFunctionNode(clone); 301 309 } … … 413 421 414 422 /*! 423 This function adds the \a node to the \a group. The group 424 can be listed anywhere using the \e{annotated list} command. 415 425 */ 416 426 void Tree::addToGroup(Node *node, const QString &group) … … 477 487 QString setterName = (*propEntry)[PropertyNode::Setter]; 478 488 QString resetterName = (*propEntry)[PropertyNode::Resetter]; 489 QString notifierName = (*propEntry)[PropertyNode::Notifier]; 479 490 480 491 NodeList::ConstIterator c = parent->childNodes().begin(); … … 491 502 } else if (function->name() == resetterName) { 492 503 property->addFunction(function, PropertyNode::Resetter); 504 } else if (function->name() == notifierName) { 505 property->addSignal(function, PropertyNode::Notifier); 493 506 } 494 507 } … … 564 577 FakeNode *fake = 565 578 static_cast<FakeNode*>(findNode(QStringList(i.key()),Node::Fake)); 566 if (fake && fake->subType() == FakeNode::Group) {579 if (fake && fake->subType() == Node::Group) { 567 580 fake->addGroupMember(i.value()); 568 581 } 582 #if 0 569 583 else { 570 584 if (prevGroup != i.key()) 571 585 i.value()->doc().location().warning(tr("No such group '%1'").arg(i.key())); 572 586 } 587 #endif 573 588 574 589 prevGroup = i.key(); … … 771 786 } 772 787 else if (element.nodeName() == "page") { 773 FakeNode::SubType subtype;788 Node::SubType subtype; 774 789 if (element.attribute("subtype") == "example") 775 subtype = FakeNode::Example;790 subtype = Node::Example; 776 791 else if (element.attribute("subtype") == "header") 777 subtype = FakeNode::HeaderFile;792 subtype = Node::HeaderFile; 778 793 else if (element.attribute("subtype") == "file") 779 subtype = FakeNode::File;794 subtype = Node::File; 780 795 else if (element.attribute("subtype") == "group") 781 subtype = FakeNode::Group;796 subtype = Node::Group; 782 797 else if (element.attribute("subtype") == "module") 783 subtype = FakeNode::Module;798 subtype = Node::Module; 784 799 else if (element.attribute("subtype") == "page") 785 subtype = FakeNode::Page;800 subtype = Node::Page; 786 801 else if (element.attribute("subtype") == "externalpage") 787 subtype = FakeNode::ExternalPage;802 subtype = Node::ExternalPage; 788 803 else 789 804 return; … … 1227 1242 const FakeNode *fakeNode = static_cast<const FakeNode*>(node); 1228 1243 switch (fakeNode->subType()) { 1229 case FakeNode::Example:1244 case Node::Example: 1230 1245 writer.writeAttribute("subtype", "example"); 1231 1246 break; 1232 case FakeNode::HeaderFile:1247 case Node::HeaderFile: 1233 1248 writer.writeAttribute("subtype", "header"); 1234 1249 break; 1235 case FakeNode::File:1250 case Node::File: 1236 1251 writer.writeAttribute("subtype", "file"); 1237 1252 break; 1238 case FakeNode::Group:1253 case Node::Group: 1239 1254 writer.writeAttribute("subtype", "group"); 1240 1255 break; 1241 case FakeNode::Module:1256 case Node::Module: 1242 1257 writer.writeAttribute("subtype", "module"); 1243 1258 break; 1244 case FakeNode::Page:1259 case Node::Page: 1245 1260 writer.writeAttribute("subtype", "page"); 1246 1261 break; 1247 case FakeNode::ExternalPage:1262 case Node::ExternalPage: 1248 1263 writer.writeAttribute("subtype", "externalpage"); 1249 1264 break; … … 1384 1399 if (inner->type() == Node::Fake) { 1385 1400 const FakeNode *fakeNode = static_cast<const FakeNode *>(inner); 1386 if (fakeNode->subType() == FakeNode::ExternalPage)1401 if (fakeNode->subType() == Node::ExternalPage) 1387 1402 external = true; 1388 1403 } … … 1864 1879 void Tree::addExternalLink(const QString &url, const Node *relative) 1865 1880 { 1866 FakeNode *fakeNode = new FakeNode(root(), url, FakeNode::ExternalPage);1881 FakeNode *fakeNode = new FakeNode(root(), url, Node::ExternalPage); 1867 1882 fakeNode->setAccess(Node::Public); 1868 1883 … … 1885 1900 return node->url(); 1886 1901 1902 QString parentName; 1903 QString anchorRef; 1904 1887 1905 if (node->type() == Node::Namespace) { 1888 1906 … … 1891 1909 1892 1910 if (!node->fileBase().isEmpty()) 1893 returnnode->fileBase() + ".html";1911 parentName = node->fileBase() + ".html"; 1894 1912 else 1895 1913 return ""; 1896 1914 } 1897 1915 else if (node->type() == Node::Fake) { 1898 return node->fileBase() + ".html"; 1916 #ifdef QDOC_QML 1917 if (node->subType() == Node::QmlClass) 1918 return "qml-" + node->fileBase() + ".html"; 1919 else 1920 #endif 1921 parentName = node->fileBase() + ".html"; 1899 1922 } 1900 1923 else if (node->fileBase().isEmpty()) 1901 1924 return ""; 1902 1925 1903 QString parentName;1904 1926 Node *parentNode = 0; 1905 1927 … … 1913 1935 case Node::Namespace: 1914 1936 if (parentNode && !parentNode->name().isEmpty()) 1915 returnparentName.replace(".html", "") + "-"1916 + node->fileBase().toLower() + ".html";1937 parentName = parentName.replace(".html", "") + "-" 1938 + node->fileBase().toLower() + ".html"; 1917 1939 else 1918 return node->fileBase() + ".html"; 1940 parentName = node->fileBase() + ".html"; 1941 break; 1919 1942 case Node::Function: 1920 1943 { … … 1926 1949 static_cast<const FunctionNode *>(node); 1927 1950 1928 // Functions can be compatibility functions or be obsolete.1929 switch (node->status()) {1930 case Node::Compat:1931 parentName.replace(".html", "-qt3.html");1932 break;1933 case Node::Obsolete:1934 parentName.replace(".html", "-obsolete.html");1935 break;1936 default:1937 ;1938 }1939 1940 1951 if (functionNode->metaness() == FunctionNode::Dtor) 1941 return parentName +"#dtor." + functionNode->name().mid(1);1942 1943 if (functionNode->associatedProperty())1952 anchorRef = "#dtor." + functionNode->name().mid(1); 1953 1954 else if (functionNode->associatedProperty()) 1944 1955 return fullDocumentLocation(functionNode->associatedProperty()); 1945 1956 1946 if (functionNode->overloadNumber() > 1)1947 return parentName +"#" + functionNode->name()1948 + "-" + QString::number(functionNode->overloadNumber());1957 else if (functionNode->overloadNumber() > 1) 1958 anchorRef = "#" + functionNode->name() 1959 + "-" + QString::number(functionNode->overloadNumber()); 1949 1960 else 1950 return parentName +"#" + functionNode->name();1961 anchorRef = "#" + functionNode->name(); 1951 1962 } 1952 1963 … … 1956 1967 HTML anchors, we need to preserve the case. 1957 1968 */ 1969 break; 1958 1970 case Node::Enum: 1959 return parentName + "#" + node->name() + "-enum"; 1971 anchorRef = "#" + node->name() + "-enum"; 1972 break; 1960 1973 case Node::Typedef: 1961 return parentName + "#" + node->name() + "-typedef"; 1974 anchorRef = "#" + node->name() + "-typedef"; 1975 break; 1962 1976 case Node::Property: 1963 return parentName + "#" + node->name() + "-prop"; 1977 anchorRef = "#" + node->name() + "-prop"; 1978 break; 1964 1979 case Node::Variable: 1965 return parentName + "#" + node->name() + "-var"; 1980 anchorRef = "#" + node->name() + "-var"; 1981 break; 1966 1982 case Node::Target: 1967 return parentName + "#" + Doc::canonicalTitle(node->name()); 1983 anchorRef = "#" + Doc::canonicalTitle(node->name()); 1984 break; 1968 1985 case Node::Fake: 1969 1986 { 1970 QString pageName = node->name(); 1971 return pageName.replace("/", "-").replace(".", "-") + ".html"; 1987 /* 1988 Use node->fileBase() for fake nodes because they are represented 1989 by pages whose file names are lower-case. 1990 */ 1991 parentName = node->fileBase(); 1992 parentName.replace("/", "-").replace(".", "-"); 1993 parentName += ".html"; 1972 1994 } 1973 1995 break; … … 1976 1998 } 1977 1999 1978 return ""; 2000 // Various objects can be compat (deprecated) or obsolete. 2001 if (node->type() != Node::Class && node->type() != Node::Namespace) { 2002 switch (node->status()) { 2003 case Node::Compat: 2004 parentName.replace(".html", "-qt3.html"); 2005 break; 2006 case Node::Obsolete: 2007 parentName.replace(".html", "-obsolete.html"); 2008 break; 2009 default: 2010 ; 2011 } 2012 } 2013 2014 return parentName.toLower() + anchorRef; 1979 2015 } 1980 2016
Note:
See TracChangeset
for help on using the changeset viewer.