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(StoreBinding, assignBinding) \
99 F(StoreBindingOnAlias, assignBinding) \
100 F(StoreCompiledBinding, assignBinding) \
101 F(StoreValueSource, assignValueSource) \
102 F(StoreValueInterceptor, assignValueInterceptor) \
103 F(StoreObjectQList, common) \
104 F(AssignObjectList, assignObjectList) \
105 F(StoreVariantObject, storeObject) \
106 F(StoreInterface, storeObject) \
107 F(FetchAttached, fetchAttached) \
108 F(FetchQList, fetchQmlList) \
109 F(FetchObject, fetch) \
110 F(PopQList, common) \
112 F(PopFetchedObject, common) \
113 F(FetchValueType, fetchValue) \
114 F(PopValueType, fetchValue)
117 # define QML_INSTR_ALIGN_MASK (Q_ALIGNOF(QDeclarativeInstruction) - 1)
119 # define QML_INSTR_ALIGN_MASK (sizeof(void *) - 1)
122 #define QML_INSTR_HEADER quint8 instructionType;
123 #define QML_INSTR_ENUM(I, FMT) I,
124 #define QML_INSTR_SIZE(I, FMT) ((sizeof(QDeclarativeInstruction::instr_##FMT) + QML_INSTR_ALIGN_MASK) & ~QML_INSTR_ALIGN_MASK)
126 class QDeclarativeCompiledData;
127 union QDeclarativeInstruction
130 FOR_EACH_QML_INSTR(QML_INSTR_ENUM)
133 inline void setType(Type type) { common.instructionType = type; }
134 inline Type type() const { return (Type)common.instructionType; }
136 struct instr_common {
142 int parserStatusSize;
146 struct instr_create {
154 struct instr_createSimple {
156 void (*create)(void *);
162 struct instr_storeMeta {
173 struct instr_assignValueSource {
179 struct instr_assignValueInterceptor {
185 struct instr_assignBinding {
187 unsigned int property;
198 struct instr_fetchValue {
202 quint32 bindingSkipList;
204 struct instr_fetchQmlList {
213 struct instr_storeFloat {
218 struct instr_storeDouble {
223 struct instr_storeInteger {
228 struct instr_storeBool {
233 struct instr_storeString {
238 struct instr_storeByteArray {
243 struct instr_storeScriptString {
249 struct instr_storeScript {
253 struct instr_storeUrl {
258 struct instr_storeColor {
263 struct instr_storeDate {
268 struct instr_storeTime {
273 #if defined(Q_OS_WINCE)
278 struct instr_storeDateTime {
282 instr_storeTime::QTime time;
284 struct instr_storeRect {
288 #if defined(Q_OS_MAC)
301 struct instr_storeRectF {
311 struct instr_storeObject {
316 struct instr_assignCustomType {
323 struct instr_storeSignal {
331 struct instr_assignSignalObject {
336 struct instr_createComponent {
344 struct instr_fetchAttached {
353 struct instr_assignObjectList {
357 struct instr_storePoint {
361 #if defined(Q_OS_MAC)
370 struct instr_storePointF {
378 struct instr_storeSize {
386 struct instr_storeSizeF {
394 struct instr_storeVector3D {
407 instr_createSimple createSimple;
408 instr_storeMeta storeMeta;
410 instr_assignValueSource assignValueSource;
411 instr_assignValueInterceptor assignValueInterceptor;
412 instr_assignBinding assignBinding;
414 instr_fetchValue fetchValue;
415 instr_fetchQmlList fetchQmlList;
417 instr_storeFloat storeFloat;
418 instr_storeDouble storeDouble;
419 instr_storeInteger storeInteger;
420 instr_storeBool storeBool;
421 instr_storeString storeString;
422 instr_storeByteArray storeByteArray;
423 instr_storeScriptString storeScriptString;
424 instr_storeScript storeScript;
425 instr_storeUrl storeUrl;
426 instr_storeColor storeColor;
427 instr_storeDate storeDate;
428 instr_storeTime storeTime;
429 instr_storeDateTime storeDateTime;
430 instr_storePoint storePoint;
431 instr_storePointF storePointF;
432 instr_storeSize storeSize;
433 instr_storeSizeF storeSizeF;
434 instr_storeRect storeRect;
435 instr_storeRectF storeRectF;
436 instr_storeVector3D storeVector3D;
437 instr_storeObject storeObject;
438 instr_assignCustomType assignCustomType;
439 instr_storeSignal storeSignal;
440 instr_assignSignalObject assignSignalObject;
441 instr_createComponent createComponent;
442 instr_fetchAttached fetchAttached;
444 instr_assignObjectList assignObjectList;
450 struct QDeclarativeInstructionMeta {
453 #define QML_INSTR_META_TEMPLATE(I, FMT) \
454 template<> struct QDeclarativeInstructionMeta<(int)QDeclarativeInstruction::I> { \
455 enum { Size = QML_INSTR_SIZE(I, FMT) }; \
456 typedef QDeclarativeInstruction::instr_##FMT DataType; \
457 static const DataType &data(const QDeclarativeInstruction &instr) { return instr.FMT; } \
459 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
460 #undef QML_INSTR_META_TEMPLATE
464 #endif // QDECLARATIVEINSTRUCTION_P_H