1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtQml module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QQMLINSTRUCTION_P_H
43 #define QQMLINSTRUCTION_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>
57 #include <private/qqmlpropertycache_p.h>
61 #define FOR_EACH_QML_INSTR(F) \
63 F(DeferInit, deferInit) \
65 F(CreateCppObject, create) \
66 F(CreateQMLObject, createQml) \
67 F(CompleteQMLObject, completeQml) \
68 F(CreateSimpleObject, createSimple) \
70 F(SetDefault, common) \
71 F(CreateComponent, createComponent) \
72 F(StoreMetaObject, storeMeta) \
73 F(StoreVariant, storeString) \
74 F(StoreVariantInteger, storeInteger) \
75 F(StoreVariantDouble, storeDouble) \
76 F(StoreVariantBool, storeBool) \
77 F(StoreVar, storeString) \
78 F(StoreVarInteger, storeInteger) \
79 F(StoreVarDouble, storeDouble) \
80 F(StoreVarBool, storeBool) \
81 F(StoreString, storeString) \
82 F(StoreStringList, storeString) \
83 F(StoreStringQList, storeString) \
84 F(StoreTrString, storeTrString) \
85 F(StoreTrIdString, storeTrIdString) \
86 F(StoreByteArray, storeByteArray) \
87 F(StoreUrl, storeUrl) \
88 F(StoreUrlQList, storeUrl) \
89 F(StoreFloat, storeFloat) \
90 F(StoreDouble, storeDouble) \
91 F(StoreDoubleQList, storeDouble) \
92 F(StoreBool, storeBool) \
93 F(StoreBoolQList, storeBool) \
94 F(StoreInteger, storeInteger) \
95 F(StoreIntegerQList, storeInteger) \
96 F(StoreColor, storeColor) \
97 F(StoreDate, storeDate) \
98 F(StoreTime, storeTime) \
99 F(StoreDateTime, storeDateTime) \
100 F(StorePoint, storePoint) \
101 F(StorePointF, storePointF) \
102 F(StoreSize, storeSize) \
103 F(StoreSizeF, storeSizeF) \
104 F(StoreRect, storeRect) \
105 F(StoreRectF, storeRectF) \
106 F(StoreVector3D, storeVector3D) \
107 F(StoreVector4D, storeVector4D) \
108 F(StoreObject, storeObject) \
109 F(AssignCustomType, assignCustomType) \
110 F(AssignSignalObject, assignSignalObject) \
111 F(StoreSignal, storeSignal) \
112 F(StoreImportedScript, storeScript) \
113 F(StoreScriptString, storeScriptString) \
114 F(BeginObject, begin) \
115 F(InitV8Bindings, initV8Bindings) \
116 F(StoreBinding, assignBinding) \
117 F(StoreBindingOnAlias, assignBinding) \
118 F(StoreV8Binding, assignBinding) \
119 F(StoreV4Binding, assignV4Binding) \
120 F(StoreValueSource, assignValueSource) \
121 F(StoreValueInterceptor, assignValueInterceptor) \
122 F(StoreObjectQList, common) \
123 F(AssignObjectList, assignObjectList) \
124 F(StoreVariantObject, storeObject) \
125 F(StoreVarObject, storeObject) \
126 F(StoreInterface, storeObject) \
127 F(FetchAttached, fetchAttached) \
128 F(FetchQList, fetchQmlList) \
129 F(FetchObject, fetch) \
130 F(PopQList, common) \
132 F(PopFetchedObject, common) \
133 F(FetchValueType, fetchValue) \
134 F(PopValueType, fetchValue)
136 #if defined(Q_CC_GNU) && (!defined(Q_CC_INTEL) || __INTEL_COMPILER >= 1200)
137 # define QML_THREADED_VME_INTERPRETER
141 # define QML_INSTR_ALIGN_MASK (Q_ALIGNOF(QQmlInstruction) - 1)
143 # define QML_INSTR_ALIGN_MASK (sizeof(void *) - 1)
146 #ifdef QML_THREADED_VME_INTERPRETER
147 # define QML_INSTR_HEADER void *code;
149 # define QML_INSTR_HEADER quint8 instructionType;
152 #define QML_INSTR_ENUM(I, FMT) I,
153 #define QML_INSTR_SIZE(I, FMT) ((sizeof(QQmlInstruction::instr_##FMT) + QML_INSTR_ALIGN_MASK) & ~QML_INSTR_ALIGN_MASK)
155 class QQmlCompiledData;
156 union QQmlInstruction
159 FOR_EACH_QML_INSTR(QML_INSTR_ENUM)
162 struct instr_common {
168 int parserStatusSize;
174 struct instr_deferInit {
177 int parserStatusSize;
181 struct instr_createQml {
187 struct instr_completeQml {
193 struct instr_create {
201 struct instr_createSimple {
203 void (*create)(void *);
209 struct instr_storeMeta {
220 struct instr_assignValueSource {
222 QQmlPropertyRawData property;
226 struct instr_assignValueInterceptor {
228 QQmlPropertyRawData property;
232 struct instr_initV8Bindings {
237 struct instr_assignV4Binding {
239 unsigned int property;
247 struct instr_assignBinding {
249 QQmlPropertyRawData property;
262 struct instr_fetchValue {
266 quint32 bindingSkipList;
268 struct instr_fetchQmlList {
277 struct instr_storeFloat {
282 struct instr_storeDouble {
287 struct instr_storeInteger {
292 struct instr_storeBool {
297 struct instr_storeString {
302 struct instr_storeTrString {
310 struct instr_storeTrIdString {
316 struct instr_storeByteArray {
321 struct instr_storeScriptString {
330 struct instr_storeScript {
334 struct instr_storeUrl {
339 struct instr_storeColor {
344 struct instr_storeDate {
349 struct instr_storeTime {
354 #if defined(Q_OS_WINCE)
359 struct instr_storeDateTime {
363 instr_storeTime::QTime time;
365 struct instr_storeRect {
375 struct instr_storeRectF {
385 struct instr_storeObject {
390 struct instr_assignCustomType {
397 struct instr_storeSignal {
405 struct instr_assignSignalObject {
410 struct instr_createComponent {
419 struct instr_fetchAttached {
428 struct instr_assignObjectList {
432 struct instr_storePoint {
440 struct instr_storePointF {
448 struct instr_storeSize {
456 struct instr_storeSizeF {
464 struct instr_storeVector3D {
473 struct instr_storeVector4D {
486 instr_deferInit deferInit;
488 instr_createQml createQml;
489 instr_completeQml completeQml;
490 instr_createSimple createSimple;
491 instr_storeMeta storeMeta;
493 instr_assignValueSource assignValueSource;
494 instr_assignValueInterceptor assignValueInterceptor;
495 instr_initV8Bindings initV8Bindings;
496 instr_assignV4Binding assignV4Binding;
497 instr_assignBinding assignBinding;
499 instr_fetchValue fetchValue;
500 instr_fetchQmlList fetchQmlList;
502 instr_storeFloat storeFloat;
503 instr_storeDouble storeDouble;
504 instr_storeInteger storeInteger;
505 instr_storeBool storeBool;
506 instr_storeString storeString;
507 instr_storeTrString storeTrString;
508 instr_storeTrIdString storeTrIdString;
509 instr_storeByteArray storeByteArray;
510 instr_storeScriptString storeScriptString;
511 instr_storeScript storeScript;
512 instr_storeUrl storeUrl;
513 instr_storeColor storeColor;
514 instr_storeDate storeDate;
515 instr_storeTime storeTime;
516 instr_storeDateTime storeDateTime;
517 instr_storePoint storePoint;
518 instr_storePointF storePointF;
519 instr_storeSize storeSize;
520 instr_storeSizeF storeSizeF;
521 instr_storeRect storeRect;
522 instr_storeRectF storeRectF;
523 instr_storeVector3D storeVector3D;
524 instr_storeVector4D storeVector4D;
525 instr_storeObject storeObject;
526 instr_assignCustomType assignCustomType;
527 instr_storeSignal storeSignal;
528 instr_assignSignalObject assignSignalObject;
529 instr_createComponent createComponent;
530 instr_fetchAttached fetchAttached;
532 instr_assignObjectList assignObjectList;
534 static int size(Type type);
538 struct QQmlInstructionMeta {
541 #define QML_INSTR_META_TEMPLATE(I, FMT) \
542 template<> struct QQmlInstructionMeta<(int)QQmlInstruction::I> { \
543 enum { Size = QML_INSTR_SIZE(I, FMT) }; \
544 typedef QQmlInstruction::instr_##FMT DataType; \
545 static const DataType &data(const QQmlInstruction &instr) { return instr.FMT; } \
546 static void setData(QQmlInstruction &instr, const DataType &v) { instr.FMT = v; } \
548 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
549 #undef QML_INSTR_META_TEMPLATE
552 class QQmlInstructionData : public QQmlInstructionMeta<Instr>::DataType
558 #endif // QQMLINSTRUCTION_P_H