1 /****************************************************************************
3 ** Copyright (C) 2012 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>
57 #include <private/qdeclarativepropertycache_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(QDeclarativeInstruction) - 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(QDeclarativeInstruction::instr_##FMT) + QML_INSTR_ALIGN_MASK) & ~QML_INSTR_ALIGN_MASK)
155 class QDeclarativeCompiledData;
156 union QDeclarativeInstruction
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 QDeclarativePropertyRawData property;
226 struct instr_assignValueInterceptor {
228 QDeclarativePropertyRawData property;
232 struct instr_initV8Bindings {
238 struct instr_assignV4Binding {
240 unsigned int property;
248 struct instr_assignBinding {
250 QDeclarativePropertyRawData property;
263 struct instr_fetchValue {
267 quint32 bindingSkipList;
269 struct instr_fetchQmlList {
278 struct instr_storeFloat {
283 struct instr_storeDouble {
288 struct instr_storeInteger {
293 struct instr_storeBool {
298 struct instr_storeString {
303 struct instr_storeTrString {
311 struct instr_storeTrIdString {
317 struct instr_storeByteArray {
322 struct instr_storeScriptString {
331 struct instr_storeScript {
335 struct instr_storeUrl {
340 struct instr_storeColor {
345 struct instr_storeDate {
350 struct instr_storeTime {
355 #if defined(Q_OS_WINCE)
360 struct instr_storeDateTime {
364 instr_storeTime::QTime time;
366 struct instr_storeRect {
376 struct instr_storeRectF {
386 struct instr_storeObject {
391 struct instr_assignCustomType {
398 struct instr_storeSignal {
406 struct instr_assignSignalObject {
411 struct instr_createComponent {
420 struct instr_fetchAttached {
429 struct instr_assignObjectList {
433 struct instr_storePoint {
441 struct instr_storePointF {
449 struct instr_storeSize {
457 struct instr_storeSizeF {
465 struct instr_storeVector3D {
474 struct instr_storeVector4D {
487 instr_deferInit deferInit;
489 instr_createQml createQml;
490 instr_completeQml completeQml;
491 instr_createSimple createSimple;
492 instr_storeMeta storeMeta;
494 instr_assignValueSource assignValueSource;
495 instr_assignValueInterceptor assignValueInterceptor;
496 instr_initV8Bindings initV8Bindings;
497 instr_assignV4Binding assignV4Binding;
498 instr_assignBinding assignBinding;
500 instr_fetchValue fetchValue;
501 instr_fetchQmlList fetchQmlList;
503 instr_storeFloat storeFloat;
504 instr_storeDouble storeDouble;
505 instr_storeInteger storeInteger;
506 instr_storeBool storeBool;
507 instr_storeString storeString;
508 instr_storeTrString storeTrString;
509 instr_storeTrIdString storeTrIdString;
510 instr_storeByteArray storeByteArray;
511 instr_storeScriptString storeScriptString;
512 instr_storeScript storeScript;
513 instr_storeUrl storeUrl;
514 instr_storeColor storeColor;
515 instr_storeDate storeDate;
516 instr_storeTime storeTime;
517 instr_storeDateTime storeDateTime;
518 instr_storePoint storePoint;
519 instr_storePointF storePointF;
520 instr_storeSize storeSize;
521 instr_storeSizeF storeSizeF;
522 instr_storeRect storeRect;
523 instr_storeRectF storeRectF;
524 instr_storeVector3D storeVector3D;
525 instr_storeVector4D storeVector4D;
526 instr_storeObject storeObject;
527 instr_assignCustomType assignCustomType;
528 instr_storeSignal storeSignal;
529 instr_assignSignalObject assignSignalObject;
530 instr_createComponent createComponent;
531 instr_fetchAttached fetchAttached;
533 instr_assignObjectList assignObjectList;
535 static int size(Type type);
539 struct QDeclarativeInstructionMeta {
542 #define QML_INSTR_META_TEMPLATE(I, FMT) \
543 template<> struct QDeclarativeInstructionMeta<(int)QDeclarativeInstruction::I> { \
544 enum { Size = QML_INSTR_SIZE(I, FMT) }; \
545 typedef QDeclarativeInstruction::instr_##FMT DataType; \
546 static const DataType &data(const QDeclarativeInstruction &instr) { return instr.FMT; } \
547 static void setData(QDeclarativeInstruction &instr, const DataType &v) { instr.FMT = v; } \
549 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
550 #undef QML_INSTR_META_TEMPLATE
553 class QDeclarativeInstructionData : public QDeclarativeInstructionMeta<Instr>::DataType
559 #endif // QDECLARATIVEINSTRUCTION_P_H