~ubuntu-branches/debian/jessie/qtdeclarative-opensource-src/jessie

« back to all changes in this revision

Viewing changes to src/qml/qml/qqmlmetatype.cpp

  • Committer: Package Import Robot
  • Author(s): Lisandro Damián Nicanor Pérez Meyer
  • Date: 2014-06-05 23:53:56 UTC
  • mfrom: (8.1.11 experimental)
  • Revision ID: package-import@ubuntu.com-20140605235356-cf36ioh08oh2oow4
Tags: 5.3.0-5
* Upload to unstable.
* Backport v4_yarr_jit_push_pop_addressTempRegister.patch to fix a bug
  of the JIT compiler in arm. Thanks Scott Kitterman for pointing it out.
* Update symbols files with buildds' logs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
    QBitArray lists;
107
107
 
108
108
    QList<QQmlPrivate::AutoParentFunction> parentFunctions;
 
109
    QQmlPrivate::QmlUnitCacheLookupFunction lookupCachedQmlUnit;
109
110
 
110
111
    QSet<QString> protectedNamespaces;
111
112
 
116
117
class QQmlTypeModulePrivate
117
118
{
118
119
public:
119
 
    QQmlTypeModulePrivate() 
 
120
    QQmlTypeModulePrivate()
120
121
    : minMinorVersion(INT_MAX), maxMinorVersion(0), locked(false) {}
121
122
 
122
123
    static QQmlTypeModulePrivate* get(QQmlTypeModule* q) { return q->d; }
142
143
}
143
144
 
144
145
QQmlMetaTypeData::QQmlMetaTypeData()
 
146
    : lookupCachedQmlUnit(0)
145
147
{
146
148
}
147
149
 
479
481
    return d->superType;
480
482
}
481
483
 
482
 
