Initial import from qtquick2.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativeinstruction_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 **
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
14 ** this package.
15 **
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.
23 **
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.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QDECLARATIVEINSTRUCTION_P_H
43 #define QDECLARATIVEINSTRUCTION_P_H
44
45 //
46 //  W A R N I N G
47 //  -------------
48 //
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.
52 //
53 // We mean it.
54 //
55
56 #include <QtCore/qglobal.h>
57
58 QT_BEGIN_NAMESPACE
59
60 class QDeclarativeCompiledData;
61 class Q_AUTOTEST_EXPORT QDeclarativeInstruction
62 {
63 public:
64     enum Type { 
65         //
66         // Object Creation
67         //
68         //    CreateObject - Create a new object instance and push it on the 
69         //                   object stack
70         //    SetId - Set the id of the object on the top of the object stack
71         //    SetDefault - Sets the instance on the top of the object stack to
72         //                 be the context's default object.
73         //    StoreMetaObject - Assign the dynamic metaobject to object on the
74         //                      top of the stack.
75         Init,                     /* init */
76         CreateObject,             /* create */
77         CreateSimpleObject,       /* createSimple */
78         SetId,                    /* setId */
79         SetDefault,
80         CreateComponent,          /* createComponent */
81         StoreMetaObject,          /* storeMeta */
82
83         //
84         // Precomputed single assignment
85         //
86         //    StoreFloat - Store a float in a core property
87         //    StoreDouble - Store a double in a core property
88         //    StoreInteger - Store a int or uint in a core property
89         //    StoreBool - Store a bool in a core property
90         //    StoreString - Store a QString in a core property
91         //    StoreByteArray - Store a QByteArray in a core property
92         //    StoreUrl - Store a QUrl in a core property
93         //    StoreColor - Store a QColor in a core property
94         //    StoreDate - Store a QDate in a core property
95         //    StoreTime - Store a QTime in a core property
96         //    StoreDateTime - Store a QDateTime in a core property
97         //    StoreVariant - Store a QVariant in a core property
98         //    StoreObject - Pop the object on the top of the object stack and
99         //                  store it in a core property
100         StoreFloat,               /* storeFloat */
101         StoreDouble,              /* storeDouble */
102         StoreInteger,             /* storeInteger */
103         StoreBool,                /* storeBool */
104         StoreString,              /* storeString */
105         StoreByteArray,           /* storeByteArray */
106         StoreUrl,                 /* storeUrl */
107         StoreColor,               /* storeColor */
108         StoreDate,                /* storeDate */
109         StoreTime,                /* storeTime */
110         StoreDateTime,            /* storeDateTime */
111         StorePoint,               /* storeRealPair */
112         StorePointF,              /* storeRealPair */
113         StoreSize,                /* storeRealPair */
114         StoreSizeF,               /* storeRealPair */
115         StoreRect,                /* storeRect */
116         StoreRectF,               /* storeRect */
117         StoreVector3D,            /* storeVector3D */
118         StoreVariant,             /* storeString */
119         StoreVariantInteger,      /* storeInteger */
120         StoreVariantDouble,       /* storeDouble */
121         StoreVariantBool,         /* storeBool */
122         StoreObject,              /* storeObject */
123         StoreVariantObject,       /* storeObject */
124         StoreInterface,           /* storeObject */
125
126         StoreSignal,              /* storeSignal */
127         StoreImportedScript,      /* storeScript */
128         StoreScriptString,        /* storeScriptString */
129
130         //
131         // Unresolved single assignment
132         //
133         AssignSignalObject,       /* assignSignalObject */
134         AssignCustomType,         /* assignCustomType */
135
136         StoreBinding,             /* assignBinding */
137         StoreBindingOnAlias,      /* assignBinding */
138         StoreCompiledBinding,     /* assignBinding */
139         StoreValueSource,         /* assignValueSource */
140         StoreValueInterceptor,    /* assignValueInterceptor */
141
142         BeginObject,              /* begin */
143
144         StoreObjectQList,         /* NA */
145         AssignObjectList,         /* NA */
146
147         FetchAttached,            /* fetchAttached */
148         FetchQList,               /* fetch */
149         FetchObject,              /* fetch */
150         FetchValueType,           /* fetchValue */
151
152         //
153         // Stack manipulation
154         // 
155         //    PopFetchedObject - Remove an object from the object stack
156         //    PopQList - Remove a list from the list stack
157         PopFetchedObject,
158         PopQList,
159         PopValueType,            /* fetchValue */
160
161         // 
162         // Deferred creation
163         //
164         Defer                    /* defer */
165     };
166     QDeclarativeInstruction()
167         : line(0) {}
168
169     Type type;
170     unsigned short line;
171
172     struct InitInstruction {
173         int bindingsSize;
174         int parserStatusSize;
175         int contextCache;
176         int compiledBinding;
177     };
178     struct CreateInstruction {
179         int type;
180         int data;
181         int bindingBits;
182         ushort column;
183     };
184     struct CreateSimpleInstruction {
185         void (*create)(void *);
186         int typeSize;
187         int type;
188         ushort column;
189     };
190     struct StoreMetaInstruction {
191         int data;
192         int aliasData;
193         int propertyCache;
194     };
195     struct SetIdInstruction {
196         int value;
197         int index;
198     };
199     struct AssignValueSourceInstruction {
200         int property;
201         int owner;
202         int castValue;
203     };
204     struct AssignValueInterceptorInstruction {
205         int property;
206         int owner;
207         int castValue;
208     };
209     struct AssignBindingInstruction {
210         unsigned int property;
211         int value;
212         short context;
213         short owner;
214     };
215     struct FetchInstruction {
216         int property;
217     };
218     struct FetchValueInstruction {
219         int property;
220         int type;
221         quint32 bindingSkipList;
222     };
223     struct FetchQmlListInstruction {
224         int property;
225         int type;
226     };
227     struct BeginInstruction {
228         int castValue;
229     }; 
230     struct StoreFloatInstruction {
231         int propertyIndex;
232         float value;
233     };
234     struct StoreDoubleInstruction {
235         int propertyIndex;
236         double value;
237     };
238     struct StoreIntegerInstruction {
239         int propertyIndex;
240         int value;
241     };
242     struct StoreBoolInstruction {
243         int propertyIndex;
244         bool value;
245     };
246     struct StoreStringInstruction {
247         int propertyIndex;
248         int value;
249     };
250     struct StoreByteArrayInstruction {
251         int propertyIndex;
252         int value;
253     };
254     struct StoreScriptStringInstruction {
255         int propertyIndex;
256         int value;
257         int scope;
258     }; 
259     struct StoreScriptInstruction {
260         int value;
261     };
262     struct StoreUrlInstruction {
263         int propertyIndex;
264         int value;
265     };
266     struct StoreColorInstruction {
267         int propertyIndex;
268         unsigned int value;
269     };
270     struct StoreDateInstruction {
271         int propertyIndex;
272         int value;
273     };
274     struct StoreTimeInstruction {
275         int propertyIndex;
276         int valueIndex;
277     };
278     struct StoreDateTimeInstruction {
279         int propertyIndex;
280         int valueIndex;
281     };
282     struct StoreRealPairInstruction {
283         int propertyIndex;
284         int valueIndex;
285     };
286     struct StoreRectInstruction {
287         int propertyIndex;
288         int valueIndex;
289     };
290     struct StoreVector3DInstruction {
291         int propertyIndex;
292         int valueIndex;
293     };
294     struct StoreObjectInstruction {
295         int propertyIndex;
296     };
297     struct AssignCustomTypeInstruction {
298         int propertyIndex;
299         int valueIndex;
300     };
301     struct StoreSignalInstruction {
302         int signalIndex;
303         int value;
304         short context;
305         int name;
306     };
307     struct AssignSignalObjectInstruction {
308         int signal;
309     };
310     struct CreateComponentInstruction {
311         int count;
312         ushort column;
313         int endLine;
314         int metaObject;
315     };
316     struct FetchAttachedInstruction {
317         int id;
318     };
319     struct DeferInstruction {
320         int deferCount;
321     };
322
323     union {
324         InitInstruction init;
325         CreateInstruction create;
326         CreateSimpleInstruction createSimple;
327         StoreMetaInstruction storeMeta;
328         SetIdInstruction setId;
329         AssignValueSourceInstruction assignValueSource;
330         AssignValueInterceptorInstruction assignValueInterceptor;
331         AssignBindingInstruction assignBinding;
332         FetchInstruction fetch;
333         FetchValueInstruction fetchValue;
334         FetchQmlListInstruction fetchQmlList;
335         BeginInstruction begin;
336         StoreFloatInstruction storeFloat;
337         StoreDoubleInstruction storeDouble;
338         StoreIntegerInstruction storeInteger;
339         StoreBoolInstruction storeBool;
340         StoreStringInstruction storeString;
341         StoreByteArrayInstruction storeByteArray;
342         StoreScriptStringInstruction storeScriptString;
343         StoreScriptInstruction storeScript;
344         StoreUrlInstruction storeUrl;
345         StoreColorInstruction storeColor;
346         StoreDateInstruction storeDate;
347         StoreTimeInstruction storeTime;
348         StoreDateTimeInstruction storeDateTime;
349         StoreRealPairInstruction storeRealPair;
350         StoreRectInstruction storeRect;
351         StoreVector3DInstruction storeVector3D;
352         StoreObjectInstruction storeObject;
353         AssignCustomTypeInstruction assignCustomType;
354         StoreSignalInstruction storeSignal;
355         AssignSignalObjectInstruction assignSignalObject;
356         CreateComponentInstruction createComponent;
357         FetchAttachedInstruction fetchAttached;
358         DeferInstruction defer;
359     };
360
361     void dump(QDeclarativeCompiledData *);
362 };
363
364 QT_END_NAMESPACE
365
366 #endif // QDECLARATIVEINSTRUCTION_P_H