QML_RUNTIME_TESTING should be disabled by default.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativepropertycache_p.h
index 9d3ccf8..d5d7095 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -146,11 +146,17 @@ public:
     bool isSignalHandler() const { return flags & IsSignalHandler; }
     bool isOverload() const { return flags & IsOverload; }
 
-    bool hasOverride() const { return !(flags & IsValueTypeVirtual) && overrideIndex >= 0; }
+    bool hasOverride() const { return !(flags & IsValueTypeVirtual) &&
+                                      !(flags & HasAccessors) &&
+                                      overrideIndex >= 0; }
 
     // Returns -1 if not a value type virtual property
     inline int getValueTypeCoreIndex() const;
 
+    // Returns the "encoded" index for use with bindings.  Encoding is:
+    //     coreIndex | (valueTypeCoreIndex << 24)
+    inline int encodedIndex() const;
+
     union {
         int propType;             // When !NotFullyResolved
         const char *propTypeName; // When NotFullyResolved
@@ -160,28 +166,34 @@ public:
         int notifyIndex;  // When !IsFunction
         void *arguments;  // When IsFunction && HasArguments
     };
+
     union {
-        struct { // When !IsValueTypeVirtual
-            uint overrideIndexIsProperty : 1;
-            signed int overrideIndex : 31;
+        struct { // When !HasAccessors
+            qint16 revision;
+            qint16 metaObjectOffset;
+
+            union {
+                struct { // When IsValueTypeVirtual
+                    quint16 valueTypeFlags; // flags of the access property on the value type proxy
+                                            // object
+                    quint8 valueTypePropType; // The QVariant::Type of access property on the value
+                                              // type proxy object
+                    quint8 valueTypeCoreIndex; // The prop index of the access property on the value
+                                               // type proxy object
+                };
+
+                struct { // When !IsValueTypeVirtual
+                    uint overrideIndexIsProperty : 1;
+                    signed int overrideIndex : 31;
+                };
+            };
         };
-        struct { // When IsValueTypeVirtual
-            quint16 valueTypeFlags; // flags of the access property on the value type proxy object
-            quint8 valueTypePropType; // The QVariant::Type of access property on the value type
-                                      // proxy object
-            quint8 valueTypeCoreIndex; // The prop index of the access property on the value type
-                                       //proxy object
+        struct { // When HasAccessors
+            QDeclarativeAccessors *accessors;
+            intptr_t accessorData;
         };
     };
 
-    qint16 revision;
-    qint16 metaObjectOffset;
-
-    struct { // When HasAccessors
-        QDeclarativeAccessors *accessors;
-        intptr_t accessorData;
-    };
-
 private:
     friend class QDeclarativePropertyData;
     friend class QDeclarativePropertyCache;
@@ -306,8 +318,6 @@ QDeclarativePropertyData::QDeclarativePropertyData()
     overrideIndex = -1;
     revision = 0;
     metaObjectOffset = -1; 
-    accessors = 0;
-    accessorData = 0;
     flags = 0;
 }
 
@@ -333,6 +343,11 @@ int QDeclarativePropertyRawData::getValueTypeCoreIndex() const
     return isValueTypeVirtual()?valueTypeCoreIndex:-1;
 }
 
+int QDeclarativePropertyRawData::encodedIndex() const
+{
+    return isValueTypeVirtual()?(coreIndex | (valueTypeCoreIndex << 24)):coreIndex;
+}
+
 QDeclarativePropertyData *
 QDeclarativePropertyCache::overrideData(QDeclarativePropertyData *data) const
 {
@@ -347,7 +362,7 @@ QDeclarativePropertyCache::overrideData(QDeclarativePropertyData *data) const
 
 bool QDeclarativePropertyCache::isAllowedInRevision(QDeclarativePropertyData *data) const
 {
-    return (data->metaObjectOffset == -1 && data->revision == 0) ||
+    return (data->hasAccessors() || (data->metaObjectOffset == -1 && data->revision == 0)) ||
            (allowedRevisionCache[data->metaObjectOffset] >= data->revision);
 }