1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QDECLARATIVEINSTRUCTION_P_H
43 #define QDECLARATIVEINSTRUCTION_P_H
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
56 #include <QtCore/qglobal.h>
60 #define FOR_EACH_QML_INSTR(F) \
63 F(CreateObject, create) \
64 F(CreateSimpleObject, createSimple) \
66 F(SetDefault, common) \
67 F(CreateComponent, createComponent) \
68 F(StoreMetaObject, storeMeta) \
69 F(StoreVariant, storeString) \
70 F(StoreVariantInteger, storeInteger) \
71 F(StoreVariantDouble, storeDouble) \
72 F(StoreVariantBool, storeBool) \
73 F(StoreString, storeString) \
74 F(StoreByteArray, storeByteArray) \
75 F(StoreUrl, storeUrl) \
76 F(StoreFloat, storeFloat) \
77 F(StoreDouble, storeDouble) \
78 F(StoreBool, storeBool) \
79 F(StoreInteger, storeInteger) \
80 F(StoreColor, storeColor) \
81 F(StoreDate, storeDate) \
82 F(StoreTime, storeTime) \
83 F(StoreDateTime, storeDateTime) \
84 F(StorePoint, storePoint) \
85 F(StorePointF, storePointF) \
86 F(StoreSize, storeSize) \
87 F(StoreSizeF, storeSizeF) \
88 F(StoreRect, storeRect) \
89 F(StoreRectF, storeRectF) \
90 F(StoreVector3D, storeVector3D) \
91 F(StoreObject, storeObject) \
92 F(AssignCustomType, assignCustomType) \
93 F(AssignSignalObject, assignSignalObject) \
94 F(StoreSignal, storeSignal) \
95 F(StoreImportedScript, storeScript) \
96 F(StoreScriptString, storeScriptString) \
97 F(BeginObject, begin) \
98 F(InitV8Bindings, initV8Bindings) \
99 F(StoreBinding, assignBinding) \
100 F(StoreBindingOnAlias, assignBinding) \
101 F(StoreV4Binding, assignBinding) \
102 F(StoreV8Binding, assignBinding) \
103 F(StoreValueSource, assignValueSource) \
104 F(StoreValueInterceptor, assignValueInterceptor) \
105 F(StoreObjectQList, common) \
106 F(AssignObjectList, assignObjectList) \
107 F(StoreVariantObject, storeObject) \
108 F(StoreInterface, storeObject) \
109 F(FetchAttached, fetchAttached) \
110 F(FetchQList, fetchQmlList) \
111 F(FetchObject, fetch) \
112 F(PopQList, common) \
114 F(PopFetchedObject, common) \
115 F(FetchValueType, fetchValue) \
116 F(PopValueType, fetchValue)
119 # define QML_INSTR_ALIGN_MASK (Q_ALIGNOF(QDeclarativeInstruction) - 1)
121 # define QML_INSTR_ALIGN_MASK (sizeof(void *) - 1)
124 #define QML_INSTR_HEADER quint8 instructionType;
125 #define QML_INSTR_ENUM(I, FMT) I,
126 #define QML_INSTR_SIZE(I, FMT) ((sizeof(QDeclarativeInstruction::instr_##FMT) + QML_INSTR_ALIGN_MASK) & ~QML_INSTR_ALIGN_MASK)
128 class QDeclarativeCompiledData;
129 union QDeclarativeInstruction
132 FOR_EACH_QML_INSTR(QML_INSTR_ENUM)
135 inline void setType(Type type) { common.instructionType = type; }
136 inline Type type() const { return (Type)common.instructionType; }
138 struct instr_common {
144 int parserStatusSize;
148 struct instr_create {
156 struct instr_createSimple {
158 void (*create)(void *);
164 struct instr_storeMeta {
175 struct instr_assignValueSource {
181 struct instr_assignValueInterceptor {
187 struct instr_initV8Bindings {
193 struct instr_assignBinding {
195 unsigned int property;
206 struct instr_fetchValue {
210 quint32 bindingSkipList;
212 struct instr_fetchQmlList {
221 struct instr_storeFloat {
226 struct instr_storeDouble {
231 struct instr_storeInteger {
236 struct instr_storeBool {
241 struct instr_storeString {
246 struct instr_storeByteArray {
251 struct instr_storeScriptString {
259 struct instr_storeScript {
263 struct instr_storeUrl {
268 struct instr_storeColor {
273 struct instr_storeDate {
278 struct instr_storeTime {
283 #if defined(Q_OS_WINCE)
288 struct instr_storeDateTime {
292 instr_storeTime::QTime time;
294 struct instr_storeRect {
298 #if defined(Q_OS_MAC)
311 struct instr_storeRectF {
321 struct instr_storeObject {
326 struct instr_assignCustomType {
333 struct instr_storeSignal {
341 struct instr_assignSignalObject {
346 struct instr_createComponent {
354 struct instr_fetchAttached {
363 struct instr_assignObjectList {
367 struct instr_storePoint {
375 struct instr_storePointF {
383 struct instr_storeSize {
391 struct instr_storeSizeF {
399 struct instr_storeVector3D {
412 instr_createSimple createSimple;
413 instr_storeMeta storeMeta;
415 instr_assignValueSource assignValueSource;
416 instr_assignValueInterceptor assignValueInterceptor;
417 instr_initV8Bindings initV8Bindings;
418 instr_assignBinding assignBinding;
420 instr_fetchValue fetchValue;
421 instr_fetchQmlList fetchQmlList;
423 instr_storeFloat storeFloat;
424 instr_storeDouble storeDouble;
425 instr_storeInteger storeInteger;
426 instr_storeBool storeBool;
427 instr_storeString storeString;
428 instr_storeByteArray storeByteArray;
429 instr_storeScriptString storeScriptString;
430 instr_storeScript storeScript;
431 instr_storeUrl storeUrl;
432 instr_storeColor storeColor;
433 instr_storeDate storeDate;
434 instr_storeTime storeTime;
435 instr_storeDateTime storeDateTime;
436 instr_storePoint storePoint;
437 instr_storePointF storePointF;
438 instr_storeSize storeSize;
439 instr_storeSizeF storeSizeF;
440 instr_storeRect storeRect;
441 instr_storeRectF storeRectF;
442 instr_storeVector3D storeVector3D;
443 instr_storeObject storeObject;
444 instr_assignCustomType assignCustomType;
445 instr_storeSignal storeSignal;
446 instr_assignSignalObject assignSignalObject;
447 instr_createComponent createComponent;
448 instr_fetchAttached fetchAttached;
450 instr_assignObjectList assignObjectList;
456 struct QDeclarativeInstructionMeta {
459 #define QML_INSTR_META_TEMPLATE(I, FMT) \
460 template<> struct QDeclarativeInstructionMeta<(int)QDeclarativeInstruction::I> { \
461 enum { Size = QML_INSTR_SIZE(I, FMT) }; \
462 typedef QDeclarativeInstruction::instr_##FMT DataType; \
463 static const DataType &data(const QDeclarativeInstruction &instr) { return instr.FMT; } \
465 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
466 #undef QML_INSTR_META_TEMPLATE
470 #endif // QDECLARATIVEINSTRUCTION_P_H