Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/qdoc3/tree.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the tools applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    177177
    178178/*!
     179  Find the node with the specified \a path name of the
     180  specified \a type.
    179181 */
    180182Node *Tree::findNode(const QStringList &path,
     
    190192
    191193/*!
     194  Find the node with the specified \a path name of the
     195  specified \a type.
    192196 */
    193197const Node *Tree::findNode(const QStringList &path,
     
    209213{
    210214    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));
    212218}
    213219
     
    220226    if (!relative)
    221227        relative = root();
     228
    222229    do {
    223230        const Node *node = relative;
     
    234241                next = ((InnerNode *) node)->findNode(path.at(i));
    235242
    236             if (!next && node->type() == Node::Class && (findFlags & SearchBaseClasses)) {
     243            if (!next && node->type() == Node::Class &&
     244                (findFlags & SearchBaseClasses)) {
    237245                NodeList baseClasses = allBaseClasses(static_cast<const ClassNode *>(node));
    238246                foreach (const Node *baseClass, baseClasses) {
    239247                    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));
    242249                    else
    243250                        next = static_cast<const InnerNode *>(baseClass)->findNode(path.at(i));
     
    250257            node = next;
    251258        }
    252         if (node && i == path.size() && node->type() == Node::Function) {
     259        if (node && i == path.size() && node->isFunction()) {
    253260            // CppCodeParser::processOtherMetaCommand ensures that reimplemented
    254261            // functions are private.
    255262            const FunctionNode *func = static_cast<const FunctionNode*>(node);
    256 
    257263            while (func->access() == Node::Private) {
    258264                const FunctionNode *from = func->reimplementedFrom();
     
    262268                    else
    263269                        func = from;
    264                 } else
     270                }
     271                else
    265272                    break;
    266273            }
     
    297304    if (parent == 0 || !parent->isInnerNode()) {
    298305        return 0;
    299     } else {
     306    }
     307    else {
    300308        return ((InnerNode *)parent)->findFunctionNode(clone);
    301309    }
     
    413421
    414422/*!
     423  This function adds the \a node to the \a group. The group
     424  can be listed anywhere using the \e{annotated list} command.
    415425 */
    416426void Tree::addToGroup(Node *node, const QString &group)
     
    477487        QString setterName = (*propEntry)[PropertyNode::Setter];
    478488        QString resetterName = (*propEntry)[PropertyNode::Resetter];
     489        QString notifierName = (*propEntry)[PropertyNode::Notifier];
    479490
    480491        NodeList::ConstIterator c = parent->childNodes().begin();
     
    491502                    } else if (function->name() == resetterName) {
    492503                        property->addFunction(function, PropertyNode::Resetter);
     504                    } else if (function->name() == notifierName) {
     505                        property->addSignal(function, PropertyNode::Notifier);
    493506                    }
    494507                }
     
    564577        FakeNode *fake =
    565578            static_cast<FakeNode*>(findNode(QStringList(i.key()),Node::Fake));
    566         if (fake && fake->subType() == FakeNode::Group) {
     579        if (fake && fake->subType() == Node::Group) {
    567580            fake->addGroupMember(i.value());
    568581        }
     582#if 0       
    569583        else {
    570584            if (prevGroup != i.key())
    571585                i.value()->doc().location().warning(tr("No such group '%1'").arg(i.key()));
    572586        }
     587#endif       
    573588
    574589        prevGroup = i.key();
     
    771786    }
    772787    else if (element.nodeName() == "page") {
    773         FakeNode::SubType subtype;
     788        Node::SubType subtype;
    774789        if (element.attribute("subtype") == "example")
    775             subtype = FakeNode::Example;
     790            subtype = Node::Example;
    776791        else if (element.attribute("subtype") == "header")
    777             subtype = FakeNode::HeaderFile;
     792            subtype = Node::HeaderFile;
    778793        else if (element.attribute("subtype") == "file")
    779             subtype = FakeNode::File;
     794            subtype = Node::File;
    780795        else if (element.attribute("subtype") == "group")
    781             subtype = FakeNode::Group;
     796            subtype = Node::Group;
    782797        else if (element.attribute("subtype") == "module")
    783             subtype = FakeNode::Module;
     798            subtype = Node::Module;
    784799        else if (element.attribute("subtype") == "page")
    785             subtype = FakeNode::Page;
     800            subtype = Node::Page;
    786801        else if (element.attribute("subtype") == "externalpage")
    787             subtype = FakeNode::ExternalPage;
     802            subtype = Node::ExternalPage;
    788803        else
    789804            return;
     
    12271242            const FakeNode *fakeNode = static_cast<const FakeNode*>(node);
    12281243            switch (fakeNode->subType()) {
    1229                 case FakeNode::Example:
     1244                case Node::Example:
    12301245                    writer.writeAttribute("subtype", "example");
    12311246                    break;
    1232                 case FakeNode::HeaderFile:
     1247                case Node::HeaderFile:
    12331248                    writer.writeAttribute("subtype", "header");
    12341249                    break;
    1235                 case FakeNode::File:
     1250                case Node::File:
    12361251                    writer.writeAttribute("subtype", "file");
    12371252                    break;
    1238                 case FakeNode::Group:
     1253                case Node::Group:
    12391254                    writer.writeAttribute("subtype", "group");
    12401255                    break;
    1241                 case FakeNode::Module:
     1256                case Node::Module:
    12421257                    writer.writeAttribute("subtype", "module");
    12431258                    break;
    1244                 case FakeNode::Page:
     1259                case Node::Page:
    12451260                    writer.writeAttribute("subtype", "page");
    12461261                    break;
    1247                 case FakeNode::ExternalPage:
     1262                case Node::ExternalPage:
    12481263                    writer.writeAttribute("subtype", "externalpage");
    12491264                    break;
     
    13841399            if (inner->type() == Node::Fake) {
    13851400                const FakeNode *fakeNode = static_cast<const FakeNode *>(inner);
    1386                 if (fakeNode->subType() == FakeNode::ExternalPage)
     1401                if (fakeNode->subType() == Node::ExternalPage)
    13871402                    external = true;
    13881403            }
     
    18641879void Tree::addExternalLink(const QString &url, const Node *relative)
    18651880{
    1866     FakeNode *fakeNode = new FakeNode(root(), url, FakeNode::ExternalPage);
     1881    FakeNode *fakeNode = new FakeNode(root(), url, Node::ExternalPage);
    18671882    fakeNode->setAccess(Node::Public);
    18681883
     
    18851900        return node->url();
    18861901
     1902    QString parentName;
     1903    QString anchorRef;
     1904
    18871905    if (node->type() == Node::Namespace) {
    18881906
     
    18911909
    18921910        if (!node->fileBase().isEmpty())
    1893             return node->fileBase() + ".html";
     1911            parentName = node->fileBase() + ".html";
    18941912        else
    18951913            return "";
    18961914    }
    18971915    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";
    18991922    }
    19001923    else if (node->fileBase().isEmpty())
    19011924        return "";
    19021925
    1903     QString parentName;
    19041926    Node *parentNode = 0;
    19051927
     
    19131935        case Node::Namespace:
    19141936            if (parentNode && !parentNode->name().isEmpty())
    1915                 return parentName.replace(".html", "") + "-"
    1916                     + node->fileBase().toLower() + ".html";
     1937                parentName = parentName.replace(".html", "") + "-"
     1938                           + node->fileBase().toLower() + ".html";
    19171939            else
    1918                 return node->fileBase() + ".html";
     1940                parentName = node->fileBase() + ".html";
     1941            break;
    19191942        case Node::Function:
    19201943            {
     
    19261949                    static_cast<const FunctionNode *>(node);
    19271950
    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 
    19401951                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())
    19441955                    return fullDocumentLocation(functionNode->associatedProperty());
    19451956
    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());
    19491960                else
    1950                     return parentName + "#" + functionNode->name();
     1961                    anchorRef = "#" + functionNode->name();
    19511962            }
    19521963
     
    19561967              HTML anchors, we need to preserve the case.
    19571968            */
     1969            break;
    19581970        case Node::Enum:
    1959             return parentName + "#" + node->name() + "-enum";
     1971            anchorRef = "#" + node->name() + "-enum";
     1972            break;
    19601973        case Node::Typedef:
    1961             return parentName + "#" + node->name() + "-typedef";
     1974            anchorRef = "#" + node->name() + "-typedef";
     1975            break;
    19621976        case Node::Property:
    1963             return parentName + "#" + node->name() + "-prop";
     1977            anchorRef = "#" + node->name() + "-prop";
     1978            break;
    19641979        case Node::Variable:
    1965             return parentName + "#" + node->name() + "-var";
     1980            anchorRef = "#" + node->name() + "-var";
     1981            break;
    19661982        case Node::Target:
    1967             return parentName + "#" + Doc::canonicalTitle(node->name());
     1983            anchorRef = "#" + Doc::canonicalTitle(node->name());
     1984            break;
    19681985        case Node::Fake:
    19691986            {
    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";
    19721994            }
    19731995            break;
     
    19761998    }
    19771999
    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;
    19792015}
    19802016
Note: See TracChangeset for help on using the changeset viewer.