42 #include "private/qdeclarativevme_p.h" 44 #include "private/qdeclarativecompiler_p.h" 45 #include "private/qdeclarativeboundsignal_p.h" 46 #include "private/qdeclarativestringconverters_p.h" 47 #include "private/qmetaobjectbuilder_p.h" 48 #include "private/qdeclarativedata_p.h" 50 #include "private/qdeclarativecustomparser_p.h" 54 #include "private/qdeclarativebinding_p.h" 55 #include "private/qdeclarativeengine_p.h" 56 #include "private/qdeclarativecomponent_p.h" 57 #include "private/qdeclarativevmemetaobject_p.h" 58 #include "private/qdeclarativebinding_p_p.h" 59 #include "private/qdeclarativecontext_p.h" 60 #include "private/qdeclarativecompiledbindings_p.h" 61 #include "private/qdeclarativeglobal_p.h" 70 #include <QtCore/qdebug.h> 71 #include <QtCore/qvarlengtharray.h> 72 #include <QtCore/qcoreapplication.h> 73 #include <QtCore/qdatetime.h> 88 inline const T &
top()
const;
89 inline void push(
const T &o);
91 inline int count()
const;
92 inline const T &
at(
int index)
const;
102 #define VME_EXCEPTION(desc) \ 104 QDeclarativeError error; \ 105 error.setDescription(desc.trimmed()); \ 106 error.setLine(instr.line); \ 107 error.setUrl(comp->url); \ 108 vmeErrors << error; \ 130 if (start == -1) start = 0;
133 return run(stack, ctxt, comp, start, count, bindingSkipList);
158 (ddata->
bindingBits[index / 32] & (1 << (index % 32)));
164 if (binding) binding->
destroy();
167 #define CLEAN_PROPERTY(o, index) if (fastHasBinding(o, index)) removeBindingOnProperty(o, index) 172 int start,
int count,
199 for (
int ii = start; !isError() && ii < (start +
count); ++ii) {
225 bindings = bindings.
united(bindingSkipList);
238 if (ddata->context) {
241 Q_ASSERT(ddata->outerContext != ctxt);
249 ddata->ownContext =
true;
250 }
else if (!ddata->context) {
254 ddata->setImplicitDestructible();
255 ddata->outerContext = ctxt;
256 ddata->lineNumber = instr.
line;
339 ddata->ownContext =
true;
341 ddata->setImplicitDestructible();
342 ddata->outerContext = ctxt;
343 ddata->lineNumber = instr.
line;
382 void *
a[] = { &v, 0, &
status, &flags };
394 void *
a[] = { &v, 0, &
status, &flags };
406 void *
a[] = { &v, 0, &
status, &flags };
418 void *
a[] = { &v, 0, &
status, &flags };
452 void *
a[] = { &f, 0, &
status, &flags };
464 void *
a[] = { &
d, 0, &
status, &flags };
498 void *
a[] = { &
c, 0, &
status, &flags };
510 void *
a[] = { &
d, 0, &
status, &flags };
526 void *
a[] = { &t, 0, &
status, &flags };
543 void *
a[] = { &dt, 0, &
status, &flags };
556 void *
a[] = { &p, 0, &
status, &flags };
569 void *
a[] = { &p, 0, &
status, &flags };
582 void *
a[] = { &p, 0, &
status, &flags };
595 void *
a[] = { &
s, 0, &
status, &flags };
610 void *
a[] = { &r, 0, &
status, &flags };
625 void *
a[] = { &r, 0, &
status, &flags };
639 void *
a[] = { &p, 0, &
status, &flags };
651 void *
a[] = { (
void *)&assignObj, 0, &status, &flags };
667 QVariant v = (*converter)(primitive);
671 if (v.
isNull() || ((int)prop.type() != data.
type && prop.userType() != data.
type))
674 void *
a[] = { (
void *)v.
data(), 0, &
status, &flags };
740 void *
a[] = { &ss, 0, &
status, &flags };
750 parserStatus.
append(status);
751 status->
d = &parserStatus.
values[parserStatus.
count - 1];
768 int coreIndex = mp.
index();
775 bind->m_mePtr = &bindValues.
values[bindValues.
count - 1];
800 bindValues.
append(binding);
854 ptr = assign->qt_metacast(iid);
870 void *
a[] = { &v, 0, &
status, &flags };
888 void *
ptr = assign->qt_metacast(iid);
912 stack.
push(qmlObject);
988 }
else if (binding) {
998 stack.
push(valueHandler);
1013 qFatal(
"QDeclarativeCompiledData: Internal error - unknown instruction %d", instr.
type);
1030 if (bindValues.
count)
1032 else if (bindValues.
values)
1035 if (parserStatus.
count)
1037 else if (parserStatus.
values)
1038 parserStatus.
clear();
1046 return !vmeErrors.isEmpty();
1080 template<
typename T>
1086 template<
typename T>
1091 template<
typename T>
1096 template<
typename T>
1107 template<
typename T>
1114 template<
typename T>
1119 template<
typename T>
QDeclarativeContextData * outerContext
The QVariant class acts like a union for the most common Qt data types.
static QDeclarativeComponentPrivate * get(QDeclarativeComponent *c)
The QColor class provides colors based on RGB, HSV or CMYK values.
QDeclarativeContextData * context
QBitField united(const QBitField &)
QDeclarativePropertyCache * propertyCache
The QVector3D class represents a vector or vertex in 3D space.
static QDeclarativeData * get(const QObject *object, bool create=false)
#define QT_END_NAMESPACE
This macro expands to.
QVarLengthArray< T, 128 > VLA
QPointer< QWidget > widget
QDeclarativeParserStatus ** d
QDeclarativeGuardedContextData creationContext
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
QDeclarativeEngine * engine
QDeclarativeAbstractBinding * configBinding(int index, QObject *target, QObject *scope, int property)
The QByteArray class provides an array of bytes.
QDeclarativeListProperty< void > qListProperty
FetchAttachedInstruction fetchAttached
void addToObject(QObject *, int)
Add this binding to object.
QDeclarativePropertyCache * typePropertyCache
The QPointF class defines a point in the plane using floating point precision.
void setTarget(const QDeclarativeProperty &)
virtual void destroy(DestroyMode mode=DisconnectBinding)
Destroy the binding.
static QDeclarativeAbstractBinding * binding(QObject *, int coreIndex, int valueTypeIndex)
void runDeferred(QObject *)
QList< QDeclarativeParser::Object::ScriptBlock > scripts
static bool connect(QObject *sender, int signal_index, const QObject *receiver, int method_index, int type=0, int *types=0)
Connect sender signal_index to receiver method_index with the specified type and types.
static LibLoadStatus status
static int valueTypeCoreIndex(const QDeclarativeProperty &that)
The QDate class provides date functions.
QList< QDeclarativeError > errors() const
virtual Type bindingType() const
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags flags)=0
int count(const T &t) const
Returns the number of occurrences of value in the list.
Type type() const
Returns the type of the property.
StoreBoolInstruction storeBool
The QString class provides a Unicode character string.
static QDate fromJulianDay(int jd)
Converts the Julian day jd to a QDate.
QDeclarativeContextData * linkedContext
The QObject class is the base class of all Qt objects.
#define CLEAN_PROPERTY(o, index)
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
The QSizeF class defines the size of a two-dimensional object using floating point precision...
static QObjectPrivate * get(QObject *o)
AssignSignalObjectInstruction assignSignalObject
void setParent(QObject *)
Makes the object a child of parent.
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
QDeclarativeCompiledData * deferredComponent
Q_DECLARATIVE_EXPORT QObject * qmlAttachedPropertiesObjectById(int, const QObject *, bool create=true)
QDeclarativeExpression * setExpression(QDeclarativeExpression *)
Sets the signal expression to e.
bool fastHasBinding(QObject *o, int index)
StoreMetaInstruction storeMeta
FetchValueInstruction fetchValue
The QTime class provides clock time functions.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QObject * createInstance(QDeclarativeContextData *, const QBitField &, QList< QDeclarativeError > *) const
The QDeclarativeScriptString class encapsulates a script and its context.
StoreUrlInstruction storeUrl
The QDeclarativeComponent class encapsulates a QML component definition.
static QColor fromRgba(QRgb rgba)
Static convenience function that returns a QColor constructed from the given QRgb value rgba...
int index() const
Return the Qt metaobject index of the property.
QMetaMethod method() const
Return the QMetaMethod for this property if it is a SignalProperty, otherwise returns an invalid QMet...
void setScopeObject(QObject *)
Sets the scope object for the script.
StoreRealPairInstruction storeRealPair
The QDeclarativeParserStatus class provides updates on the QML parser state.
const T & at(int i) const
Returns the item at index position i in the list.
StoreScriptInstruction storeScript
void setContext(QDeclarativeContext *)
Sets the context for the script.
StoreColorInstruction storeColor
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
QVariant Q_DECLARATIVE_PRIVATE_EXPORT variantFromString(const QString &)
StoreTimeInstruction storeTime
QDeclarativeData * contextObjects
StoreDateTimeInstruction storeDateTime
virtual void setTarget(const QDeclarativeProperty &property)=0
Set the target property for the value interceptor.
StoreFloatInstruction storeFloat
QObject * run(QDeclarativeContextData *, QDeclarativeCompiledData *, int start=-1, int count=-1, const QBitField &=QBitField())
QList< QDeclarativePropertyCache * > propertyCaches
static qreal component(const QPointF &point, unsigned int i)
static QDeclarativeAbstractBinding * setBinding(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *, WriteFlags flags=DontRemoveBinding)
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
The QDeclarativeCustomParser class allows you to add new arbitrary types to QML.
static int bindingIndex(const QDeclarativeProperty &that)
Returns the "property index" for use in bindings.
QList< SimpleList< QDeclarativeAbstractBinding > > bindValues
StoreObjectInstruction storeObject
QAbstractDeclarativeData * declarativeData
QList< QString > primitives
const T & at(int index) const
static QWidget * parentWidget(const QWidget *w)
void addImportedScript(const QDeclarativeParser::Object::ScriptBlock &script)
QList< QDeclarativeIntegerCache * > contextCaches
void removeBindings(quint32 mask)
Removes a collection of bindings, corresponding to the set bits in mask.
const char * constData() const
Returns a pointer to the data stored in the byte array.
void addObject(QObject *)
StoreDateInstruction storeDate
Q_CORE_EXPORT void qFatal(const char *,...)
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
static QObject * begin(QDeclarativeContextData *parentContext, QDeclarativeContextData *componentCreationContext, QDeclarativeCompiledData *component, int start, int count, ConstructionState *state, QList< QDeclarativeError > *errors, const QBitField &bindings=QBitField())
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
#define VME_EXCEPTION(desc)
The QDateTime class provides date and time functions.
virtual void classBegin()=0
Invoked after class creation, but before any properties have been set.
static QDeclarativeAbstractBinding * setBindingNoEnable(QObject *, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *)
CreateComponentInstruction createComponent
static void clear(SimpleList< QDeclarativeAbstractBinding > &)
QDeclarativeValueTypeFactory valueTypes
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
void QDeclarative_setParent_noEvent(QObject *object, QObject *parent)
Makes the object a child of parent.
QDeclarativeContext * asQDeclarativeContext()
AssignBindingInstruction assignBinding
static QDeclarativeProperty restore(const QByteArray &, QObject *, QDeclarativeContextData *)
The QPoint class defines a point in the plane using integer precision.
StoreDoubleInstruction storeDouble
StoreSignalInstruction storeSignal
CreateSimpleInstruction createSimple
The QRect class defines a rectangle in the plane using integer precision.
Q_DECLARE_TYPEINFO(ListInstance, Q_PRIMITIVE_TYPE|Q_MOVABLE_TYPE)
int size() const
Returns the number of bytes in this byte array.
QList< CustomTypeData > customTypeData
void setSourceLocation(const QString &fileName, int line)
Set the location of this expression to line of url.
virtual void setTarget(const QDeclarativeProperty &)=0
Set the target property for the value source.
QDeclarativeCustomParser * customParser() const
FetchQmlListInstruction fetchQmlList
QFuture< T > run(Function function,...)
The QDeclarativeProperty class abstracts accessing properties on objects created from QML...
void setIdProperty(int, QObject *)
StoreRectInstruction storeRect
QDeclarativeData ** prevContextObject
void setScript(const QString &)
Sets the script text.
The QSize class defines the size of a two-dimensional object using integer point precision.
StoreVector3DInstruction storeVector3D
virtual void setCustomData(QObject *, const QByteArray &)=0
AssignValueInterceptorInstruction assignValueInterceptor
The QDeclarativePropertyValueSource class is an interface for property value sources such as animatio...
QDeclarativeData * nextContextObject
QDeclarativeCompiledBindings * optimizedBindings
The QDeclarativeExpression class evaluates JavaScript in a QML context.
static void removeBindingOnProperty(QObject *o, int index)
void setIdPropertyData(QDeclarativeIntegerCache *)
StoreIntegerInstruction storeInteger
The QDeclarativePropertyValueInterceptor class is inherited by property interceptors such as Behavior...
QList< TypeReference > types
AssignValueSourceInstruction assignValueSource
bool setHMS(int h, int m, int s, int ms=0)
Sets the time to hour h, minute m, seconds s and milliseconds ms.
QList< SimpleList< QDeclarativeParserStatus > > parserStatus
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
QList< QDeclarativeInstruction > bytecode
StoreStringInstruction storeString
AssignCustomTypeInstruction assignCustomType
QList< QByteArray > datas
StoreScriptStringInstruction storeScriptString
QDeclarativeAbstractBinding ** m_mePtr
virtual void read(QObject *, int)=0