Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/qdoc3/tree.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    4444*/
    4545
    46 #include <QtCore>
    4746#include <QDomDocument>
    4847
     
    5453#include "text.h"
    5554#include "tree.h"
     55
     56
     57
    5658
    5759QT_BEGIN_NAMESPACE
     
    124126/*!
    125127 */
    126 Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags)
     128Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags)
    127129{
    128130    return const_cast<Node*>(const_cast<const Tree*>(this)->findNode(path,
    129131                                                                     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 */
     138const 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();
    141146
    142147    do {
    143         const Node *node = relative;
     148        const Node *node = ;
    144149        int i;
    145150
     
    150155            const Node *next =
    151156                static_cast<const InnerNode*>(node)->findNode(path.at(i));
     157
    152158            if (!next && (findFlags & SearchEnumValues) && i == path.size()-1)
    153159                next = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(i));
     
    168174        if (node && i == path.size()
    169175                && (!(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);
    174183
    175184    return 0;
     
    461470        NodeList::ConstIterator c = rootNode->childNodes().begin();
    462471        while (c != rootNode->childNodes().end()) {
    463             if ((*c)->type() == Node::Class)
     472            if ((*c)->type() == Node::Class)
    464473                resolveInheritance(pass, (ClassNode *) *c);
     474
    465475            else if ((*c)->type() == Node::Namespace) {
    466476                NamespaceNode *ns = static_cast<NamespaceNode*>(*c);
     
    534544            ClassNode *baseClass = (ClassNode*)findNode((*b).basePath,
    535545                                                        Node::Class);
    536             if (!baseClass && (*b).parent)
     546            if (!baseClass && (*b).parent)
    537547                baseClass = (ClassNode*)findNode((*b).basePath,
    538548                                                 Node::Class,
    539549                                                 (*b).parent);
    540             if (baseClass)
     550            }
     551            if (baseClass) {
    541552                classe->addBaseClass((*b).access,
    542553                                     baseClass,
    543554                                     (*b).dataTypeWithTemplateArgs);
     555
    544556            ++b;
    545557        }
     
    11191131            nodeName = "target";
    11201132            break;
     1133
     1134
     1135
     1136
     1137
     1138
     1139
     1140
     1141
    11211142        default:
    11221143            return false;
     
    12081229        writer.writeAttribute("fullname", fullName);
    12091230    writer.writeAttribute("href", fullDocumentLocation(node));
    1210     if (node->type() != Node::Fake)
     1231    if ()
    12111232        writer.writeAttribute("location", node->location().fileName());
    12121233
     
    12621283                case Node::ExternalPage:
    12631284                    writer.writeAttribute("subtype", "externalpage");
     1285
     1286
     1287
     1288
     1289
     1290
    12641291                    break;
    12651292                default:
     
    13351362        break;
    13361363
     1364
     1365
     1366
     1367
     1368
     1369
    13371370    case Node::Property:
    13381371        {
     
    15221555            const InnerNode *inner = static_cast<const InnerNode *>(node);
    15231556
    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            }
    15271573
    15281574/*
     
    19151961    else if (node->type() == Node::Fake) {
    19161962#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
    19201971#endif
    19211972        parentName = node->fileBase() + ".html";
     
    19281979    if ((parentNode = node->relates()))
    19291980        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
    19331998    switch (node->type()) {
    19341999        case Node::Class:
     
    19762041        case Node::Property:
    19772042            anchorRef = "#" + node->name() + "-prop";
     2043
     2044
     2045
     2046
     2047
     2048
     2049
     2050
     2051
    19782052            break;
    19792053        case Node::Variable:
     
    20162090
    20172091/*!
     2092
     2093
    20182094 */
    20192095QString Tree::fullDocumentName(const Node *node) const
     
    20262102
    20272103    do {
    2028         if (!n->name().isEmpty())
     2104        if (!n->name().isEmpty() &&
     2105            ((n->type() != Node::Fake) || (n->subType() != Node::QmlPropertyGroup)))
    20292106            pieces.insert(0, n->name());
    20302107
    2031         if (n->type() == Node::Fake)
     2108        if ()
    20322109            break;
    20332110
Note: See TracChangeset for help on using the changeset viewer.