static void clone(QMetaObjectBuilder &builder, const QMetaObject *mo, 
 
484
static void clone(QMetaObjectBuilder &builder, const QMetaObject *mo,
483
485
                  const QMetaObject *ignoreStart, const QMetaObject *ignoreEnd)
484
486
{
485
487
    // Set classname
491
493
 
492
494
        int otherIndex = ignoreEnd->indexOfClassInfo(info.name());
493
495
        if (otherIndex >= ignoreStart->classInfoOffset() + ignoreStart->classInfoCount()) {
494
 
            // Skip 
 
496
            // Skip
495
497
        } else {
496
498
            builder.addClassInfo(info.name(), info.value());
497
499
        }
504
506
        int otherIndex = ignoreEnd->indexOfProperty(property.name());
505
507
        if (otherIndex >= ignoreStart->propertyOffset() + ignoreStart->propertyCount()) {
506
508
            builder.addProperty(QByteArray("__qml_ignore__") + property.name(), QByteArray("void"));
507
 
            // Skip 
 
509
            // Skip
508
510
        } else {
509
511
            builder.addProperty(property);
510
512
        }
520
522
 
521
523
        bool found = false;
522
524
 
523
 
        for (int ii = ignoreStart->methodOffset() + ignoreStart->methodCount(); 
 
525
        for (int ii = ignoreStart->methodOffset() + ignoreStart->methodCount();
524
526
             !found && ii < ignoreEnd->methodOffset() + ignoreEnd->methodCount();
525
527
             ++ii) {
526
528
 
540
542
 
541
543
        int otherIndex = ignoreEnd->indexOfEnumerator(enumerator.name());
542
544
        if (otherIndex >= ignoreStart->enumeratorOffset() + ignoreStart->enumeratorCount()) {
543
 
            // Skip 
 
545
            // Skip
544
546
        } else {
545
547
            builder.addEnumerator(enumerator);
546
548
        }
664
666
{
665
667
    // Add any enum values defined by 'related' classes
666
668
    if (metaObject->d.relatedMetaObjects) {
667
 
        const QMetaObject **related = metaObject->d.relatedMetaObjects;
 
669
        const QMetaObject * const *related = metaObject->d.relatedMetaObjects;
668
670
        if (related) {
669
671
            while (*related)
670
672
                insertEnums(*related++);
860
862
 
861
863
/*
862
864
This is the id passed to qmlAttachedPropertiesById().  This is different from the index
863
 
for the case that a single class is registered under two or more names (eg. Item in 
 
865
for the case that a single class is registered under two or more names (eg. Item in
864
866
Qt 4.7 and QtQuick 1.0).
865
867
*/
866
868
int QQmlType::attachedPropertiesId() const
1128
1130
 
1129
1131
int registerInterface(const QQmlPrivate::RegisterInterface &interface)
1130
1132
{
1131
 
    if (interface.version > 0) 
 
1133
    if (interface.version > 0)
1132
1134
        qFatal("qmlRegisterType(): Cannot mix incompatible QML versions.");
1133
1135
 
1134
1136
    QWriteLocker lock(metaTypeDataLock());
1344
1346
    return index;
1345
1347
}
1346
1348
 
 
1349
int registerQmlUnitCacheHook(const QQmlPrivate::RegisterQmlUnitCacheHook &hookRegistration)
 
1350
{
 
1351
    if (hookRegistration.version > 0)
 
1352
        qFatal("qmlRegisterType(): Cannot mix incompatible QML versions.");
 
1353
    QWriteLocker lock(metaTypeDataLock());
 
1354
    QQmlMetaTypeData *data = metaTypeData();
 
1355
    data->lookupCachedQmlUnit = hookRegistration.lookupCachedQmlUnit;
 
1356
    return 0;
 
1357
}
1347
1358
 
1348
1359
/*
1349
1360
This method is "over generalized" to allow us to (potentially) register more types of things in
1363
1374
        return registerCompositeType(*reinterpret_cast<RegisterCompositeType *>(data));
1364
1375
    } else if (type == CompositeSingletonRegistration) {
1365
1376
        return registerCompositeSingletonType(*reinterpret_cast<RegisterCompositeSingletonType *>(data));
 
1377
    } else if (type == QmlUnitCacheHookRegistration) {
 
1378
        return registerQmlUnitCacheHook(*reinterpret_cast<RegisterQmlUnitCacheHook *>(data));
1366
1379
    }
1367
1380
    return -1;
1368
1381
}
1472
1485
    QQmlMetaTypeData *data = metaTypeData();
1473
1486
 
1474
1487
    // first, check Types
1475
 
    QQmlTypeModule *tm = 
 
1488
    QQmlTypeModule *tm =
1476
1489
        data->uriToModule.value(QQmlMetaTypeData::VersionedUri(module, versionMajor));
1477
1490
    if (tm && tm->minimumMinorVersion() <= versionMinor && tm->maximumMinorVersion() >= versionMinor)
1478
1491
        return true;
1755
1768
}
1756
1769
 
1757
1770
/*!
1758
 
    Returns the type (if any) that corresponds to the QVariant::Type \a userType.  
 
1771
    Returns the type (if any) that corresponds to the QVariant::Type \a userType.
1759
1772
    Returns null if no type is registered.
1760
1773
*/
1761
1774
QQmlType *QQmlMetaType::qmlType(int userType)
1836
1849
}
1837
1850
 
1838
1851
/*!
 
1852
    Returns the list of all registered types.
 
1853
*/
 
1854
QList<QQmlType*> QQmlMetaType::qmlAllTypes()
 
1855
{
 
1856
    QReadLocker lock(metaTypeDataLock());
 
1857
    QQmlMetaTypeData *data = metaTypeData();
 
1858
 
 
1859
    return data->types;
 
1860
}
 
1861
 
 
1862
/*!
1839
1863
    Returns the list of registered QML singleton types.
1840
1864
*/
1841
1865
QList<QQmlType*> QQmlMetaType::qmlSingletonTypes()
1854
1878
    return retn;
1855
1879
}
1856
1880
 
1857
 
int QQmlMetaType::QQuickAnchorLineMetaTypeId()
1858
 
{
1859
 
    static int id = 0;
1860
 
    if (!id) {
1861
 
        id = QMetaType::type("QQuickAnchorLine");
1862
 
    }
1863
 
    return id;
1864
 
}
1865
 
 
1866
 
QQmlMetaType::CompareFunction QQmlMetaType::anchorLineCompareFunction = 0;
1867
 
 
1868
 
void QQmlMetaType::setQQuickAnchorLineCompareFunction(CompareFunction fun)
1869
 
{
1870
 
    anchorLineCompareFunction = fun;
1871
 
}
1872
 
 
1873
 
bool QQmlMetaType::QQuickAnchorLineCompare(const void *p1, const void *p2)
1874
 
{
1875
 
    Q_ASSERT(anchorLineCompareFunction != 0);
1876
 
    return anchorLineCompareFunction(p1, p2);
 
1881
const QQmlPrivate::CachedQmlUnit *QQmlMetaType::findCachedCompilationUnit(const QUrl &uri)
 
1882
{
 
1883
    QReadLocker lock(metaTypeDataLock());
 
1884
    QQmlMetaTypeData *data = metaTypeData();
 
1885
    if (data->lookupCachedQmlUnit)
 
1886
        return data->lookupCachedQmlUnit(uri);
 
1887
    return 0;
1877
1888
}
1878
1889
 
1879
1890
QT_END_NAMESPACE