Changeset 769 for trunk/src/tools


Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/tools/moc/generator.cpp

    r651 r769  
    739739                if (p.read.isEmpty())
    740740                    continue;
     741                QByteArray prefix;
     742                if (p.inPrivateClass.size()) {
     743                    prefix = p.inPrivateClass;
     744                    prefix.append("->");
     745                }
    741746                if (p.gspec == PropertyDef::PointerSpec)
    742                     fprintf(out, "        case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(%s())); break;\n",
    743                             propindex, p.read.constData());
     747                    fprintf(out, "        case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(%s%s())); break;\n",
     748                            propindex, prefix.constData(), p.read.constData());
    744749                else if (p.gspec == PropertyDef::ReferenceSpec)
    745                     fprintf(out, "        case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(&%s())); break;\n",
    746                             propindex, p.read.constData());
     750                    fprintf(out, "        case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(&%s%s())); break;\n",
     751                            propindex, prefix.constData(), p.read.constData());
    747752                else if (cdef->enumDeclarations.value(p.type, false))
    748                     fprintf(out, "        case %d: *reinterpret_cast<int*>(_v) = QFlag(%s()); break;\n",
    749                             propindex, p.read.constData());
     753                    fprintf(out, "        case %d: *reinterpret_cast<int*>(_v) = QFlag(%s%s()); break;\n",
     754                            propindex, prefix.constData(), p.read.constData());
    750755                else
    751                     fprintf(out, "        case %d: *reinterpret_cast< %s*>(_v) = %s(); break;\n",
    752                             propindex, p.type.constData(), p.read.constData());
     756                    fprintf(out, "        case %d: *reinterpret_cast< %s*>(_v) = %s%s(); break;\n",
     757                            propindex, p.type.constData(), prefix.constData(), p.read.constData());
    753758            }
    754759            fprintf(out, "        }\n");
     
    769774                if (p.write.isEmpty())
    770775                    continue;
     776                QByteArray prefix;
     777                if (p.inPrivateClass.size()) {
     778                    prefix = p.inPrivateClass;
     779                    prefix.append("->");
     780                }
    771781                if (cdef->enumDeclarations.value(p.type, false)) {
    772                     fprintf(out, "        case %d: %s(QFlag(*reinterpret_cast<int*>(_v))); break;\n",
    773                             propindex, p.write.constData());
     782                    fprintf(out, "        case %d: %s%s(QFlag(*reinterpret_cast<int*>(_v))); break;\n",
     783                            propindex, prefix.constData(), p.write.constData());
    774784                } else {
    775                     fprintf(out, "        case %d: %s(*reinterpret_cast< %s*>(_v)); break;\n",
    776                             propindex, p.write.constData(), p.type.constData());
     785                    fprintf(out, "        case %d: %s%s(*reinterpret_cast< %s*>(_v)); break;\n",
     786                            propindex, prefix.constData(), p.write.constData(), p.type.constData());
    777787                }
    778788            }
     
    792802                if (!p.reset.endsWith(')'))
    793803                    continue;
    794                 fprintf(out, "        case %d: %s; break;\n",
    795                         propindex, p.reset.constData());
     804                QByteArray prefix;
     805                if (p.inPrivateClass.size()) {
     806                    prefix = p.inPrivateClass;
     807                    prefix.append("->");
     808                }
     809                fprintf(out, "        case %d: %s%s; break;\n",
     810                        propindex, prefix.constData(), p.reset.constData());
    796811            }
    797812            fprintf(out, "        }\n");
  • trunk/src/tools/moc/keywords.cpp

    r651 r769  
    4444
    4545static const short keyword_trans[][128] = {
    46     {0,0,0,0,0,0,0,0,0,525,522,0,0,0,0,0,
    47      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    48      525,252,523,526,0,38,239,524,25,26,236,234,30,235,27,237,
     46    {0,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,
     47     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     48     533,252,531,534,0,38,239,532,25,26,236,234,30,235,27,237,
    4949     22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43,
    5050     0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
    51      8,21,8,8,8,8,8,8,8,8,8,31,527,32,238,8,
     51     8,21,8,8,8,8,8,8,8,8,8,31,535,32,238,8,
    5252     0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13,
    5353     14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0},
     
    191191     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    192192     0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0,
    193      530,530,530,530,530,530,530,530,530,530,0,0,0,0,0,0,
     193     538,538,538,538,538,538,538,538,538,538,0,0,0,0,0,0,
    194194     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    195195     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     
    350350    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    351351     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    352      0,0,0,0,0,0,0,0,0,0,529,0,0,0,0,528,
     352     0,0,0,0,0,0,0,0,0,0,537,0,0,0,0,536,
    353353     0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0,
    354354     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     
    426426     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    427427     0,0,0,0,450,0,506,0,0,0,0,0,0,0,0,0,
     428     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     429     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
     430    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     431     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     432     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     433     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     434     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     435     522,0,0,481,0,0,0,0,0,0,0,0,0,0,0,0,
    428436     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    429437     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
     
    926934    {CHARACTER, 0, 69, 479, CHARACTER},
    927935    {CHARACTER, 0, 95, 480, CHARACTER},
    928     {CHARACTER, 0, 83, 481, CHARACTER},
     936    {CHARACTER, 48, 0, 0, CHARACTER},
    929937    {CHARACTER, 0, 76, 482, CHARACTER},
    930938    {CHARACTER, 0, 79, 483, CHARACTER},
    931939    {CHARACTER, 0, 84, 484, CHARACTER},
    932940    {Q_PRIVATE_SLOT_TOKEN, 0, 0, 0, CHARACTER},
    933     {CHARACTER, 48, 0, 0, CHARACTER},
     941    {CHARACTER, 49, 0, 0, CHARACTER},
    934942    {CHARACTER, 0, 77, 487, CHARACTER},
    935943    {CHARACTER, 0, 79, 488, CHARACTER},
     
    968976    {CHARACTER, 0, 69, 521, CHARACTER},
    969977    {Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER},
     978    {CHARACTER, 0, 82, 523, CHARACTER},
     979    {CHARACTER, 0, 79, 524, CHARACTER},
     980    {CHARACTER, 0, 80, 525, CHARACTER},
     981    {CHARACTER, 0, 69, 526, CHARACTER},
     982    {CHARACTER, 0, 82, 527, CHARACTER},
     983    {CHARACTER, 0, 84, 528, CHARACTER},
     984    {CHARACTER, 0, 89, 529, CHARACTER},
     985    {Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
    970986    {NEWLINE, 0, 0, 0, NOTOKEN},
    971987    {QUOTE, 0, 0, 0, NOTOKEN},
  • trunk/src/tools/moc/moc.cpp

    r651 r769  
    659659                    parseSlotInPrivate(&def, access);
    660660                    break;
     661                case Q_PRIVATE_PROPERTY_TOKEN:
     662                    parsePrivateProperty(&def);
     663                    break;
    661664                case ENUM: {
    662665                    EnumDef enumDef;
     
    873876}
    874877
    875 
    876 void Moc::parseProperty(ClassDef *def)
    877 {
    878     next(LPAREN);
    879     PropertyDef propDef;
     878void Moc::createPropertyDef(PropertyDef &propDef)
     879{
    880880    QByteArray type = parseType().name;
    881881    if (type.isEmpty())
     
    965965        }
    966966    }
    967     next(RPAREN);
    968967    if (propDef.read.isNull()) {
    969968        QByteArray msg;
     
    989988        warning(msg.constData());
    990989    }
     990}
     991
     992void Moc::parseProperty(ClassDef *def)
     993{
     994    next(LPAREN);
     995    PropertyDef propDef;
     996    createPropertyDef(propDef);
     997    next(RPAREN);
     998
     999
     1000    if(!propDef.notify.isEmpty())
     1001        def->notifyableProperties++;
     1002    def->propertyList += propDef;
     1003}
     1004
     1005void Moc::parsePrivateProperty(ClassDef *def)
     1006{
     1007    next(LPAREN);
     1008    PropertyDef propDef;
     1009    next(IDENTIFIER);
     1010    propDef.inPrivateClass = lexem();
     1011    while (test(SCOPE)) {
     1012        propDef.inPrivateClass += lexem();
     1013        next(IDENTIFIER);
     1014        propDef.inPrivateClass += lexem();
     1015    }
     1016    // also allow void functions
     1017    if (test(LPAREN)) {
     1018        next(RPAREN);
     1019        propDef.inPrivateClass += "()";
     1020    }
     1021
     1022    next(COMMA);
     1023
     1024    createPropertyDef(propDef);
    9911025
    9921026    if(!propDef.notify.isEmpty())
  • trunk/src/tools/moc/moc.h

    r651 r769  
    117117{
    118118    PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec){}
    119     QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify;
     119    QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify, inPrivateClass;
    120120    int notifyId;
    121121    bool constant;
     
    218218    void parseSignals(ClassDef *def);
    219219    void parseProperty(ClassDef *def);
     220    void createPropertyDef(PropertyDef &def);
    220221    void parseEnumOrFlag(ClassDef *def, bool isFlag);
    221222    void parseFlag(ClassDef *def);
     
    225226    void parseDeclareMetatype();
    226227    void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access);
     228    void parsePrivateProperty(ClassDef *def);
    227229
    228230    void parseFunctionArguments(FunctionDef *def);
  • trunk/src/tools/moc/token.cpp

    r651 r769  
    180180        case Q_SLOT_TOKEN: return "Q_SLOT_TOKEN";
    181181        case Q_PRIVATE_SLOT_TOKEN: return "Q_PRIVATE_SLOT_TOKEN";
     182        case Q_PRIVATE_PROPERTY_TOKEN: return "Q_PRIVATE_PROPERTY_TOKEN";
    182183        case SPECIAL_TREATMENT_MARK: return "SPECIAL_TREATMENT_MARK";
    183184        case MOC_INCLUDE_BEGIN: return "MOC_INCLUDE_BEGIN";
  • trunk/src/tools/moc/token.h

    r651 r769  
    186186    Q_INVOKABLE_TOKEN,
    187187    Q_SCRIPTABLE_TOKEN,
     188    Q_PRIVATE_PROPERTY_TOKEN,
    188189    Q_META_TOKEN_END,
    189190    SPECIAL_TREATMENT_MARK = Q_META_TOKEN_END,
  • trunk/src/tools/moc/util/generate_keywords.cpp

    r651 r769  
    249249    { "Q_SLOT", "Q_SLOT_TOKEN" },
    250250    { "Q_SCRIPTABLE", "Q_SCRIPTABLE_TOKEN" },
    251 
     251    { "Q_PRIVATE_PROPERTY", "Q_PRIVATE_PROPERTY_TOKEN" },
    252252    { "\n", "NEWLINE" },
    253253    { "\"", "QUOTE" },
  • trunk/src/tools/rcc/rcc.cpp

    r651 r769  
    545545    RCCFileInfo *s = new RCCFileInfo(file);
    546546    s->m_parent = parent;
     547    if (parent->m_children.contains(filename))
     548        qWarning("potential duplicate alias detected: '%s'", qPrintable(filename));
    547549    parent->m_children.insertMulti(filename, s);
    548550    return true;
  • trunk/src/tools/uic/cpp/cppwriteinitialization.cpp

    r651 r769  
    27892789
    27902790    QMap<QString, bool> map; // bool is dummy. The idea is to sort that (always generate in the same order) by putting a set into a map
    2791     foreach (QString str, directives)
    2792         map[str] = true;
     2791    foreach (const QString &str, directives)
     2792        map.insert(str, true);
    27932793
    27942794    if (map.size() == 1) {
     
    27992799    outputStream << "#if";
    28002800    bool doOr = false;
    2801     foreach (QString str, map.keys()) {
     2801    foreach (const QString &str, map.keys()) {
    28022802        if (doOr)
    28032803            outputStream << " ||";
  • trunk/src/tools/uic/qclass_lib_map.h

    r561 r769  
    458458QT_CLASS_LIB(QWebSettings, QtWebKit, qwebsettings.h)
    459459QT_CLASS_LIB(QWebView, QtWebKit, qwebview.h)
     460QT_CLASS_LIB(QAudio, QtMultimedia, qaudio.h)
    460461QT_CLASS_LIB(QAudioDeviceInfo, QtMultimedia, qaudiodeviceinfo.h)
    461462QT_CLASS_LIB(QAbstractAudioDeviceInfo, QtMultimedia, qaudioengine.h)
  • trunk/src/tools/uic3/converter.cpp

    r651 r769  
    402402            if (objName == receiver) {
    403403                // see if it's a custom slot
    404                 foreach (QString cs, ui_custom_slots) {
     404                foreach (const QString &cs, ui_custom_slots) {
    405405                    if (cs == slot) {
    406406                        resolved = true;
     
    11231123                QStringList flags = prop->elementSet().split(QLatin1Char('|'));
    11241124                QStringList v;
    1125                 foreach (QString fl, flags) {
     1125                foreach (const QString &fl, flags) {
    11261126                    QString e = WidgetInfo::resolveEnumerator(className, fl);
    11271127                    if (e.isEmpty()) {
     
    12841284    //split type name on <>*& and whitespace
    12851285    QStringList typeNames = t.split(QRegExp(QLatin1String("<|>|\\*|&| ")), QString::SkipEmptyParts);
    1286     foreach(QString typeName , typeNames) {
     1286    foreach(const QString &typeName , typeNames) {
    12871287        QString newName = fixClassName(typeName);
    12881288        if( newName != typeName ) {
  • trunk/src/tools/uic3/main.cpp

    r651 r769  
    339339        ui3.computeDeps(e, globalIncludes, localIncludes, impl);
    340340
    341         foreach (QString i, globalIncludes)
     341        foreach (const QString &i, globalIncludes)
    342342            printf("%s\n", i.toLatin1().constData());
    343343
    344         foreach (QString i, localIncludes)
     344        foreach (const QString &i, localIncludes)
    345345            printf("%s\n", i.toLatin1().constData());
    346346
Note: See TracChangeset for help on using the changeset viewer.