Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativecontext_p.h
index 9a068bb..dab0016 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** 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$
 **
 ****************************************************************************/
 
 #include "qdeclarativecontext.h"
 
-#include "private/qdeclarativedata_p.h"
-#include "private/qdeclarativeintegercache_p.h"
-#include "private/qdeclarativetypenamecache_p.h"
-#include "private/qdeclarativenotifier_p.h"
+#include "qdeclarativedata_p.h"
+#include "qdeclarativeintegercache_p.h"
+#include "qdeclarativetypenamecache_p.h"
+#include "qdeclarativenotifier_p.h"
 #include "qdeclarativelist.h"
-#include "private/qdeclarativescript_p.h"
+#include "qdeclarativescript_p.h"
 
 #include <QtCore/qhash.h>
 #include <QtDeclarative/qjsvalue.h>
 #include <QtCore/qset.h>
 
 #include <private/qobject_p.h>
-#include "private/qdeclarativeguard_p.h"
+#include <private/qflagpointer_p.h>
+#include <private/qdeclarativeguard_p.h>
 
 #include <private/qv8_p.h>
 
+
 QT_BEGIN_NAMESPACE
 
 class QV8Bindings;
@@ -80,7 +82,7 @@ class QDeclarativeEngine;
 class QDeclarativeExpression;
 class QDeclarativeExpressionPrivate;
 class QDeclarativeAbstractExpression;
-class QDeclarativeV4Bindings;
+class QV4Bindings;
 class QDeclarativeContextData;
 
 class QDeclarativeContextPrivate : public QObjectPrivate
@@ -108,6 +110,7 @@ public:
     static QObject *context_at(QDeclarativeListProperty<QObject> *, int);
 };
 
+class QDeclarativeVME;
 class QDeclarativeComponentAttached;
 class QDeclarativeGuardedContextData;
 class Q_DECLARATIVE_EXPORT QDeclarativeContextData
@@ -142,9 +145,13 @@ public:
     quint32 ownedByParent:1; // unrelated to isInternal; parent context deletes children if true.
     quint32 isJSContext:1;
     quint32 isPragmaLibraryContext:1;
+    quint32 unresolvedNames:1; // True if expressions in this context failed to resolve a toplevel name
     quint32 dummy:28;
     QDeclarativeContext *publicContext;
 
+    // VME data that is constructing this context if any
+    void *activeVMEData;
+
     // Property name cache
     QDeclarativeIntegerCache *propertyNames;
 
@@ -179,13 +186,13 @@ public:
     // id guards
     struct ContextGuard : public QDeclarativeGuard<QObject>
     {
-        ContextGuard() : context(0) {}
-        inline ContextGuard &operator=(QObject *obj)
-        { QDeclarativeGuard<QObject>::operator=(obj); return *this; }
-        virtual void objectDestroyed(QObject *) { 
-            if (context->contextObject && !QObjectPrivate::get(context->contextObject)->wasDeleted) bindings.notify(); 
-        }
-        QDeclarativeContextData *context;
+        inline ContextGuard();
+        inline ContextGuard &operator=(QObject *obj);
+        inline void objectDestroyed(QObject *);
+
+        inline bool wasSet() const;
+
+        QFlagPointer<QDeclarativeContextData> context;
         QDeclarativeNotifier bindings;
     };
     ContextGuard *idValues;
@@ -201,7 +208,7 @@ public:
     QDeclarativeComponentAttached *componentAttached;
 
     // Optimized binding objects.  Needed for deferred properties.
-    QDeclarativeV4Bindings *v4bindings;
+    QV4Bindings *v4bindings;
     QV8Bindings *v8bindings;
 
     // Return the outermost id for obj, if any.
@@ -212,6 +219,8 @@ public:
     }
 
 private:
+    void refreshExpressionsRecursive(bool isGlobal);
+    void refreshExpressionsRecursive(QDeclarativeAbstractExpression *);
     ~QDeclarativeContextData() {}
 };
 
@@ -295,6 +304,30 @@ QDeclarativeGuardedContextData::operator=(QDeclarativeContextData *d)
     return *this;
 }
 
+QDeclarativeContextData::ContextGuard::ContextGuard()
+: context(0)
+{
+}
+
+QDeclarativeContextData::ContextGuard &QDeclarativeContextData::ContextGuard::operator=(QObject *obj)
+{
+    QDeclarativeGuard<QObject>::operator=(obj);
+    context.setFlag();
+    bindings.notify(); // For alias connections
+    return *this;
+}
+
+void QDeclarativeContextData::ContextGuard::objectDestroyed(QObject *)
+{
+    if (context->contextObject && !QObjectPrivate::get(context->contextObject)->wasDeleted)
+        bindings.notify();
+}
+
+bool QDeclarativeContextData::ContextGuard::wasSet() const
+{
+    return context.flag();
+}
+
 QT_END_NAMESPACE
 
 #endif // QDECLARATIVECONTEXT_P_H