Initial import from the monolithic Qt.
[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         //    StoreUrl - Store a QUrl in a core property
92         //    StoreColor - Store a QColor in a core property
93         //    StoreDate - Store a QDate in a core property
94         //    StoreTime - Store a QTime in a core property
95         //    StoreDateTime - Store a QDateTime in a core property
96         //    StoreVariant - Store a QVariant in a core property
97         //    StoreObject - Pop the object on the top of the object stack and
98         //                  store it in a core property
99         StoreFloat,               /* storeFloat */
100         StoreDouble,              /* storeDouble */
101         StoreInteger,             /* storeInteger */
102         StoreBool,                /* storeBool */
103         StoreString,              /* storeString */
104         StoreUrl,                 /* storeUrl */
105         StoreColor,               /* storeColor */
106         StoreDate,                /* storeDate */
107         StoreTime,                /* storeTime */
108         StoreDateTime,            /* storeDateTime */
109         StorePoint,               /* storeRealPair */
110         StorePointF,              /* storeRealPair */
111         StoreSize,                /* storeRealPair */
112         StoreSizeF,               /* storeRealPair */
113         StoreRect,                /* storeRect */
114         StoreRectF,               /* storeRect */
115         StoreVector3D,            /* storeVector3D */
116         StoreVariant,             /* storeString */
117         StoreVariantInteger,      /* storeInteger */
118         StoreVariantDouble,       /* storeDouble */
119         StoreVariantBool,         /* storeBool */
120         StoreObject,              /* storeObject */
121         StoreVariantObject,       /* storeObject */
122         StoreInterface,           /* storeObject */
123
124         StoreSignal,              /* storeSignal */
125         StoreImportedScript,      /* storeScript */
126         StoreScriptString,        /* storeScriptString */
127
128         //
129         // Unresolved single assignment
130         //
131         AssignSignalObject,       /* assignSignalObject */
132         AssignCustomType,         /* assignCustomType */
133
134         StoreBinding,             /* assignBinding */
135         StoreBindingOnAlias,      /* assignBinding */
136         StoreCompiledBinding,     /* assignBinding */
137         StoreValueSource,         /* assignValueSource */
138         StoreValueInterceptor,    /* assignValueInterceptor */
139
140         BeginObject,              /* begin */
141
142         StoreObjectQList,         /* NA */
143         AssignObjectList,         /* NA */
144
145         FetchAttached,            /* fetchAttached */
146         FetchQList,               /* fetch */
147         FetchObject,              /* fetch */
148         FetchValueType,           /* fetchValue */
149
150         //
151         // Stack manipulation
152         // 
153         //    PopFetchedObject - Remove an object from the object stack
154         //    PopQList - Remove a list from the list stack
155         PopFetchedObject,
156         PopQList,
157         PopValueType,            /* fetchValue */
158
159         // 
160         // Deferred creation
161         //
162         Defer                    /* defer */
163     };
164     QDeclarativeInstruction()
165         : line(0) {}
166
167     Type type;
168     unsigned short line;
169
170     struct InitInstruction {
171         int bindingsSize;
172         int parserStatusSize;
173         int contextCache;
174         int compiledBinding;
175     };
176     struct CreateInstruction {
177         int type;
178         int data;
179         int bindingBits;
180         ushort column;
181     };
182     struct CreateSimpleInstruction {
183         void (*create)(void *);
184         int typeSize;
185         int type;
186         ushort column;
187     };
188     struct StoreMetaInstruction {
189         int data;
190         int aliasData;
191         int propertyCache;
192     };
193     struct SetIdInstruction {
194         int value;
195         int index;
196     };
197     struct AssignValueSourceInstruction {
198         int property;
199         int owner;
200         int castValue;
201     };
202     struct AssignValueInterceptorInstruction {
203         int property;
204         int owner;
205         int castValue;
206     };
207     struct AssignBindingInstruction {
208         unsigned int property;
209         int value;
210         short context;
211         short owner;
212     };
213     struct FetchInstruction {
214         int property;
215     };
216     struct FetchValueInstruction {
217         int property;
218         int type;
219         quint32 bindingSkipList;
220     };
221     struct FetchQmlListInstruction {
222         int property;
223         int type;
224     };
225     struct BeginInstruction {
226         int castValue;
227     }; 
228     struct StoreFloatInstruction {
229         int propertyIndex;
230         float value;
231     };
232     struct StoreDoubleInstruction {
233         int propertyIndex;
234         double value;
235     };
236     struct StoreIntegerInstruction {
237         int propertyIndex;
238         int value;
239     };
240     struct StoreBoolInstruction {
241         int propertyIndex;
242         bool value;
243     };
244     struct StoreStringInstruction {
245         int propertyIndex;
246         int value;
247     };
248     struct StoreScriptStringInstruction {
249         int propertyIndex;
250         int value;
251         int scope;
252     }; 
253     struct StoreScriptInstruction {
254         int value;
255     };
256     struct StoreUrlInstruction {
257         int propertyIndex;
258         int value;
259     };
260     struct StoreColorInstruction {
261         int propertyIndex;
262         unsigned int value;
263     };
264     struct StoreDateInstruction {
265         int propertyIndex;
266         int value;
267     };
268     struct StoreTimeInstruction {
269         int propertyIndex;
270         int valueIndex;
271     };
272     struct StoreDateTimeInstruction {
273         int propertyIndex;
274         int valueIndex;
275     };
276     struct StoreRealPairInstruction {
277         int propertyIndex;
278         int valueIndex;
279     };
280     struct StoreRectInstruction {
281         int propertyIndex;
282         int valueIndex;
283     };
284     struct StoreVector3DInstruction {
285         int propertyIndex;
286         int valueIndex;
287     };
288     struct StoreObjectInstruction {
289         int propertyIndex;
290     };
291     struct AssignCustomTypeInstruction {
292         int propertyIndex;
293         int valueIndex;
294     };
295     struct StoreSignalInstruction {
296         int signalIndex;
297         int value;
298         short context;
299         int name;
300     };
301     struct AssignSignalObjectInstruction {
302         int signal;
303     };
304     struct CreateComponentInstruction {
305         int count;
306         ushort column;
307         int endLine;
308         int metaObject;
309     };
310     struct FetchAttachedInstruction {
311         int id;
312     };
313     struct DeferInstruction {
314         int deferCount;
315     };
316
317     union {
318         InitInstruction init;
319         CreateInstruction create;
320         CreateSimpleInstruction createSimple;
321         StoreMetaInstruction storeMeta;
322         SetIdInstruction setId;
323         AssignValueSourceInstruction assignValueSource;
324         AssignValueInterceptorInstruction assignValueInterceptor;
325         AssignBindingInstruction assignBinding;
326         FetchInstruction fetch;
327         FetchValueInstruction fetchValue;
328         FetchQmlListInstruction fetchQmlList;
329         BeginInstruction begin;
330         StoreFloatInstruction storeFloat;
331         StoreDoubleInstruction storeDouble;
332         StoreIntegerInstruction storeInteger;
333         StoreBoolInstruction storeBool;
334         StoreStringInstruction storeString;
335         StoreScriptStringInstruction storeScriptString;
336         StoreScriptInstruction storeScript;
337         StoreUrlInstruction storeUrl;
338         StoreColorInstruction storeColor;
339         StoreDateInstruction storeDate;
340         StoreTimeInstruction storeTime;
341         StoreDateTimeInstruction storeDateTime;
342         StoreRealPairInstruction storeRealPair;
343         StoreRectInstruction storeRect;
344         StoreVector3DInstruction storeVector3D;
345         StoreObjectInstruction storeObject;
346         AssignCustomTypeInstruction assignCustomType;
347         StoreSignalInstruction storeSignal;
348         AssignSignalObjectInstruction assignSignalObject;
349         CreateComponentInstruction createComponent;
350         FetchAttachedInstruction fetchAttached;
351         DeferInstruction defer;
352     };
353
354     void dump(QDeclarativeCompiledData *);
355 };
356
357 QT_END_NAMESPACE
358
359 #endif // QDECLARATIVEINSTRUCTION_P_H