This class is now too large to be nicely nested.
Change-Id: I32cfa5caa524b8bf447d1f8c53ef2763f60bdac1
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
if (!contextData)
return;
- QDeclarativePropertyCache::Data dummy;
- QDeclarativePropertyCache::Data *prop =
+ QDeclarativePropertyData dummy;
+ QDeclarativePropertyData *prop =
QDeclarativePropertyCache::property(context->engine(), object, method, dummy);
if (!prop || !prop->isVMEFunction())
QDeclarativeData *ddata = QDeclarativeData::get(data);
if (ddata && ddata->propertyCache) {
- QDeclarativePropertyCache::Data *prop = ddata->propertyCache->property(name);
+ QDeclarativePropertyData *prop = ddata->propertyCache->property(name);
if (prop) {
if (prop->propType == QVariant::String) {
void *args[] = { &val, 0 };
reinterpret_cast<const QDeclarativeVMEMetaData *>(obj->synthdata.constData());
for (int ii = 0; ii < vmeMetaData->aliasCount; ++ii) {
int index = obj->metaObject()->propertyOffset() + vmeMetaData->propertyCount + ii;
- QDeclarativePropertyCache::Data *data = propertyCache->property(index);
- data->setFlags(data->getFlags() | QDeclarativePropertyCache::Data::IsAlias);
+ QDeclarativePropertyData *data = propertyCache->property(index);
+ data->setFlags(data->getFlags() | QDeclarativePropertyData::IsAlias);
}
}
bool notInRevision = false;
- QDeclarativePropertyCache::Data *sig = signal(obj, QStringRef(&name), ¬InRevision);
+ QDeclarativePropertyData *sig = signal(obj, QStringRef(&name), ¬InRevision);
if (sig == 0) {
} else {
// Setup regular property data
bool notInRevision = false;
- QDeclarativePropertyCache::Data *d =
+ QDeclarativePropertyData *d =
prop->name().isEmpty()?0:property(obj, prop->name(), ¬InRevision);
if (d == 0 && notInRevision) {
prop->core = *d;
} else if (prop->isDefault) {
QMetaProperty p = QDeclarativeMetaType::defaultProperty(metaObject);
- QDeclarativePropertyCache::Data defaultPropertyData;
+ QDeclarativePropertyData defaultPropertyData;
defaultPropertyData.load(p, engine);
if (p.name())
prop->setName(QLatin1String(p.name()));
for (Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
- QDeclarativePropertyCache::Data *d = property(obj, prop->name());
+ QDeclarativePropertyData *d = property(obj, prop->name());
if (d == 0)
COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(prop->name().toString()));
if (!resolveAlias) {
// No point doing this for both the alias and non alias cases
- QDeclarativePropertyCache::Data *d = property(obj, p->name);
+ QDeclarativePropertyData *d = property(obj, p->name);
if (d && d->isFinal())
COMPILE_EXCEPTION(p, tr("Cannot override FINAL property"));
}
if (obj->type != -1) {
QDeclarativePropertyCache *cache = output->types[obj->type].createPropertyCache(engine)->copy();
cache->append(engine, &obj->extObject,
- QDeclarativePropertyCache::Data::NoFlags,
- QDeclarativePropertyCache::Data::IsVMEFunction,
- QDeclarativePropertyCache::Data::IsVMESignal);
+ QDeclarativePropertyData::NoFlags,
+ QDeclarativePropertyData::IsVMEFunction,
+ QDeclarativePropertyData::IsVMESignal);
// now we modify the flags appropriately for var properties.
int propertyOffset = obj->extObject.propertyOffset();
- QDeclarativePropertyCache::Data *currPropData = 0;
+ QDeclarativePropertyData *currPropData = 0;
for (int pvi = firstPropertyVarIndex; pvi < totalPropCount; ++pvi) {
currPropData = cache->property(pvi + propertyOffset);
- currPropData->setFlags(currPropData->getFlags() | QDeclarativePropertyCache::Data::IsVMEProperty);
+ currPropData->setFlags(currPropData->getFlags() | QDeclarativePropertyData::IsVMEProperty);
}
obj->synthCache = cache;
return output->contextCaches.count() - 1;
}
-QDeclarativePropertyCache::Data
+QDeclarativePropertyData
QDeclarativeCompiler::genValueTypeData(QDeclarativeScript::Property *valueTypeProp,
QDeclarativeScript::Property *prop)
{
return rv;
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativeCompiler::property(QDeclarativeScript::Object *object, int index)
{
QDeclarativePropertyCache *cache = 0;
return cache->property(index);
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativeCompiler::property(QDeclarativeScript::Object *object, const QHashedStringRef &name, bool *notInRevision)
{
if (notInRevision) *notInRevision = false;
else
cache = QDeclarativeEnginePrivate::get(engine)->cache(object->metaObject());
- QDeclarativePropertyCache::Data *d = cache->property(name);
+ QDeclarativePropertyData *d = cache->property(name);
// Find the first property
while (d && d->isFunction())
}
// This code must match the semantics of QDeclarativePropertyPrivate::findSignalByName
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativeCompiler::signal(QDeclarativeScript::Object *object, const QHashedStringRef &name, bool *notInRevision)
{
if (notInRevision) *notInRevision = false;
cache = QDeclarativeEnginePrivate::get(engine)->cache(object->metaObject());
- QDeclarativePropertyCache::Data *d = cache->property(name);
+ QDeclarativePropertyData *d = cache->property(name);
if (notInRevision) *notInRevision = false;
while (d && !(d->isFunction()))
int QDeclarativeCompiler::indexOfSignal(QDeclarativeScript::Object *object, const QString &name,
bool *notInRevision)
{
- QDeclarativePropertyCache::Data *d = signal(object, QStringRef(&name), notInRevision);
+ QDeclarativePropertyData *d = signal(object, QStringRef(&name), notInRevision);
return d?d->coreIndex:-1;
}
int QDeclarativeCompiler::indexOfProperty(QDeclarativeScript::Object *object, const QHashedStringRef &name,
bool *notInRevision)
{
- QDeclarativePropertyCache::Data *d = property(object, name, notInRevision);
+ QDeclarativePropertyData *d = property(object, name, notInRevision);
return d?d->coreIndex:-1;
}
QDeclarativeScript::Property *valueTypeProperty = 0);
int genContextCache();
- QDeclarativePropertyCache::Data genValueTypeData(QDeclarativeScript::Property *prop,
- QDeclarativeScript::Property *valueTypeProp);
+ QDeclarativePropertyData genValueTypeData(QDeclarativeScript::Property *prop,
+ QDeclarativeScript::Property *valueTypeProp);
int componentTypeRef();
QStringList deferredProperties(QDeclarativeScript::Object *);
- QDeclarativePropertyCache::Data *property(QDeclarativeScript::Object *, int);
- QDeclarativePropertyCache::Data *property(QDeclarativeScript::Object *, const QHashedStringRef &,
- bool *notInRevision = 0);
- QDeclarativePropertyCache::Data *signal(QDeclarativeScript::Object *, const QHashedStringRef &,
- bool *notInRevision = 0);
+ QDeclarativePropertyData *property(QDeclarativeScript::Object *, int);
+ QDeclarativePropertyData *property(QDeclarativeScript::Object *, const QHashedStringRef &,
+ bool *notInRevision = 0);
+ QDeclarativePropertyData *signal(QDeclarativeScript::Object *, const QHashedStringRef &,
+ bool *notInRevision = 0);
int indexOfProperty(QDeclarativeScript::Object *, const QHashedStringRef &, bool *notInRevision = 0);
int indexOfProperty(QDeclarativeScript::Object *, const QString &, bool *notInRevision = 0);
int indexOfSignal(QDeclarativeScript::Object *, const QString &, bool *notInRevision = 0);
QByteArray utf8Name = name.toUtf8();
if (data->contextObject) {
QObject *obj = data->contextObject;
- QDeclarativePropertyCache::Data local;
- QDeclarativePropertyCache::Data *property =
+ QDeclarativePropertyData local;
+ QDeclarativePropertyData *property =
QDeclarativePropertyCache::property(data->engine, obj, name, local);
if (property) value = obj->metaObject()->property(property->coreIndex).read(obj);
!overloadError && iter != raw->stringCache.end();
++iter) {
- QDeclarativePropertyCache::Data *d = *iter;
+ QDeclarativePropertyData *d = *iter;
if (raw->isAllowedInRevision(d))
continue; // Not excluded - no problems
// check that a regular "name" overload isn't happening
- QDeclarativePropertyCache::Data *current = d;
+ QDeclarativePropertyData *current = d;
while (!overloadError && current) {
current = d->overrideData(current);
if (current && raw->isAllowedInRevision(current))
};
struct instr_assignValueSource {
QML_INSTR_HEADER
- QDeclarativePropertyCache::RawData property;
+ QDeclarativePropertyRawData property;
int owner;
int castValue;
};
struct instr_assignValueInterceptor {
QML_INSTR_HEADER
- QDeclarativePropertyCache::RawData property;
+ QDeclarativePropertyRawData property;
int owner;
int castValue;
};
};
struct instr_assignBinding {
QML_INSTR_HEADER
- QDeclarativePropertyCache::RawData property;
+ QDeclarativePropertyRawData property;
int value;
short context;
short owner;
{
if (!object || !property) return;
- QDeclarativePropertyCache::Data local;
- QDeclarativePropertyCache::Data *data =
+ QDeclarativePropertyData local;
+ QDeclarativePropertyData *data =
QDeclarativePropertyCache::property(engine, object, QLatin1String(property), local);
if (!data || !data->isQList()) return;
}
- QDeclarativePropertyCache::Data local;
- QDeclarativePropertyCache::Data *property =
+ QDeclarativePropertyData local;
+ QDeclarativePropertyData *property =
QDeclarativePropertyCache::property(engine, obj, pathName, local);
if (!property) return; // Not a property
QMetaProperty vtProp = typeObject->metaObject()->property(idx);
- typedef QDeclarativePropertyCache::Data PCD;
+ typedef QDeclarativePropertyData PCD;
Q_ASSERT(PCD::flagsForProperty(vtProp) <= PCD::ValueTypeFlagMask);
Q_ASSERT(vtProp.userType() <= 0xFF);
}
// Property
- QDeclarativePropertyCache::Data local;
- QDeclarativePropertyCache::Data *property =
+ QDeclarativePropertyData local;
+ QDeclarativePropertyData *property =
QDeclarativePropertyCache::property(engine, currentObject, terminal, local);
if (property && !property->isFunction()) {
object = currentObject;
if (!data)
return 0;
- QDeclarativePropertyCache::Data *propertyData =
+ QDeclarativePropertyData *propertyData =
data->propertyCache?data->propertyCache->property(coreIndex):0;
if (propertyData && propertyData->isAlias()) {
const QDeclarativeVMEMetaObject *vme =
QDeclarativeData *data = QDeclarativeData::get(object, false);
if (data) {
- QDeclarativePropertyCache::Data *propertyData =
+ QDeclarativePropertyData *propertyData =
data->propertyCache?data->propertyCache->property(coreIndex):0;
if (propertyData && propertyData->isAlias()) {
const QDeclarativeVMEMetaObject *vme =
QDeclarativeAbstractBinding *binding = 0;
if (data) {
- QDeclarativePropertyCache::Data *propertyData =
+ QDeclarativePropertyData *propertyData =
data->propertyCache?data->propertyCache->property(coreIndex):0;
if (propertyData && propertyData->isAlias()) {
const QDeclarativeVMEMetaObject *vme =
QDeclarativeAbstractBinding *binding = 0;
if (data) {
- QDeclarativePropertyCache::Data *propertyData =
+ QDeclarativePropertyData *propertyData =
data->propertyCache?data->propertyCache->property(coreIndex):0;
if (propertyData && propertyData->isAlias()) {
const QDeclarativeVMEMetaObject *vme =
bool
QDeclarativePropertyPrivate::writeValueProperty(QObject *object, QDeclarativeEngine *engine,
- const QDeclarativePropertyCache::Data &core,
+ const QDeclarativePropertyData &core,
const QVariant &value,
QDeclarativeContextData *context, WriteFlags flags)
{
writeBack->read(object, core.coreIndex);
- QDeclarativePropertyCache::Data data = core;
- data.setFlags(QDeclarativePropertyCache::Data::Flag(core.valueTypeFlags));
+ QDeclarativePropertyData data = core;
+ data.setFlags(QDeclarativePropertyData::Flag(core.valueTypeFlags));
data.coreIndex = core.valueTypeCoreIndex;
data.propType = core.valueTypePropType;
}
bool QDeclarativePropertyPrivate::write(QObject *object,
- const QDeclarativePropertyCache::Data &property,
+ const QDeclarativePropertyData &property,
const QVariant &value, QDeclarativeContextData *context,
WriteFlags flags)
{
// Returns true if successful, false if an error description was set on expression
bool QDeclarativePropertyPrivate::writeBinding(QObject *object,
- const QDeclarativePropertyCache::Data &core,
+ const QDeclarativePropertyData &core,
QDeclarativeJavaScriptExpression *expression,
v8::Handle<v8::Value> result, bool isUndefined,
WriteFlags flags)
return bindingIndex(that.d->core);
}
-int QDeclarativePropertyPrivate::bindingIndex(const QDeclarativePropertyCache::Data &that)
+int QDeclarativePropertyPrivate::bindingIndex(const QDeclarativePropertyData &that)
{
int rv = that.coreIndex;
if (rv != -1 && that.isValueTypeVirtual())
return rv;
}
-QDeclarativePropertyCache::Data
+QDeclarativePropertyData
QDeclarativePropertyPrivate::saveValueType(const QMetaObject *metaObject, int index,
const QMetaObject *subObject, int subIndex,
QDeclarativeEngine *)
QMetaProperty prop = metaObject->property(index);
QMetaProperty subProp = subObject->property(subIndex);
- QDeclarativePropertyCache::Data core;
+ QDeclarativePropertyData core;
core.load(metaObject->property(index));
- core.setFlags(core.getFlags() | QDeclarativePropertyCache::Data::IsValueTypeVirtual);
- core.valueTypeFlags = QDeclarativePropertyCache::Data::flagsForProperty(subProp);
+ core.setFlags(core.getFlags() | QDeclarativePropertyData::IsValueTypeVirtual);
+ core.valueTypeFlags = QDeclarativePropertyData::flagsForProperty(subProp);
core.valueTypeCoreIndex = subIndex;
core.valueTypePropType = subProp.userType();
}
QDeclarativeProperty
-QDeclarativePropertyPrivate::restore(const QDeclarativePropertyCache::Data &data,
+QDeclarativePropertyPrivate::restore(const QDeclarativePropertyData &data,
QObject *object, QDeclarativeContextData *ctxt)
{
QDeclarativeProperty prop;
{
QDeclarativeData *data = static_cast<QDeclarativeData *>(QObjectPrivate::get(const_cast<QObject *>(object))->declarativeData);
if (data && data->propertyCache) {
- QDeclarativePropertyCache::Data *property = data->propertyCache->method(index);
+ QDeclarativePropertyData *property = data->propertyCache->method(index);
if (property && property->isVMESignal()) {
const QMetaObject *metaObject = object->metaObject();
QDeclarativeGuard<QObject> object;
bool isNameCached:1;
- QDeclarativePropertyCache::Data core;
+ QDeclarativePropertyData core;
QString nameCache;
void initProperty(QObject *obj, const QString &name);
static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object,
const QVariant &value, int flags);
static bool writeValueProperty(QObject *, QDeclarativeEngine *,
- const QDeclarativePropertyCache::Data &,
+ const QDeclarativePropertyData &,
const QVariant &, QDeclarativeContextData *,
WriteFlags flags = 0);
- static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &,
+ static bool write(QObject *, const QDeclarativePropertyData &, const QVariant &,
QDeclarativeContextData *, WriteFlags flags = 0);
static void findAliasTarget(QObject *, int, QObject **, int *);
static QDeclarativeAbstractBinding *setBinding(QObject *, int coreIndex, int valueTypeIndex /* -1 */,
QDeclarativeAbstractBinding *);
static QDeclarativeAbstractBinding *binding(QObject *, int coreIndex, int valueTypeIndex /* -1 */);
- static QDeclarativePropertyCache::Data saveValueType(const QMetaObject *, int,
- const QMetaObject *, int,
- QDeclarativeEngine *);
- static QDeclarativeProperty restore(const QDeclarativePropertyCache::Data &,
+ static QDeclarativePropertyData saveValueType(const QMetaObject *, int,
+ const QMetaObject *, int,
+ QDeclarativeEngine *);
+ static QDeclarativeProperty restore(const QDeclarativePropertyData &,
QObject *,
QDeclarativeContextData *);
QDeclarativeJavaScriptExpression *expression,
v8::Handle<v8::Value> result, bool isUndefined,
WriteFlags flags);
- static bool writeBinding(QObject *, const QDeclarativePropertyCache::Data &,
+ static bool writeBinding(QObject *, const QDeclarativePropertyData &,
QDeclarativeJavaScriptExpression *expression,
v8::Handle<v8::Value> result, bool isUndefined,
WriteFlags flags);
static int valueTypeCoreIndex(const QDeclarativeProperty &that);
static int bindingIndex(const QDeclarativeProperty &that);
- static int bindingIndex(const QDeclarativePropertyCache::Data &that);
+ static int bindingIndex(const QDeclarativePropertyData &that);
static QMetaMethod findSignalByName(const QMetaObject *mo, const QByteArray &);
static bool connect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index,
// Flags that do *NOT* depend on the property's QMetaProperty::userType() and thus are quick
// to load
-static QDeclarativePropertyCache::Data::Flags fastFlagsForProperty(const QMetaProperty &p)
+static QDeclarativePropertyData::Flags fastFlagsForProperty(const QMetaProperty &p)
{
- QDeclarativePropertyCache::Data::Flags flags;
+ QDeclarativePropertyData::Flags flags;
if (p.isConstant())
- flags |= QDeclarativePropertyCache::Data::IsConstant;
+ flags |= QDeclarativePropertyData::IsConstant;
if (p.isWritable())
- flags |= QDeclarativePropertyCache::Data::IsWritable;
+ flags |= QDeclarativePropertyData::IsWritable;
if (p.isResettable())
- flags |= QDeclarativePropertyCache::Data::IsResettable;
+ flags |= QDeclarativePropertyData::IsResettable;
if (p.isFinal())
- flags |= QDeclarativePropertyCache::Data::IsFinal;
+ flags |= QDeclarativePropertyData::IsFinal;
if (p.isEnumType())
- flags |= QDeclarativePropertyCache::Data::IsEnumType;
+ flags |= QDeclarativePropertyData::IsEnumType;
return flags;
}
// Flags that do depend on the property's QMetaProperty::userType() and thus are slow to
// load
-static QDeclarativePropertyCache::Data::Flags flagsForPropertyType(int propType, QDeclarativeEngine *engine)
+static QDeclarativePropertyData::Flags flagsForPropertyType(int propType, QDeclarativeEngine *engine)
{
- QDeclarativePropertyCache::Data::Flags flags;
+ QDeclarativePropertyData::Flags flags;
if (propType < QMetaType::User && propType != QMetaType::QObjectStar && propType != QMetaType::QWidgetStar) {
} else if (propType == qMetaTypeId<QDeclarativeBinding *>()) {
- flags |= QDeclarativePropertyCache::Data::IsQmlBinding;
+ flags |= QDeclarativePropertyData::IsQmlBinding;
} else if (propType == qMetaTypeId<QJSValue>()) {
- flags |= QDeclarativePropertyCache::Data::IsQJSValue;
+ flags |= QDeclarativePropertyData::IsQJSValue;
} else if (propType == qMetaTypeId<QDeclarativeV8Handle>()) {
- flags |= QDeclarativePropertyCache::Data::IsV8Handle;
+ flags |= QDeclarativePropertyData::IsV8Handle;
} else {
QDeclarativeMetaType::TypeCategory cat =
engine ? QDeclarativeEnginePrivate::get(engine)->typeCategory(propType)
: QDeclarativeMetaType::typeCategory(propType);
if (cat == QDeclarativeMetaType::Object)
- flags |= QDeclarativePropertyCache::Data::IsQObjectDerived;
+ flags |= QDeclarativePropertyData::IsQObjectDerived;
else if (cat == QDeclarativeMetaType::List)
- flags |= QDeclarativePropertyCache::Data::IsQList;
+ flags |= QDeclarativePropertyData::IsQList;
}
return flags;
}
-QDeclarativePropertyCache::Data::Flags
-QDeclarativePropertyCache::Data::flagsForProperty(const QMetaProperty &p, QDeclarativeEngine *engine)
+QDeclarativePropertyData::Flags
+QDeclarativePropertyData::flagsForProperty(const QMetaProperty &p, QDeclarativeEngine *engine)
{
return fastFlagsForProperty(p) | flagsForPropertyType(p.userType(), engine);
}
-void QDeclarativePropertyCache::Data::lazyLoad(const QMetaProperty &p, QDeclarativeEngine *engine)
+void QDeclarativePropertyData::lazyLoad(const QMetaProperty &p, QDeclarativeEngine *engine)
{
Q_UNUSED(engine);
int type = p.type();
if (type == QMetaType::QObjectStar || type == QMetaType::QWidgetStar) {
propType = type;
- flags |= QDeclarativePropertyCache::Data::IsQObjectDerived;
+ flags |= QDeclarativePropertyData::IsQObjectDerived;
} else if (type == QVariant::UserType || type == -1) {
propTypeName = p.typeName();
- flags |= QDeclarativePropertyCache::Data::NotFullyResolved;
+ flags |= QDeclarativePropertyData::NotFullyResolved;
} else {
propType = type;
}
}
-void QDeclarativePropertyCache::Data::load(const QMetaProperty &p, QDeclarativeEngine *engine)
+void QDeclarativePropertyData::load(const QMetaProperty &p, QDeclarativeEngine *engine)
{
propType = p.userType();
if (QVariant::Type(propType) == QVariant::LastType)
revision = p.revision();
}
-void QDeclarativePropertyCache::Data::load(const QMetaMethod &m)
+void QDeclarativePropertyData::load(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
arguments = 0;
- flags |= Data::IsFunction;
+ flags |= IsFunction;
if (m.methodType() == QMetaMethod::Signal)
- flags |= Data::IsSignal;
+ flags |= IsSignal;
propType = QVariant::Invalid;
const char *returnType = m.typeName();
++signature;
if (*signature != ')') {
- flags |= Data::HasArguments;
+ flags |= HasArguments;
if (0 == ::strcmp(signature, "QDeclarativeV8Function*)")) {
- flags |= Data::IsV8Function;
+ flags |= IsV8Function;
}
}
revision = m.revision();
}
-void QDeclarativePropertyCache::Data::lazyLoad(const QMetaMethod &m)
+void QDeclarativePropertyData::lazyLoad(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
arguments = 0;
- flags |= Data::IsFunction;
+ flags |= IsFunction;
if (m.methodType() == QMetaMethod::Signal)
- flags |= Data::IsSignal;
+ flags |= IsSignal;
propType = QVariant::Invalid;
const char *returnType = m.typeName();
if (returnType && *returnType) {
propTypeName = returnType;
- flags |= Data::NotFullyResolved;
+ flags |= NotFullyResolved;
}
const char *signature = m.signature();
++signature;
if (*signature != ')') {
- flags |= Data::HasArguments;
+ flags |= HasArguments;
if (0 == ::strcmp(signature, "QDeclarativeV8Function*)")) {
- flags |= Data::IsV8Function;
+ flags |= IsV8Function;
}
}
engine = 0;
}
-QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObject *metaObject,
- const QString &property)
+QDeclarativePropertyData QDeclarativePropertyCache::create(const QMetaObject *metaObject,
+ const QString &property)
{
Q_ASSERT(metaObject);
- QDeclarativePropertyCache::Data rv;
+ QDeclarativePropertyData rv;
{
const QMetaObject *cmo = metaObject;
const QByteArray propertyName = property.toUtf8();
}
void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject,
- Data::Flag propertyFlags, Data::Flag methodFlags, Data::Flag signalFlags)
+ QDeclarativePropertyData::Flag propertyFlags,
+ QDeclarativePropertyData::Flag methodFlags,
+ QDeclarativePropertyData::Flag signalFlags)
{
append(engine, metaObject, -1, propertyFlags, methodFlags, signalFlags);
}
void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject,
int revision,
- Data::Flag propertyFlags, Data::Flag methodFlags, Data::Flag signalFlags)
+ QDeclarativePropertyData::Flag propertyFlags,
+ QDeclarativePropertyData::Flag methodFlags,
+ QDeclarativePropertyData::Flag signalFlags)
{
Q_UNUSED(revision);
Q_ASSERT(constructor.IsEmpty()); // We should not be appending to an in-use property cache
++cptr;
}
- Data *data = &methodIndexCache[ii - methodIndexCacheStart];
- Data *sigdata = 0;
+ QDeclarativePropertyData *data = &methodIndexCache[ii - methodIndexCacheStart];
+ QDeclarativePropertyData *sigdata = 0;
data->lazyLoad(m);
data->flags |= methodFlags;
if (!dynamicMetaObject)
- data->flags |= Data::IsDirect;
+ data->flags |= QDeclarativePropertyData::IsDirect;
data->metaObjectOffset = allowedRevisionCache.count() - 1;
if (data->isSignal()) {
sigdata = &signalHandlerIndexCache[signalHandlerIndex];
*sigdata = *data;
- sigdata->flags |= Data::IsSignalHandler;
+ sigdata->flags |= QDeclarativePropertyData::IsSignalHandler;
}
- Data *old = 0;
+ QDeclarativePropertyData *old = 0;
if (utf8) {
QHashedString methodName(QString::fromUtf8(signature, cptr - signature));
- if (Data **it = stringCache.value(methodName))
+ if (QDeclarativePropertyData **it = stringCache.value(methodName))
old = *it;
stringCache.insert(methodName, data);
}
} else {
QHashedCStringRef methodName(signature, cptr - signature);
- if (Data **it = stringCache.value(methodName))
+ if (QDeclarativePropertyData **it = stringCache.value(methodName))
old = *it;
stringCache.insert(methodName, data);
if (old) {
// We only overload methods in the same class, exactly like C++
- if (old->flags & Data::IsFunction && old->coreIndex >= methodOffset)
- data->flags |= Data::IsOverload;
- data->overrideIndexIsProperty = !bool(old->flags & Data::IsFunction);
+ if (old->isFunction() && old->coreIndex >= methodOffset)
+ data->flags |= QDeclarativePropertyData::IsOverload;
+ data->overrideIndexIsProperty = !old->isFunction();
data->overrideIndex = old->coreIndex;
}
}
++cptr;
}
- Data *data = &propertyIndexCache[ii - propertyIndexCacheStart];
+ QDeclarativePropertyData *data = &propertyIndexCache[ii - propertyIndexCacheStart];
data->lazyLoad(p, engine);
data->flags |= propertyFlags;
if (!dynamicMetaObject)
- data->flags |= Data::IsDirect;
+ data->flags |= QDeclarativePropertyData::IsDirect;
data->metaObjectOffset = allowedRevisionCache.count() - 1;
- Data *old = 0;
+ QDeclarativePropertyData *old = 0;
if (utf8) {
QHashedString propName(QString::fromUtf8(str, cptr - str));
- if (Data **it = stringCache.value(propName))
+ if (QDeclarativePropertyData **it = stringCache.value(propName))
old = *it;
stringCache.insert(propName, data);
} else {
QHashedCStringRef propName(str, cptr - str);
- if (Data **it = stringCache.value(propName))
+ if (QDeclarativePropertyData **it = stringCache.value(propName))
old = *it;
stringCache.insert(propName, data);
}
if (old) {
- data->overrideIndexIsProperty = !bool(old->flags & Data::IsFunction);
+ data->overrideIndexIsProperty = !old->isFunction();
data->overrideIndex = old->coreIndex;
}
}
}
-void QDeclarativePropertyCache::resolve(Data *data) const
+void QDeclarativePropertyCache::resolve(QDeclarativePropertyData *data) const
{
Q_ASSERT(data->notFullyResolved());
data->propType = qMetaTypeId<QVariant>();
- if (!(data->flags & Data::IsFunction))
+ if (!data->isFunction())
data->flags |= flagsForPropertyType(data->propType, engine);
- data->flags &= ~Data::NotFullyResolved;
+ data->flags &= ~QDeclarativePropertyData::NotFullyResolved;
}
void QDeclarativePropertyCache::updateRecur(QDeclarativeEngine *engine, const QMetaObject *metaObject)
updateRecur(engine,metaObject);
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativePropertyCache::property(int index) const
{
if (index < 0 || index >= (propertyIndexCacheStart + propertyIndexCache.count()))
if (index < propertyIndexCacheStart)
return parent->property(index);
- Data *rv = const_cast<Data *>(&propertyIndexCache.at(index - propertyIndexCacheStart));
+ QDeclarativePropertyData *rv = const_cast<QDeclarativePropertyData *>(&propertyIndexCache.at(index - propertyIndexCacheStart));
if (rv->notFullyResolved()) resolve(rv);
return rv;
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativePropertyCache::method(int index) const
{
if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count()))
if (index < methodIndexCacheStart)
return parent->method(index);
- Data *rv = const_cast<Data *>(&methodIndexCache.at(index - methodIndexCacheStart));
+ QDeclarativePropertyData *rv = const_cast<QDeclarativePropertyData *>(&methodIndexCache.at(index - methodIndexCacheStart));
if (rv->notFullyResolved()) resolve(rv);
return rv;
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativePropertyCache::property(const QHashedStringRef &str) const
{
- QDeclarativePropertyCache::Data **rv = stringCache.value(str);
+ QDeclarativePropertyData **rv = stringCache.value(str);
if (rv && (*rv)->notFullyResolved()) resolve(*rv);
return rv?*rv:0;
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativePropertyCache::property(const QHashedCStringRef &str) const
{
- QDeclarativePropertyCache::Data **rv = stringCache.value(str);
+ QDeclarativePropertyData **rv = stringCache.value(str);
if (rv && (*rv)->notFullyResolved()) resolve(*rv);
return rv?*rv:0;
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativePropertyCache::property(const QString &str) const
{
- QDeclarativePropertyCache::Data **rv = stringCache.value(str);
+ QDeclarativePropertyData **rv = stringCache.value(str);
if (rv && (*rv)->notFullyResolved()) resolve(*rv);
return rv?*rv:0;
}
-QString QDeclarativePropertyCache::Data::name(QObject *object)
+QString QDeclarativePropertyData::name(QObject *object)
{
if (!object)
return QString();
return name(object->metaObject());
}
-QString QDeclarativePropertyCache::Data::name(const QMetaObject *metaObject)
+QString QDeclarativePropertyData::name(const QMetaObject *metaObject)
{
if (!metaObject || coreIndex == -1)
return QString();
while (index < c->methodIndexCacheStart)
c = c->parent;
- Data *rv = const_cast<Data *>(&c->methodIndexCache.at(index - c->methodIndexCacheStart));
+ QDeclarativePropertyData *rv = const_cast<QDeclarativePropertyData *>(&c->methodIndexCache.at(index - c->methodIndexCacheStart));
if (rv->arguments)
return static_cast<A *>(rv->arguments)->arguments;
}
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativePropertyCache::property(QDeclarativeEngine *engine, QObject *obj,
- const QHashedV8String &name, Data &local)
+ const QHashedV8String &name, QDeclarativePropertyData &local)
{
// XXX Optimize for worker script case where engine isn't available
QDeclarativePropertyCache *cache = 0;
}
}
- QDeclarativePropertyCache::Data *rv = 0;
+ QDeclarativePropertyData *rv = 0;
if (cache) {
rv = cache->property(name);
return rv;
}
-QDeclarativePropertyCache::Data *
+QDeclarativePropertyData *
QDeclarativePropertyCache::property(QDeclarativeEngine *engine, QObject *obj,
- const QString &name, Data &local)
+ const QString &name, QDeclarativePropertyData &local)
{
- QDeclarativePropertyCache::Data *rv = 0;
+ QDeclarativePropertyData *rv = 0;
if (!engine) {
local = QDeclarativePropertyCache::create(obj->metaObject(), name);
class QV8Engine;
class QV8QObjectWrapper;
class QDeclarativePropertyCacheMethodArguments;
+class QDeclarativePropertyData;
-class Q_DECLARATIVE_EXPORT QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarativeCleanup
+// We have this somewhat aweful split between RawData and Data so that RawData can be
+// used in unions. In normal code, you should always use Data which initializes RawData
+// to an invalid state on construction.
+class QDeclarativePropertyRawData
{
public:
- QDeclarativePropertyCache(QDeclarativeEngine *);
- QDeclarativePropertyCache(QDeclarativeEngine *, const QMetaObject *);
- virtual ~QDeclarativePropertyCache();
-
- // We have this somewhat aweful split between RawData and Data so that RawData can be
- // used in unions. In normal code, you should always use Data which initializes RawData
- // to an invalid state on construction.
- struct Data;
- struct RawData {
- enum Flag {
- NoFlags = 0x00000000,
- ValueTypeFlagMask = 0x0000FFFF, // Flags in valueTypeFlags must fit in this mask
-
- // Can apply to all properties, except IsFunction
- IsConstant = 0x00000001, // Has CONST flag
- IsWritable = 0x00000002, // Has WRITE function
- IsResettable = 0x00000004, // Has RESET function
- IsAlias = 0x00000008, // Is a QML alias to another property
- IsFinal = 0x00000010, // Has FINAL flag
- IsDirect = 0x00000020, // Exists on a C++ QMetaObject
-
- // These are mutualy exclusive
- IsFunction = 0x00000040, // Is an invokable
- IsQObjectDerived = 0x00000080, // Property type is a QObject* derived type
- IsEnumType = 0x00000100, // Property type is an enum
- IsQList = 0x00000200, // Property type is a QML list
- IsQmlBinding = 0x00000400, // Property type is a QDeclarativeBinding*
- IsQJSValue = 0x00000800, // Property type is a QScriptValue
- IsV8Handle = 0x00001000, // Property type is a QDeclarativeV8Handle
- IsVMEProperty = 0x00002000, // Property type is a "var" property of VMEMO
- IsValueTypeVirtual = 0x00004000, // Property is a value type "virtual" property
-
- // Apply only to IsFunctions
- IsVMEFunction = 0x00008000, // Function was added by QML
- HasArguments = 0x00010000, // Function takes arguments
- IsSignal = 0x00020000, // Function is a signal
- IsVMESignal = 0x00040000, // Signal was added by QML
- IsV8Function = 0x00080000, // Function takes QDeclarativeV8Function* args
- IsSignalHandler = 0x00100000, // Function is a signal handler
- IsOverload = 0x00200000, // Function is an overload of another function
-
- // Internal QDeclarativePropertyCache flags
- NotFullyResolved = 0x00400000 // True if the type data is to be lazily resolved
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- Flags getFlags() const { return Flag(flags); }
- void setFlags(Flags f) { flags = f; }
-
- bool isValid() const { return coreIndex != -1; }
-
- bool isConstant() const { return flags & IsConstant; }
- bool isWritable() const { return flags & IsWritable; }
- bool isResettable() const { return flags & IsResettable; }
- bool isAlias() const { return flags & IsAlias; }
- bool isFinal() const { return flags & IsFinal; }
- bool isDirect() const { return flags & IsDirect; }
- bool isFunction() const { return flags & IsFunction; }
- bool isQObject() const { return flags & IsQObjectDerived; }
- bool isEnum() const { return flags & IsEnumType; }
- bool isQList() const { return flags & IsQList; }
- bool isQmlBinding() const { return flags & IsQmlBinding; }
- bool isQJSValue() const { return flags & IsQJSValue; }
- bool isV8Handle() const { return flags & IsV8Handle; }
- bool isVMEProperty() const { return flags & IsVMEProperty; }
- bool isValueTypeVirtual() const { return flags & IsValueTypeVirtual; }
- bool isVMEFunction() const { return flags & IsVMEFunction; }
- bool hasArguments() const { return flags & HasArguments; }
- bool isSignal() const { return flags & IsSignal; }
- bool isVMESignal() const { return flags & IsVMESignal; }
- bool isV8Function() const { return flags & IsV8Function; }
- bool isSignalHandler() const { return flags & IsSignalHandler; }
- bool isOverload() const { return flags & IsOverload; }
-
- union {
- int propType; // When !NotFullyResolved
- const char *propTypeName; // When NotFullyResolved
- };
- int coreIndex;
- union {
- int notifyIndex; // When !IsFunction
- void *arguments; // When IsFunction && HasArguments
+ enum Flag {
+ NoFlags = 0x00000000,
+ ValueTypeFlagMask = 0x0000FFFF, // Flags in valueTypeFlags must fit in this mask
+
+ // Can apply to all properties, except IsFunction
+ IsConstant = 0x00000001, // Has CONST flag
+ IsWritable = 0x00000002, // Has WRITE function
+ IsResettable = 0x00000004, // Has RESET function
+ IsAlias = 0x00000008, // Is a QML alias to another property
+ IsFinal = 0x00000010, // Has FINAL flag
+ IsDirect = 0x00000020, // Exists on a C++ QMetaObject
+
+ // These are mutualy exclusive
+ IsFunction = 0x00000040, // Is an invokable
+ IsQObjectDerived = 0x00000080, // Property type is a QObject* derived type
+ IsEnumType = 0x00000100, // Property type is an enum
+ IsQList = 0x00000200, // Property type is a QML list
+ IsQmlBinding = 0x00000400, // Property type is a QDeclarativeBinding*
+ IsQJSValue = 0x00000800, // Property type is a QScriptValue
+ IsV8Handle = 0x00001000, // Property type is a QDeclarativeV8Handle
+ IsVMEProperty = 0x00002000, // Property type is a "var" property of VMEMO
+ IsValueTypeVirtual = 0x00004000, // Property is a value type "virtual" property
+
+ // Apply only to IsFunctions
+ IsVMEFunction = 0x00008000, // Function was added by QML
+ HasArguments = 0x00010000, // Function takes arguments
+ IsSignal = 0x00020000, // Function is a signal
+ IsVMESignal = 0x00040000, // Signal was added by QML
+ IsV8Function = 0x00080000, // Function takes QDeclarativeV8Function* args
+ IsSignalHandler = 0x00100000, // Function is a signal handler
+ IsOverload = 0x00200000, // Function is an overload of another function
+
+ // Internal QDeclarativePropertyCache flags
+ NotFullyResolved = 0x00400000 // True if the type data is to be lazily resolved
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ Flags getFlags() const { return Flag(flags); }
+ void setFlags(Flags f) { flags = f; }
+
+ bool isValid() const { return coreIndex != -1; }
+
+ bool isConstant() const { return flags & IsConstant; }
+ bool isWritable() const { return flags & IsWritable; }
+ bool isResettable() const { return flags & IsResettable; }
+ bool isAlias() const { return flags & IsAlias; }
+ bool isFinal() const { return flags & IsFinal; }
+ bool isDirect() const { return flags & IsDirect; }
+ bool isFunction() const { return flags & IsFunction; }
+ bool isQObject() const { return flags & IsQObjectDerived; }
+ bool isEnum() const { return flags & IsEnumType; }
+ bool isQList() const { return flags & IsQList; }
+ bool isQmlBinding() const { return flags & IsQmlBinding; }
+ bool isQJSValue() const { return flags & IsQJSValue; }
+ bool isV8Handle() const { return flags & IsV8Handle; }
+ bool isVMEProperty() const { return flags & IsVMEProperty; }
+ bool isValueTypeVirtual() const { return flags & IsValueTypeVirtual; }
+ bool isVMEFunction() const { return flags & IsVMEFunction; }
+ bool hasArguments() const { return flags & HasArguments; }
+ bool isSignal() const { return flags & IsSignal; }
+ bool isVMESignal() const { return flags & IsVMESignal; }
+ bool isV8Function() const { return flags & IsV8Function; }
+ bool isSignalHandler() const { return flags & IsSignalHandler; }
+ bool isOverload() const { return flags & IsOverload; }
+
+ union {
+ int propType; // When !NotFullyResolved
+ const char *propTypeName; // When NotFullyResolved
+ };
+ int coreIndex;
+ union {
+ int notifyIndex; // When !IsFunction
+ void *arguments; // When IsFunction && HasArguments
+ };
+ union {
+ struct { // When !IsValueTypeVirtual
+ uint overrideIndexIsProperty : 1;
+ signed int overrideIndex : 31;
};
- union {
- struct { // When !IsValueTypeVirtual
- uint overrideIndexIsProperty : 1;
- signed int overrideIndex : 31;
- };
- struct { // When IsValueTypeVirtual
- quint16 valueTypeFlags; // flags of the access property on the value type proxy object
- quint8 valueTypePropType; // The QVariant::Type of access property on the value type
- // proxy object
- quint8 valueTypeCoreIndex; // The prop index of the access property on the value type
- //proxy object
- };
+ struct { // When IsValueTypeVirtual
+ quint16 valueTypeFlags; // flags of the access property on the value type proxy object
+ quint8 valueTypePropType; // The QVariant::Type of access property on the value type
+ // proxy object
+ quint8 valueTypeCoreIndex; // The prop index of the access property on the value type
+ //proxy object
};
- int revision;
- int metaObjectOffset;
-
- private:
- friend struct Data;
- friend class QDeclarativePropertyCache;
- quint32 flags;
};
+ int revision;
+ int metaObjectOffset;
+
+private:
+ friend class QDeclarativePropertyData;
+ friend class QDeclarativePropertyCache;
+ quint32 flags;
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyRawData::Flags);
- struct Data : public RawData {
- inline Data();
- inline Data(const RawData &);
+class QDeclarativePropertyData : public QDeclarativePropertyRawData
+{
+public:
+ inline QDeclarativePropertyData();
+ inline QDeclarativePropertyData(const QDeclarativePropertyRawData &);
- inline bool operator==(const RawData &);
+ inline bool operator==(const QDeclarativePropertyRawData &);
- static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine = 0);
- void load(const QMetaProperty &, QDeclarativeEngine *engine = 0);
- void load(const QMetaMethod &);
- QString name(QObject *);
- QString name(const QMetaObject *);
+ static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine = 0);
+ void load(const QMetaProperty &, QDeclarativeEngine *engine = 0);
+ void load(const QMetaMethod &);
+ QString name(QObject *);
+ QString name(const QMetaObject *);
- // Returns -1 if not a value type virtual property
- inline int getValueTypeCoreIndex() const;
+ // Returns -1 if not a value type virtual property
+ inline int getValueTypeCoreIndex() const;
- private:
- friend class QDeclarativePropertyCache;
- void lazyLoad(const QMetaProperty &, QDeclarativeEngine *engine = 0);
- void lazyLoad(const QMetaMethod &);
- bool notFullyResolved() const { return flags & NotFullyResolved; }
- };
+private:
+ friend class QDeclarativePropertyCache;
+ void lazyLoad(const QMetaProperty &, QDeclarativeEngine *engine = 0);
+ void lazyLoad(const QMetaMethod &);
+ bool notFullyResolved() const { return flags & NotFullyResolved; }
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarativeCleanup
+{
+public:
+ QDeclarativePropertyCache(QDeclarativeEngine *);
+ QDeclarativePropertyCache(QDeclarativeEngine *, const QMetaObject *);
+ virtual ~QDeclarativePropertyCache();
void update(QDeclarativeEngine *, const QMetaObject *);
QDeclarativePropertyCache *copy(int reserve = 0);
- void append(QDeclarativeEngine *, const QMetaObject *, Data::Flag propertyFlags = Data::NoFlags,
- Data::Flag methodFlags = Data::NoFlags, Data::Flag signalFlags = Data::NoFlags);
- void append(QDeclarativeEngine *, const QMetaObject *, int revision, Data::Flag propertyFlags = Data::NoFlags,
- Data::Flag methodFlags = Data::NoFlags, Data::Flag signalFlags = Data::NoFlags);
-
- static Data create(const QMetaObject *, const QString &);
-
- inline Data *property(const QHashedV8String &) const;
- Data *property(const QHashedStringRef &) const;
- Data *property(const QHashedCStringRef &) const;
- Data *property(const QString &) const;
- Data *property(int) const;
- Data *method(int) const;
+ void append(QDeclarativeEngine *, const QMetaObject *,
+ QDeclarativePropertyData::Flag propertyFlags = QDeclarativePropertyData::NoFlags,
+ QDeclarativePropertyData::Flag methodFlags = QDeclarativePropertyData::NoFlags,
+ QDeclarativePropertyData::Flag signalFlags = QDeclarativePropertyData::NoFlags);
+ void append(QDeclarativeEngine *, const QMetaObject *, int revision,
+ QDeclarativePropertyData::Flag propertyFlags = QDeclarativePropertyData::NoFlags,
+ QDeclarativePropertyData::Flag methodFlags = QDeclarativePropertyData::NoFlags,
+ QDeclarativePropertyData::Flag signalFlags = QDeclarativePropertyData::NoFlags);
+
+ static QDeclarativePropertyData create(const QMetaObject *, const QString &);
+
+ inline QDeclarativePropertyData *property(const QHashedV8String &) const;
+ QDeclarativePropertyData *property(const QHashedStringRef &) const;
+ QDeclarativePropertyData *property(const QHashedCStringRef &) const;
+ QDeclarativePropertyData *property(const QString &) const;
+ QDeclarativePropertyData *property(int) const;
+ QDeclarativePropertyData *method(int) const;
QStringList propertyNames() const;
- inline Data *overrideData(Data *) const;
- inline bool isAllowedInRevision(Data *) const;
+ inline QDeclarativePropertyData *overrideData(QDeclarativePropertyData *) const;
+ inline bool isAllowedInRevision(QDeclarativePropertyData *) const;
inline QDeclarativeEngine *qmlEngine() const;
- static Data *property(QDeclarativeEngine *, QObject *, const QString &, Data &);
- static Data *property(QDeclarativeEngine *, QObject *, const QHashedV8String &, Data &);
+ static QDeclarativePropertyData *property(QDeclarativeEngine *, QObject *, const QString &,
+ QDeclarativePropertyData &);
+ static QDeclarativePropertyData *property(QDeclarativeEngine *, QObject *, const QHashedV8String &,
+ QDeclarativePropertyData &);
static int *methodParameterTypes(QObject *, int index, QVarLengthArray<int, 9> &dummy,
QByteArray *unknownTypeError);
// Implemented in v8/qv8qobjectwrapper.cpp
v8::Local<v8::Object> newQObject(QObject *, QV8Engine *);
- typedef QVector<Data> IndexCache;
- typedef QStringHash<Data *> StringCache;
+ typedef QVector<QDeclarativePropertyData> IndexCache;
+ typedef QStringHash<QDeclarativePropertyData *> StringCache;
typedef QVector<int> AllowedRevisionCache;
- void resolve(Data *) const;
+ void resolve(QDeclarativePropertyData *) const;
void updateRecur(QDeclarativeEngine *, const QMetaObject *);
QDeclarativeEngine *engine;
const QMetaObject *metaObject;
QDeclarativePropertyCacheMethodArguments *argumentsCache;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyCache::Data::Flags);
-QDeclarativePropertyCache::Data::Data()
+QDeclarativePropertyData::QDeclarativePropertyData()
{
propType = 0;
coreIndex = -1;
flags = 0;
}
-QDeclarativePropertyCache::Data::Data(const QDeclarativePropertyCache::RawData &d)
+QDeclarativePropertyData::QDeclarativePropertyData(const QDeclarativePropertyRawData &d)
{
- *(static_cast<RawData *>(this)) = d;
+ *(static_cast<QDeclarativePropertyRawData *>(this)) = d;
}
-bool QDeclarativePropertyCache::Data::operator==(const QDeclarativePropertyCache::RawData &other)
+bool QDeclarativePropertyData::operator==(const QDeclarativePropertyRawData &other)
{
return flags == other.flags &&
propType == other.propType &&
valueTypePropType == other.valueTypePropType));
}
-int QDeclarativePropertyCache::Data::getValueTypeCoreIndex() const
+int QDeclarativePropertyData::getValueTypeCoreIndex() const
{
return isValueTypeVirtual()?valueTypeCoreIndex:-1;
}
-QDeclarativePropertyCache::Data *
-QDeclarativePropertyCache::overrideData(Data *data) const
+QDeclarativePropertyData *
+QDeclarativePropertyCache::overrideData(QDeclarativePropertyData *data) const
{
if (data->overrideIndex < 0)
return 0;
return method(data->overrideIndex);
}
-bool QDeclarativePropertyCache::isAllowedInRevision(Data *data) const
+bool QDeclarativePropertyCache::isAllowedInRevision(QDeclarativePropertyData *data) const
{
return (data->metaObjectOffset == -1 && data->revision == 0) ||
(allowedRevisionCache[data->metaObjectOffset] >= data->revision);
return engine;
}
-QDeclarativePropertyCache::Data *QDeclarativePropertyCache::property(const QHashedV8String &str) const
+QDeclarativePropertyData *QDeclarativePropertyCache::property(const QHashedV8String &str) const
{
- QDeclarativePropertyCache::Data **rv = stringCache.value(str);
+ QDeclarativePropertyData **rv = stringCache.value(str);
if (rv && (*rv)->notFullyResolved()) resolve(*rv);
return rv?*rv:0;
}
// The core data in the case of a regular property.
// XXX This has to be a value now as the synthCache may change during
// compilation which invalidates pointers. We should fix this.
- QDeclarativePropertyCache::Data core;
+ QDeclarativePropertyData core;
// Returns true if this is an empty property - both value and values
// are unset.
const QMetaObject *metaObject = m_expression->context->metaObject();
if (!cache) cache = m_engine->cache(metaObject);
- QDeclarativePropertyCache::Data *data = cache->property(name);
+ QDeclarativePropertyData *data = cache->property(name);
if (data && data->revision != 0) {
if (qmlVerboseCompiler())
const QMetaObject *metaObject = m_expression->component->metaObject();
if (!cache) cache = m_engine->cache(metaObject);
- QDeclarativePropertyCache::Data *data = cache->property(name);
+ QDeclarativePropertyData *data = cache->property(name);
if (data && data->revision != 0) {
if (qmlVerboseCompiler())
<< (*baseName->id + QLatin1String(".") + ast->name.toString());
} else if(const QMetaObject *attachedMeta = baseName->declarativeType->attachedPropertiesType()) {
QDeclarativePropertyCache *cache = m_engine->cache(attachedMeta);
- QDeclarativePropertyCache::Data *data = cache->property(name);
+ QDeclarativePropertyData *data = cache->property(name);
if (!data || data->isFunction())
return false; // Don't support methods (or non-existing properties ;)
QDeclarativePropertyCache *cache =
idObject->synthCache?idObject->synthCache:m_engine->cache(idObject->metaObject());
- QDeclarativePropertyCache::Data *data = cache->property(name);
+ QDeclarativePropertyData *data = cache->property(name);
if (!data || data->isFunction())
return false; // Don't support methods (or non-existing properties ;)
m_engine->metaObjectForType(baseName->meta->property(baseName->index).userType());
QDeclarativePropertyCache *cache = m_engine->cache(m);
- QDeclarativePropertyCache::Data *data = cache->property(name);
+ QDeclarativePropertyData *data = cache->property(name);
if (!data || data->isFunction())
return false; // Don't support methods (or non-existing properties ;)
}
QDeclarativeAbstractBinding *QV8Bindings::configBinding(int index, QObject *target, QObject *scope,
- const QDeclarativePropertyCache::Data &p,
+ const QDeclarativePropertyData &p,
int line)
{
QV8Bindings::Binding *rv = bindings + index;
virtual ~QV8Bindings();
QDeclarativeAbstractBinding *configBinding(int index, QObject *target, QObject *scope,
- const QDeclarativePropertyCache::Data &prop,
+ const QDeclarativePropertyData &prop,
int line);
private:
bool updating:1;
int line;
QObject *object;
- QDeclarativePropertyCache::Data property;
+ QDeclarativePropertyData property;
QV8Bindings *parent;
};
// Load value properties
static v8::Handle<v8::Value> LoadProperty(QV8Engine *engine, QObject *object,
- const QDeclarativePropertyCache::Data &property)
+ const QDeclarativePropertyData &property)
{
Q_ASSERT(!property.isFunction());
}
static v8::Handle<v8::Value> LoadPropertyDirect(QV8Engine *engine, QObject *object,
- const QDeclarativePropertyCache::Data &property)
+ const QDeclarativePropertyData &property)
{
Q_ASSERT(!property.isFunction());
}
}
- QDeclarativePropertyCache::Data local;
- QDeclarativePropertyCache::Data *result = 0;
+ QDeclarativePropertyData local;
+ QDeclarativePropertyData *result = 0;
{
QDeclarativeData *ddata = QDeclarativeData::get(object, false);
if (ddata && ddata->propertyCache)
}
// Setter for writable properties. Shared between the interceptor and fast property accessor
-static inline void StoreProperty(QV8Engine *engine, QObject *object, QDeclarativePropertyCache::Data *property,
+static inline void StoreProperty(QV8Engine *engine, QObject *object, QDeclarativePropertyData *property,
v8::Handle<v8::Value> value)
{
QDeclarativeBinding *newBinding = 0;
engine->qobjectWrapper()->m_destroyString == property)
return true;
- QDeclarativePropertyCache::Data local;
- QDeclarativePropertyCache::Data *result = 0;
+ QDeclarativePropertyData local;
+ QDeclarativePropertyData *result = 0;
result = QDeclarativePropertyCache::property(engine->engine(), object, property, local);
if (!result)
QHashedV8String propertystring(property);
- QDeclarativePropertyCache::Data local;
- QDeclarativePropertyCache::Data *result = 0;
+ QDeclarativePropertyData local;
+ QDeclarativePropertyData *result = 0;
result = QDeclarativePropertyCache::property(engine->engine(), object, propertystring, local);
if (!result)
Q_ASSERT(ddata);
Q_ASSERT(ddata->propertyCache);
- QDeclarativePropertyCache::Data *pdata = ddata->propertyCache->property(index);
+ QDeclarativePropertyData *pdata = ddata->propertyCache->property(index);
Q_ASSERT(pdata);
Q_ASSERT(pdata->isWritable() || pdata->isQList());
// performance, but the cost of setting up this structure hasn't been measured so
// its not guarenteed that this is a win overall. We need to try and measure the cost.
for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) {
- Data *property = *iter;
+ QDeclarativePropertyData *property = *iter;
if (property->isFunction() ||
property->coreIndex >= 0x7FFF || property->notifyIndex >= 0x0FFF ||
property->coreIndex == 0)
/*!
Returns the next related method, if one, or 0.
*/
-static const QDeclarativePropertyCache::Data * RelatedMethod(QObject *object,
- const QDeclarativePropertyCache::Data *current,
- QDeclarativePropertyCache::Data &dummy)
+static const QDeclarativePropertyData * RelatedMethod(QObject *object,
+ const QDeclarativePropertyData *current,
+ QDeclarativePropertyData &dummy)
{
QDeclarativePropertyCache *cache = QDeclarativeData::get(object)->propertyCache;
if (!current->isOverload())
QByteArray methodName = QMetaMethod_name(method);
for (int ii = current->overrideIndex - 1; ii >= methodOffset; --ii) {
if (methodName == QMetaMethod_name(mo->method(ii))) {
- dummy.setFlags(dummy.getFlags() | QDeclarativePropertyCache::Data::IsOverload);
+ dummy.setFlags(dummy.getFlags() | QDeclarativePropertyData::IsOverload);
dummy.overrideIndexIsProperty = 0;
dummy.overrideIndex = ii;
return &dummy;
}
}
-static v8::Handle<v8::Value> CallPrecise(QObject *object, const QDeclarativePropertyCache::Data &data,
+static v8::Handle<v8::Value> CallPrecise(QObject *object, const QDeclarativePropertyData &data,
QV8Engine *engine, CallArgs &callArgs)
{
if (data.hasArguments()) {
If two or more overloads have the same match score, call the last one. The match
score is constructed by adding the matchScore() result for each of the parameters.
*/
-static v8::Handle<v8::Value> CallOverloaded(QObject *object, const QDeclarativePropertyCache::Data &data,
+static v8::Handle<v8::Value> CallOverloaded(QObject *object, const QDeclarativePropertyData &data,
QV8Engine *engine, CallArgs &callArgs)
{
int argumentCount = callArgs.Length();
- const QDeclarativePropertyCache::Data *best = 0;
+ const QDeclarativePropertyData *best = 0;
int bestParameterScore = INT_MAX;
int bestMatchScore = INT_MAX;
- QDeclarativePropertyCache::Data dummy;
- const QDeclarativePropertyCache::Data *attempt = &data;
+ QDeclarativePropertyData dummy;
+ const QDeclarativePropertyData *attempt = &data;
do {
QVarLengthArray<int, 9> dummy;
return CallPrecise(object, *best, engine, callArgs);
} else {
QString error = QLatin1String("Unable to determine callable overload. Candidates are:");
- const QDeclarativePropertyCache::Data *candidate = &data;
+ const QDeclarativePropertyData *candidate = &data;
while (candidate) {
error += QLatin1String("\n ") +
QString::fromUtf8(object->metaObject()->method(candidate->coreIndex).signature());
}
}
- QDeclarativePropertyCache::Data method;
+ QDeclarativePropertyData method;
if (QDeclarativeData *ddata = static_cast<QDeclarativeData *>(QObjectPrivate::get(object)->declarativeData)) {
if (ddata->propertyCache) {
- QDeclarativePropertyCache::Data *d = ddata->propertyCache->method(index);
+ QDeclarativePropertyData *d = ddata->propertyCache->method(index);
if (!d)
return v8::Undefined();
method = *d;
QDeclarativeContextData *context = r->engine->callingContext();
v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(value);
- QDeclarativePropertyCache::Data cacheData;
- cacheData.setFlags(QDeclarativePropertyCache::Data::IsWritable |
- QDeclarativePropertyCache::Data::IsValueTypeVirtual);
+ QDeclarativePropertyData cacheData;
+ cacheData.setFlags(QDeclarativePropertyData::IsWritable |
+ QDeclarativePropertyData::IsValueTypeVirtual);
cacheData.propType = reference->object->metaObject()->property(reference->property).userType();
cacheData.coreIndex = reference->property;
cacheData.valueTypeFlags = 0;
QDeclarativeData *ddata = QDeclarativeData::get(data);
if (ddata && ddata->propertyCache) {
- QDeclarativePropertyCache::Data *prop = ddata->propertyCache->property(name);
+ QDeclarativePropertyData *prop = ddata->propertyCache->property(name);
if (prop) {
if (prop->propType == QVariant::String) {
void *args[] = { &val, 0 };