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/src/tools/moc/moc.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**
     
    338338{
    339339    def->isVirtual = false;
    340     while (test(INLINE) || test(STATIC) || test(VIRTUAL)
    341            || testFunctionAttribute(def)) {
    342         if (lookup() == VIRTUAL)
    343             def->isVirtual = true;
    344     }
     340    //skip modifiers and attributes
     341    while (test(INLINE) || test(STATIC) ||
     342        (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual
     343        || testFunctionAttribute(def)) {}
    345344    bool templateFunction = (lookup() == TEMPLATE);
    346345    def->type = parseType();
     
    430429{
    431430    def->isVirtual = false;
    432     while (test(EXPLICIT) || test(INLINE) || test(STATIC) || test(VIRTUAL)
    433            || testFunctionAttribute(def)) {
    434         if (lookup() == VIRTUAL)
    435             def->isVirtual = true;
    436     }
     431    //skip modifiers and attributes
     432    while (test(EXPLICIT) || test(INLINE) || test(STATIC) ||
     433        (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual
     434        || testFunctionAttribute(def)) {}
    437435    bool tilde = test(TILDE);
    438436    def->type = parseType();
     
    753751
    754752    if (!noInclude) {
    755         if (includePath.size() && includePath.right(1) != "/")
    756             includePath += "/";
     753        if (includePath.size() && !includePath.endsWith('/'))
     754            includePath += '/';
    757755        for (int i = 0; i < includeFiles.size(); ++i) {
    758756            QByteArray inc = includeFiles.at(i);
     
    760758                if (includePath.size() && includePath != "./")
    761759                    inc.prepend(includePath);
    762                 inc = "\"" + inc + "\"";
     760                inc = '\"' + inc + '\"';
    763761            }
    764762            fprintf(out, "#include %s\n", inc.constData());
     
    767765    if (classList.size() && classList.first().classname == "Qt")
    768766        fprintf(out, "#include <QtCore/qobject.h>\n");
     767
     768    if (mustIncludeQMetaTypeH)
     769        fprintf(out, "#include <QtCore/qmetatype.h>\n");
    769770
    770771    fprintf(out, "#if !defined(Q_MOC_OUTPUT_REVISION)\n"
     
    860861        parseFunction(&funcDef);
    861862        if (funcDef.isVirtual)
    862             error("Signals cannot be declared virtual");
     863            warning("Signals cannot be declared virtual");
    863864        if (funcDef.inlineCode)
    864865            error("Not a signal declaration");
     
    899900    else if (type == "ULongLong")
    900901        type = "qulonglong";
     902    else if (type == "qreal")
     903        mustIncludeQMetaTypeH = true;
     904
    901905    propDef.type = type;
    902906
     
    905909    while (test(IDENTIFIER)) {
    906910        QByteArray l = lexem();
     911
     912        if (l[0] == 'C' && l == "CONSTANT") {
     913            propDef.constant = true;
     914            continue;
     915        } else if(l[0] == 'F' && l == "FINAL") {
     916            propDef.final = true;
     917            continue;
     918        }
     919
    907920        QByteArray v, v2;
    908921        if (test(LPAREN)) {
     
    960973        warning(msg.constData());
    961974    }
    962     if(!propDef.notify.isEmpty())
     975    if (propDef.constant && !propDef.write.isNull()) {
     976        QByteArray msg;
     977        msg += "Property declaration ";
     978        msg += propDef.name;
     979        msg += " is both WRITEable and CONSTANT. CONSTANT will be ignored.";
     980        propDef.constant = false;
     981        warning(msg.constData());
     982    }
     983    if (propDef.constant && !propDef.notify.isNull()) {
     984        QByteArray msg;
     985        msg += "Property declaration ";
     986        msg += propDef.name;
     987        msg += " is both NOTIFYable and CONSTANT. CONSTANT will be ignored.";
     988        propDef.constant = false;
     989        warning(msg.constData());
     990    }
     991
     992    if(!propDef.notify.isEmpty())
    963993        def->notifyableProperties++;
    964994
Note: See TracChangeset for help on using the changeset viewer.