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/cppcodemarker.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**
     
    4444*/
    4545
     46#include <qdebug.h>
    4647#include "atom.h"
    4748#include "cppcodemarker.h"
     
    194195        break;
    195196    case Node::Function:
     197    case Node::QmlSignal:
     198    case Node::QmlMethod:
    196199        func = (const FunctionNode *) node;
    197200        if (style != SeparateList && !func->returnType().isEmpty())
     
    284287            else {
    285288                for (int i = 0; i < documentedItems.size(); ++i) {
    286                     if (i < MaxEnumValues - 2 || i == documentedItems.size() - 1) {
     289                    if (i < MaxEnumValues-2 || i == documentedItems.size()-1) {
    287290                        if (i != 0)
    288291                            synopsis += ", ";
     
    345348}
    346349
     350#ifdef QDOC_QML
     351/*!
     352 */
     353QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
     354{
     355    QString name = taggedQmlNode(node);
     356    if (summary) {
     357        name = linkTag(node,name);
     358    } else if (node->type() == Node::QmlProperty) {
     359        const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
     360        if (pn->isAttached())
     361            name.prepend(pn->element() + QLatin1Char('.'));
     362    }
     363    name = "<@name>" + name + "</@name>";
     364    QString synopsis = name;
     365    if (node->type() == Node::QmlProperty) {
     366        const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
     367        synopsis += " : " + typified(pn->dataType());
     368    }
     369
     370    QString extra;
     371    if (summary) {
     372        if (node->status() == Node::Preliminary) {
     373            extra += " (preliminary)";
     374        }
     375        else if (node->status() == Node::Deprecated) {
     376            extra += " (deprecated)";
     377        }
     378        else if (node->status() == Node::Obsolete) {
     379            extra += " (obsolete)";
     380        }
     381    }
     382
     383    if (!extra.isEmpty()) {
     384        extra.prepend("<@extra>");
     385        extra.append("</@extra>");
     386    }
     387    return synopsis + extra;
     388}
     389#endif
     390
    347391QString CppCodeMarker::markedUpName(const Node *node)
    348392{
     
    412456}
    413457
     458#if 0
     459            FastSection privateReimpFuncs(classe,
     460                                          "Private Reimplemented Functions",
     461                                          "private reimplemented function",
     462                                          "private reimplemented functions");
     463            FastSection protectedReimpFuncs(classe,
     464                                            "Protected Reimplemented Functions",
     465                                            "protected reimplemented function",
     466                                            "protected reimplemented functions");
     467            FastSection publicReimpFuncs(classe,
     468                                         "Public Reimplemented Functions",
     469                                         "public reimplemented function",
     470                                         "public reimplemented functions");
     471#endif
     472
    414473QList<Section> CppCodeMarker::sections(const InnerNode *inner,
    415474                                       SynopsisStyle style,
     
    422481
    423482        if (style == Summary) {
    424             FastSection privateFunctions(classe, "Private Functions", "private function",
     483            FastSection privateFunctions(classe,
     484                                         "Private Functions",
     485                                         "private function",
    425486                                         "private functions");
    426487            FastSection privateSlots(classe, "Private Slots", "private slot", "private slots");
    427488            FastSection privateTypes(classe, "Private Types", "private type", "private types");
    428             FastSection protectedFunctions(classe, "Protected Functions", "protected function",
     489            FastSection protectedFunctions(classe,
     490                                           "Protected Functions",
     491                                           "protected function",
    429492                                           "protected functions");
    430             FastSection protectedSlots(classe, "Protected Slots", "protected slot", "protected slots");
    431             FastSection protectedTypes(classe, "Protected Types", "protected type", "protected types");
    432             FastSection protectedVariables(classe, "Protected Variables", "protected type", "protected variables");
    433             FastSection publicFunctions(classe, "Public Functions", "public function",
    434                                         "public functions");
     493            FastSection protectedSlots(classe,
     494                                       "Protected Slots",
     495                                       "protected slot",
     496                                       "protected slots");
     497            FastSection protectedTypes(classe,
     498                                       "Protected Types",
     499                                       "protected type",
     500                                       "protected types");
     501            FastSection protectedVariables(classe,
     502                                           "Protected Variables",
     503                                           "protected type",
     504                                           "protected variables");
     505            FastSection publicFunctions(classe,
     506                                        "Public Functions",
     507                                        "public function",
     508                                        "public functions");
    435509            FastSection publicSignals(classe, "Signals", "signal", "signals");
    436510            FastSection publicSlots(classe, "Public Slots", "public slot", "public slots");
    437511            FastSection publicTypes(classe, "Public Types", "public type", "public types");
    438             FastSection publicVariables(classe, "Public Variables", "public type", "public variables");
     512            FastSection publicVariables(classe,
     513                                        "Public Variables",
     514                                        "public type",
     515                                        "public variables");
    439516            FastSection properties(classe, "Properties", "property", "properties");
    440             FastSection relatedNonMembers(classe, "Related Non-Members", "related non-member",
     517            FastSection relatedNonMembers(classe,
     518                                          "Related Non-Members",
     519                                          "related non-member",
    441520                                          "related non-members");
    442             FastSection staticPrivateMembers(classe, "Static Private Members", "static private member",
     521            FastSection staticPrivateMembers(classe,
     522                                             "Static Private Members",
     523                                             "static private member",
    443524                                             "static private members");
    444             FastSection staticProtectedMembers(classe, "Static Protected Members",
    445                                                "static protected member", "static protected members");
    446             FastSection staticPublicMembers(classe, "Static Public Members", "static public member",
     525            FastSection staticProtectedMembers(classe,
     526                                               "Static Protected Members",
     527                                               "static protected member",
     528                                               "static protected members");
     529            FastSection staticPublicMembers(classe,
     530                                            "Static Public Members",
     531                                            "static public member",
    447532                                            "static public members");
    448533            FastSection macros(inner, "Macros", "macro", "macros");
     
    496581                            if ((*c)->type() != Node::Variable
    497582                                    || !(*c)->doc().isEmpty())
    498                                 insert(staticPublicMembers, *c, style, status);
     583                                insert(staticPublicMembers,*c,style,status);
    499584                        }
    500585                        else if ((*c)->type() == Node::Property) {
     
    506591                        }
    507592                        else if ((*c)->type() == Node::Function) {
    508                             insert(publicFunctions, *c, style, status);
     593                            if (!insertReimpFunc(publicFunctions,*c,status))
     594                                insert(publicFunctions, *c, style, status);
    509595                        }
    510596                        else {
     
    519605                            if ((*c)->type() != Node::Variable
    520606                                    || !(*c)->doc().isEmpty())
    521                                 insert(staticProtectedMembers, *c, style, status);
     607                                insert(staticProtectedMembers,*c,style,status);
    522608                        }
    523609                        else if ((*c)->type() == Node::Variable) {
    524610                            if (!(*c)->doc().isEmpty())
    525                                 insert(protectedVariables, *c, style, status);
     611                                insert(protectedVariables,*c,style,status);
    526612                        }
    527613                        else if ((*c)->type() == Node::Function) {
    528                             insert(protectedFunctions, *c, style, status);
     614                            if (!insertReimpFunc(protectedFunctions,*c,status))
     615                                insert(protectedFunctions, *c, style, status);
    529616                        }
    530617                        else {
     
    539626                            if ((*c)->type() != Node::Variable
    540627                                    || !(*c)->doc().isEmpty())
    541                                 insert(staticPrivateMembers, *c, style, status);
     628                                insert(staticPrivateMembers,*c,style,status);
    542629                        }
    543630                        else if ((*c)->type() == Node::Function) {
    544                             insert(privateFunctions, *c, style, status);
     631                            if (!insertReimpFunc(privateFunctions,*c,status))
     632                                insert(privateFunctions, *c, style, status);
    545633                        }
    546634                        else {
    547                             insert(privateTypes, *c, style, status);
     635                            insert(privateTypes,*c,style,status);
    548636                        }
    549637                    }
     
    662750                                   "namespace",
    663751                                   "namespaces");
    664             FastSection classes(inner, "Classes", "class", "classes");
     752            FastSection classes(inner,
     753                                "Classes",
     754                                "class",
     755                                "classes");
    665756            FastSection types(inner,
    666                               style == Summary ? "Types" : "Type Documentation",
     757                              style == Summary ?
     758                              "Types" : "Type Documentation",
    667759                              "type",
    668760                              "types");
    669761            FastSection functions(inner,
    670                                   style == Summary ? "Functions" : "Function Documentation",
     762                                  style == Summary ?
     763                                  "Functions" : "Function Documentation",
    671764                                  "function",
    672765                                  "functions");
    673766            FastSection macros(inner,
    674                                style == Summary ? "Macros" : "Macro Documentation",
     767                               style == Summary ?
     768                               "Macros" : "Macro Documentation",
    675769                               "macro",
    676770                               "macros");
     
    10071101}
    10081102
     1103#ifdef QDOC_QML
     1104/*!
     1105  This function is for documenting QML properties. It returns
     1106  the list of documentation sections for the children of the
     1107  \a qmlClassNode.
     1108
     1109  Currently, it only handles QML property groups.
     1110 */
     1111QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
     1112                                          SynopsisStyle style)
     1113{
     1114    QList<Section> sections;
     1115    if (qmlClassNode) {
     1116        if (style == Summary) {
     1117            FastSection qmlproperties(qmlClassNode,
     1118                                      "Properties",
     1119                                      "property",
     1120                                      "properties");
     1121            FastSection qmlattachedproperties(qmlClassNode,
     1122                                              "Attached Properties",
     1123                                              "property",
     1124                                              "properties");
     1125            FastSection qmlsignals(qmlClassNode,
     1126                                "Signals",
     1127                                "signal",
     1128                                "signals");
     1129            FastSection qmlattachedsignals(qmlClassNode,
     1130                                           "QML Attached Signals",
     1131                                           "signal",
     1132                                           "signals");
     1133            FastSection qmlmethods(qmlClassNode,
     1134                                   "Methods",
     1135                                   "method",
     1136                                   "methods");
     1137            FastSection qmlattachedmethods(qmlClassNode,
     1138                                           "QML Attached Methods",
     1139                                           "method",
     1140                                           "methods");
     1141
     1142            NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
     1143            while (c != qmlClassNode->childNodes().end()) {
     1144                if ((*c)->subType() == Node::QmlPropertyGroup) {
     1145                    const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(*c);
     1146                    NodeList::ConstIterator p = qpgn->childNodes().begin();
     1147                    while (p != qpgn->childNodes().end()) {
     1148                        if ((*p)->type() == Node::QmlProperty) {
     1149                            const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(*p);
     1150                            if (pn->isAttached())
     1151                                insert(qmlattachedproperties,*p,style,Okay);
     1152                            else
     1153                                insert(qmlproperties,*p,style,Okay);
     1154                        }
     1155                        ++p;
     1156                    }
     1157                }
     1158                else if ((*c)->type() == Node::QmlSignal) {
     1159                    const FunctionNode* sn = static_cast<const FunctionNode*>(*c);
     1160                    if (sn->isAttached())
     1161                        insert(qmlattachedsignals,*c,style,Okay);
     1162                    else
     1163                        insert(qmlsignals,*c,style,Okay);
     1164                }
     1165                else if ((*c)->type() == Node::QmlMethod) {
     1166                    const FunctionNode* mn = static_cast<const FunctionNode*>(*c);
     1167                    if (mn->isAttached())
     1168                        insert(qmlattachedmethods,*c,style,Okay);
     1169                    else
     1170                        insert(qmlmethods,*c,style,Okay);
     1171                }
     1172                ++c;
     1173            }
     1174            append(sections,qmlproperties);
     1175            append(sections,qmlattachedproperties);
     1176            append(sections,qmlsignals);
     1177            append(sections,qmlattachedsignals);
     1178            append(sections,qmlmethods);
     1179            append(sections,qmlattachedmethods);
     1180        }
     1181        else if (style == Detailed) {
     1182            FastSection qmlproperties(qmlClassNode, "Property Documentation");
     1183            FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation");
     1184            FastSection qmlsignals(qmlClassNode,"Signal Documentation");
     1185            FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation");
     1186            FastSection qmlmethods(qmlClassNode,"Method Documentation");
     1187            FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation");
     1188            NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
     1189            while (c != qmlClassNode->childNodes().end()) {
     1190                if ((*c)->subType() == Node::QmlPropertyGroup) {
     1191                    const QmlPropGroupNode* pgn = static_cast<const QmlPropGroupNode*>(*c);
     1192                    if (pgn->isAttached())
     1193                        insert(qmlattachedproperties,*c,style,Okay);
     1194                    else
     1195                        insert(qmlproperties,*c,style,Okay);
     1196                }
     1197                else if ((*c)->type() == Node::QmlSignal) {
     1198                    const FunctionNode* sn = static_cast<const FunctionNode*>(*c);
     1199                    if (sn->isAttached())
     1200                        insert(qmlattachedsignals,*c,style,Okay);
     1201                    else
     1202                        insert(qmlsignals,*c,style,Okay);
     1203                }
     1204                else if ((*c)->type() == Node::QmlMethod) {
     1205                    const FunctionNode* mn = static_cast<const FunctionNode*>(*c);
     1206                    if (mn->isAttached())
     1207                        insert(qmlattachedmethods,*c,style,Okay);
     1208                    else
     1209                        insert(qmlmethods,*c,style,Okay);
     1210                }
     1211                ++c;
     1212            }
     1213            append(sections,qmlproperties);
     1214            append(sections,qmlattachedproperties);
     1215            append(sections,qmlsignals);
     1216            append(sections,qmlattachedsignals);
     1217            append(sections,qmlmethods);
     1218            append(sections,qmlattachedmethods);
     1219        }
     1220    }
     1221
     1222    return sections;
     1223}
     1224#endif
     1225
    10091226QT_END_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.