summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlbasicscript_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-28 00:48:50 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-28 00:57:26 (GMT)
commitb865ab6508963cbad0a12319b40db17f9925bbde (patch)
tree2f9dd738ee06a12248af43591225942d45f17faa /src/declarative/qml/qmlbasicscript_p.h
parentc8f180e7023308b8a051b53943b9a088a7f0c427 (diff)
downloadQt-b865ab6508963cbad0a12319b40db17f9925bbde.zip
Qt-b865ab6508963cbad0a12319b40db17f9925bbde.tar.gz
Qt-b865ab6508963cbad0a12319b40db17f9925bbde.tar.bz2
QmlBasicScript should work on the actual JS AST tree
Diffstat (limited to 'src/declarative/qml/qmlbasicscript_p.h')
-rw-r--r--src/declarative/qml/qmlbasicscript_p.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlbasicscript_p.h
new file mode 100644
index 0000000..1117e11
--- /dev/null
+++ b/src/declarative/qml/qmlbasicscript_p.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLBASICSCRIPT_P_H
+#define QMLBASICSCRIPT_P_H
+
+#include <QtCore/QList>
+#include <QtCore/QByteArray>
+#include <QtCore/QVariant>
+#include <private/qmlparser_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QmlRefCount;
+class QmlContext;
+class QmlBasicScriptPrivate;
+class QmlBasicScriptNodeCache;
+class QmlBasicScript
+{
+public:
+ QmlBasicScript();
+ QmlBasicScript(const char *, QmlRefCount * = 0);
+ ~QmlBasicScript();
+
+ // Always 4-byte aligned
+ const char *compileData() const;
+ unsigned int compileDataSize() const;
+
+ QByteArray expression() const;
+
+ bool compile(const QmlParser::Variant &);
+ bool isValid() const;
+
+ void clear();
+
+ void dump();
+ void *newScriptState();
+ void deleteScriptState(void *);
+
+ enum CacheState { NoChange, Incremental, Reset };
+ QVariant run(QmlContext *, void *, CacheState *);
+
+ // Optimization opportunities
+ bool isSingleLoad() const;
+ QByteArray singleLoadTarget() const;
+
+private:
+ int flags;
+ QmlBasicScriptPrivate *d;
+ QmlRefCount *rc;
+
+ void clearCache(void *);
+ void guard(QmlBasicScriptNodeCache &);
+ bool valid(QmlBasicScriptNodeCache &, QObject *);
+};
+
+class QmlContextPrivate;
+class QDebug;
+class QmlBasicScriptNodeCache
+{
+public:
+ QObject *object;
+ const QMetaObject *metaObject;
+ enum { Invalid,
+ Core,
+ Attached,
+ Signal,
+ SignalProperty,
+ Variant
+ } type;
+ union {
+ int core;
+ QObject *attached;
+ QmlContextPrivate *context;
+ };
+ int coreType;
+ int contextIndex;
+
+ bool isValid() const { return type != Invalid; }
+ bool isCore() const { return type == Core; }
+ bool isVariant() const { return type == Variant; }
+ void clear();
+ QVariant value(const char *) const;
+};
+
+QDebug operator<<(QDebug, const QmlBasicScriptNodeCache &);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QMLBASICSCRIPT_P_H
+
+