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 {
192 struct instr_assignBinding {
194 unsigned int property;
205 struct instr_fetchValue {
209 quint32 bindingSkipList;
211 struct instr_fetchQmlList {
220 struct instr_storeFloat {
225 struct instr_storeDouble {
230 struct instr_storeInteger {
235 struct instr_storeBool {
240 struct instr_storeString {
245 struct instr_storeByteArray {
250 struct instr_storeScriptString {
258 struct instr_storeScript {
262 struct instr_storeUrl {
267 struct instr_storeColor {
272 struct instr_storeDate {
277 struct instr_storeTime {
282 #if defined(Q_OS_WINCE)
287 struct instr_storeDateTime {
291 instr_storeTime::QTime time;
293 struct instr_storeRect {
297 #if defined(Q_OS_MAC)
310 struct instr_storeRectF {
320 struct instr_storeObject {
325 struct instr_assignCustomType {
332 struct instr_storeSignal {
340 struct instr_assignSignalObject {
345 struct instr_createComponent {
353 struct instr_fetchAttached {
362 struct instr_assignObjectList {
366 struct instr_storePoint {
370 #if defined(Q_OS_MAC)
379 struct instr_storePointF {
387 struct instr_storeSize {
395 struct instr_storeSizeF {
403 struct instr_storeVector3D {
416 instr_createSimple createSimple;
417 instr_storeMeta storeMeta;
419 instr_assignValueSource assignValueSource;
420 instr_assignValueInterceptor assignValueInterceptor;
421 instr_initV8Bindings initV8Bindings;
422 instr_assignBinding assignBinding;
424 instr_fetchValue fetchValue;
425 instr_fetchQmlList fetchQmlList;
427 instr_storeFloat storeFloat;
428 instr_storeDouble storeDouble;
429 instr_storeInteger storeInteger;
430 instr_storeBool storeBool;
431 instr_storeString storeString;
432 instr_storeByteArray storeByteArray;
433 instr_storeScriptString storeScriptString;
434 instr_storeScript storeScript;
435 instr_storeUrl storeUrl;
436 instr_storeColor storeColor;
437 instr_storeDate storeDate;
438 instr_storeTime storeTime;
439 instr_storeDateTime storeDateTime;
440 instr_storePoint storePoint;
441 instr_storePointF storePointF;
442 instr_storeSize storeSize;
443 instr_storeSizeF storeSizeF;
444 instr_storeRect storeRect;
445 instr_storeRectF storeRectF;
446 instr_storeVector3D storeVector3D;
447 instr_storeObject storeObject;
448 instr_assignCustomType assignCustomType;
449 instr_storeSignal storeSignal;
450 instr_assignSignalObject assignSignalObject;
451 instr_createComponent createComponent;
452 instr_fetchAttached fetchAttached;
454 instr_assignObjectList assignObjectList;
460 struct QDeclarativeInstructionMeta {
463 #define QML_INSTR_META_TEMPLATE(I, FMT) \
464 template<> struct QDeclarativeInstructionMeta<(int)QDeclarativeInstruction::I> { \
465 enum { Size = QML_INSTR_SIZE(I, FMT) }; \
466 typedef QDeclarativeInstruction::instr_##FMT DataType; \
467 static const DataType &data(const QDeclarativeInstruction &instr) { return instr.FMT; } \
469 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
470 #undef QML_INSTR_META_TEMPLATE
474 #endif // QDECLARATIVEINSTRUCTION_P_H