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 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
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, storeRealPair) \
85 F(StorePointF, storeRealPair) \
86 F(StoreSize, storeRealPair) \
87 F(StoreSizeF, storeRealPair) \
88 F(StoreRect, storeRect) \
89 F(StoreRectF, storeRect) \
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 struct instr_storeDateTime {
278 struct instr_storeRealPair {
283 struct instr_storeRect {
288 struct instr_storeVector3D {
293 struct instr_storeObject {
298 struct instr_assignCustomType {
304 struct instr_storeSignal {
312 struct instr_assignSignalObject {
317 struct instr_createComponent {
325 struct instr_fetchAttached {
334 struct instr_assignObjectList {
342 instr_createSimple createSimple;
343 instr_storeMeta storeMeta;
345 instr_assignValueSource assignValueSource;
346 instr_assignValueInterceptor assignValueInterceptor;
347 instr_assignBinding assignBinding;
349 instr_fetchValue fetchValue;
350 instr_fetchQmlList fetchQmlList;
352 instr_storeFloat storeFloat;
353 instr_storeDouble storeDouble;
354 instr_storeInteger storeInteger;
355 instr_storeBool storeBool;
356 instr_storeString storeString;
357 instr_storeByteArray storeByteArray;
358 instr_storeScriptString storeScriptString;
359 instr_storeScript storeScript;
360 instr_storeUrl storeUrl;
361 instr_storeColor storeColor;
362 instr_storeDate storeDate;
363 instr_storeTime storeTime;
364 instr_storeDateTime storeDateTime;
365 instr_storeRealPair storeRealPair;
366 instr_storeRect storeRect;
367 instr_storeVector3D storeVector3D;
368 instr_storeObject storeObject;
369 instr_assignCustomType assignCustomType;
370 instr_storeSignal storeSignal;
371 instr_assignSignalObject assignSignalObject;
372 instr_createComponent createComponent;
373 instr_fetchAttached fetchAttached;
375 instr_assignObjectList assignObjectList;
381 struct QDeclarativeInstructionMeta {
384 #define QML_INSTR_META_TEMPLATE(I, FMT) \
385 template<> struct QDeclarativeInstructionMeta<(int)QDeclarativeInstruction::I> { \
386 enum { Size = QML_INSTR_SIZE(I, FMT) }; \
387 typedef QDeclarativeInstruction::instr_##FMT DataType; \
388 static const DataType &data(const QDeclarativeInstruction &instr) { return instr.FMT; } \
390 FOR_EACH_QML_INSTR(QML_INSTR_META_TEMPLATE);
391 #undef QML_INSTR_META_TEMPLATE
395 #endif // QDECLARATIVEINSTRUCTION_P_H