Cleanups in QMetaProperty

This changes the layout of the meta object data, so
also bump the meta object revision.

Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Change-Id: I176fb16c207e8ebe59e358e69554be813406232f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Fabian Kosmale 2020-04-01 09:23:53 +02:00
parent 5603be705e
commit 630c7b4811
11 changed files with 166 additions and 296 deletions

View File

@ -978,8 +978,9 @@ int QMetaObject::indexOfEnumerator(const char *name) const
const QMetaObject *m = this;
while (m) {
const QMetaObjectPrivate *d = priv(m->d.data);
for (int i = d->enumeratorCount - 1; i >= 0; --i) {
const char *prop = rawStringData(m, m->d.data[d->enumeratorData + QMetaObjectPrivate::IntsPerEnum * i]);
for (int i = 0; i < d->enumeratorCount; ++i) {
const QMetaEnum e(m, i);
const char *prop = rawStringData(m, e.data.name());
if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) {
i += m->enumeratorOffset();
return i;
@ -991,8 +992,9 @@ int QMetaObject::indexOfEnumerator(const char *name) const
m = this;
while (m) {
const QMetaObjectPrivate *d = priv(m->d.data);
for (int i = d->enumeratorCount - 1; i >= 0; --i) {
const char *prop = rawStringData(m, m->d.data[d->enumeratorData + QMetaObjectPrivate::IntsPerEnum * i + 1]);
for (int i = 0; i < d->enumeratorCount; ++i) {
const QMetaEnum e(m, i);
const char *prop = rawStringData(m, e.data.alias());
if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) {
i += m->enumeratorOffset();
return i;
@ -1014,8 +1016,9 @@ int QMetaObject::indexOfProperty(const char *name) const
const QMetaObject *m = this;
while (m) {
const QMetaObjectPrivate *d = priv(m->d.data);
for (int i = d->propertyCount-1; i >= 0; --i) {
const char *prop = rawStringData(m, m->d.data[d->propertyData + 3*i]);
for (int i = 0; i < d->propertyCount; ++i) {
const QMetaProperty p(m, i);
const char *prop = rawStringData(m, p.data.name());
if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) {
i += m->propertyOffset();
return i;
@ -1024,7 +1027,6 @@ int QMetaObject::indexOfProperty(const char *name) const
m = m->d.superdata;
}
Q_ASSERT(priv(this->d.data)->revision >= 3);
if (priv(this->d.data)->flags & DynamicMetaObject) {
QAbstractDynamicMetaObject *me =
const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this));
@ -1118,47 +1120,9 @@ QMetaProperty QMetaObject::property(int index) const
if (i < 0 && d.superdata)
return d.superdata->property(index);
QMetaProperty result;
if (i >= 0 && i < priv(d.data)->propertyCount) {
int handle = priv(d.data)->propertyData + 3*i;
int flags = d.data[handle + 2];
result.mobj = this;
result.handle = handle;
result.idx = i;
if (flags & EnumOrFlag) {
const char *type = rawTypeNameFromTypeInfo(this, d.data[handle + 1]);
result.menum = enumerator(indexOfEnumerator(type));
if (!result.menum.isValid()) {
const char *enum_name = type;
const char *scope_name = objectClassName(this);
char *scope_buffer = nullptr;
const char *colon = strrchr(enum_name, ':');
// ':' will always appear in pairs
Q_ASSERT(colon <= enum_name || *(colon-1) == ':');
if (colon > enum_name) {
int len = colon-enum_name-1;
scope_buffer = (char *)malloc(len+1);
memcpy(scope_buffer, enum_name, len);
scope_buffer[len] = '\0';
scope_name = scope_buffer;
enum_name = colon+1;
}
const QMetaObject *scope = nullptr;
if (qstrcmp(scope_name, "Qt") == 0)
scope = &Qt::staticMetaObject;
else
scope = QMetaObject_findMetaObject(this, scope_name);
if (scope)
result.menum = scope->enumerator(scope->indexOfEnumerator(enum_name));
if (scope_buffer)
free(scope_buffer);
}
}
}
return result;
if (i >= 0 && i < priv(d.data)->propertyCount)
return QMetaProperty(this, i);
return QMetaProperty();
}
/*!
@ -2921,13 +2885,9 @@ QMetaEnum::QMetaEnum(const QMetaObject *mobj, int index)
*/
/*!
\fn QMetaProperty::QMetaProperty()
\internal
*/
QMetaProperty::QMetaProperty()
: mobj(nullptr), handle(0), idx(0)
{
}
/*!
Returns this property's name.
@ -2938,8 +2898,7 @@ const char *QMetaProperty::name() const
{
if (!mobj)
return nullptr;
int handle = priv(mobj->d.data)->propertyData + 3*idx;
return rawStringData(mobj, mobj->d.data[handle]);
return rawStringData(mobj, data.name());
}
/*!
@ -2951,8 +2910,7 @@ const char *QMetaProperty::typeName() const
{
if (!mobj)
return nullptr;
int handle = priv(mobj->d.data)->propertyData + 3*idx;
return rawTypeNameFromTypeInfo(mobj, mobj->d.data[handle + 1]);
return rawTypeNameFromTypeInfo(mobj, data.type());
}
/*!
@ -3049,9 +3007,7 @@ bool QMetaProperty::isEnumType() const
{
if (!mobj)
return false;
int handle = priv(mobj->d.data)->propertyData + 3*idx;
int flags = mobj->d.data[handle + 2];
return (flags & EnumOrFlag) && menum.name();
return (data.flags() & EnumOrFlag) && menum.name();
}
/*!
@ -3067,9 +3023,7 @@ bool QMetaProperty::hasStdCppSet() const
{
if (!mobj)
return false;
int handle = priv(mobj->d.data)->propertyData + 3*idx;
int flags = mobj->d.data[handle + 2];
return (flags & StdCppSet);
return (data.flags() & StdCppSet);
}
/*!
@ -3086,6 +3040,46 @@ int QMetaProperty::registerPropertyType() const
return registerResult == -1 ? QMetaType::UnknownType : registerResult;
}
QMetaProperty::QMetaProperty(const QMetaObject *mobj, int index)
: mobj(mobj),
data({ mobj->d.data + priv(mobj->d.data)->propertyData + index * Data::Size }),
idx(index)
{
Q_ASSERT(index >= 0 && index < priv(mobj->d.data)->propertyCount);
if (data.flags() & EnumOrFlag) {
const char *type = rawTypeNameFromTypeInfo(mobj, data.type());
menum = mobj->enumerator(mobj->indexOfEnumerator(type));
if (!menum.isValid()) {
const char *enum_name = type;
const char *scope_name = objectClassName(mobj);
char *scope_buffer = nullptr;
const char *colon = strrchr(enum_name, ':');
// ':' will always appear in pairs
Q_ASSERT(colon <= enum_name || *(colon-1) == ':');
if (colon > enum_name) {
int len = colon-enum_name-1;
scope_buffer = (char *)malloc(len+1);
memcpy(scope_buffer, enum_name, len);
scope_buffer[len] = '\0';
scope_name = scope_buffer;
enum_name = colon+1;
}
const QMetaObject *scope = nullptr;
if (qstrcmp(scope_name, "Qt") == 0)
scope = &Qt::staticMetaObject;
else
scope = QMetaObject_findMetaObject(mobj, scope_name);
if (scope)
menum = scope->enumerator(scope->indexOfEnumerator(enum_name));
if (scope_buffer)
free(scope_buffer);
}
}
}
/*!
Returns the enumerator if this property's type is an enumerator
type; otherwise the returned value is undefined.
@ -3269,8 +3263,7 @@ bool QMetaProperty::isResettable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & Resettable;
return data.flags() & Resettable;
}
/*!
@ -3282,8 +3275,7 @@ bool QMetaProperty::isReadable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & Readable;
return data.flags() & Readable;
}
/*!
@ -3296,8 +3288,7 @@ bool QMetaProperty::hasNotifySignal() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & Notify;
return data.notifyIndex() != uint(-1);
}
/*!
@ -3327,27 +3318,23 @@ QMetaMethod QMetaProperty::notifySignal() const
*/
int QMetaProperty::notifySignalIndex() const
{
if (hasNotifySignal()) {
int offset = priv(mobj->d.data)->propertyData +
priv(mobj->d.data)->propertyCount * 3 + idx;
int methodIndex = mobj->d.data[offset];
if (methodIndex & IsUnresolvedSignal) {
methodIndex &= ~IsUnresolvedSignal;
const QByteArray signalName = stringData(mobj, methodIndex);
const QMetaObject *m = mobj;
const int idx = indexOfMethodRelative<MethodSignal>(&m, signalName, 0, nullptr);
if (idx >= 0) {
return idx + m->methodOffset();
} else {
qWarning("QMetaProperty::notifySignal: cannot find the NOTIFY signal %s in class %s for property '%s'",
signalName.constData(), objectClassName(mobj), name());
return -1;
}
}
return methodIndex + mobj->methodOffset();
} else {
if (!mobj || data.notifyIndex() == std::numeric_limits<uint>::max())
return -1;
uint methodIndex = data.notifyIndex();
if (methodIndex & IsUnresolvedSignal) {
methodIndex &= ~IsUnresolvedSignal;
const QByteArray signalName = stringData(mobj, methodIndex);
const QMetaObject *m = mobj;
const int idx = indexOfMethodRelative<MethodSignal>(&m, signalName, 0, nullptr);
if (idx >= 0) {
return idx + m->methodOffset();
} else {
qWarning("QMetaProperty::notifySignal: cannot find the NOTIFY signal %s in class %s for property '%s'",
signalName.constData(), objectClassName(mobj), name());
return -1;
}
}
return methodIndex + mobj->methodOffset();
}
// This method has been around for a while, but the documentation was marked \internal until 5.1
@ -3361,23 +3348,7 @@ int QMetaProperty::revision() const
{
if (!mobj)
return 0;
int flags = mobj->d.data[handle + 2];
if (flags & Revisioned) {
int offset = priv(mobj->d.data)->propertyData +
priv(mobj->d.data)->propertyCount * 3 + idx;
// Revision data is placed after NOTIFY data, if present.
// Iterate through properties to discover whether we have NOTIFY signals.
for (int i = 0; i < priv(mobj->d.data)->propertyCount; ++i) {
int handle = priv(mobj->d.data)->propertyData + 3*i;
if (mobj->d.data[handle + 2] & Notify) {
offset += priv(mobj->d.data)->propertyCount;
break;
}
}
return mobj->d.data[offset];
} else {
return 0;
}
return data.revision();
}
/*!
@ -3390,8 +3361,7 @@ bool QMetaProperty::isWritable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & Writable;
return data.flags() & Writable;
}
@ -3409,11 +3379,7 @@ bool QMetaProperty::isDesignable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Designable;
return b;
return data.flags() & Designable;
}
/*!
@ -3430,9 +3396,7 @@ bool QMetaProperty::isScriptable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Scriptable;
return b;
return data.flags() & Scriptable;
}
/*!
@ -3449,9 +3413,7 @@ bool QMetaProperty::isStored() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Stored;
return b;
return data.flags() & Stored;
}
/*!
@ -3471,9 +3433,7 @@ bool QMetaProperty::isUser() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & User;
return b;
return data.flags() & User;
}
/*!
@ -3487,8 +3447,7 @@ bool QMetaProperty::isConstant() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & Constant;
return data.flags() & Constant;
}
/*!
@ -3502,8 +3461,7 @@ bool QMetaProperty::isFinal() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & Final;
return data.flags() & Final;
}
/*!
@ -3517,8 +3475,7 @@ bool QMetaProperty::isRequired() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & Required;
return data.flags() & Required;
}
/*!
@ -3532,8 +3489,7 @@ bool QMetaProperty::isQProperty() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
return flags & IsQProperty;
return data.flags() & IsQProperty;
}
/*!
@ -3553,9 +3509,7 @@ bool QMetaProperty::isEditable() const
{
if (!mobj)
return false;
int flags = mobj->d.data[handle + 2];
bool b = flags & Editable;
return b;
return data.flags() & Editable;
}
#endif

View File

@ -276,7 +276,7 @@ Q_DECLARE_TYPEINFO(QMetaEnum, Q_MOVABLE_TYPE);
class Q_CORE_EXPORT QMetaProperty
{
public:
QMetaProperty();
constexpr QMetaProperty() : mobj(nullptr), data({ nullptr }), idx(-1) {}
const char *name() const;
const char *typeName() const;
@ -326,8 +326,22 @@ public:
private:
int registerPropertyType() const;
struct Data {
enum { Size = 5 };
uint name() const { return d[0]; }
uint type() const { return d[1]; }
uint flags() const { return d[2]; }
uint notifyIndex() const { return d[3]; }
uint revision() const { return d[4]; }
const uint *d;
};
QMetaProperty(const QMetaObject *mobj, int index);
const QMetaObject *mobj;
uint handle;
Data data;
int idx;
QMetaEnum menum;
friend struct QMetaObject;

View File

@ -72,7 +72,6 @@ enum PropertyFlags {
Resettable = 0x00000004,
EnumOrFlag = 0x00000008,
StdCppSet = 0x00000100,
// Override = 0x00000200,
Constant = 0x00000400,
Final = 0x00000800,
Designable = 0x00001000,
@ -80,8 +79,6 @@ enum PropertyFlags {
Stored = 0x00010000,
Editable = 0x00040000,
User = 0x00100000,
Notify = 0x00400000,
Revisioned = 0x00800000,
Required = 0x01000000,
IsQProperty = 0x02000000
};
@ -176,6 +173,7 @@ struct QMetaObjectPrivate
enum { OutputRevision = 9 }; // Used by moc, qmetaobjectbuilder and qdbus
enum { IntsPerMethod = QMetaMethod::Data::Size};
enum { IntsPerEnum = QMetaEnum::Data::Size };
enum { IntsPerProperty = QMetaProperty::Data::Size };
int revision;
int className;

View File

@ -156,13 +156,10 @@ public:
int _revision = 0)
: name(_name),
type(QMetaObject::normalizedType(_type.constData())),
flags(Readable | Writable | Scriptable), notifySignal(-1),
flags(Readable | Writable | Scriptable), notifySignal(notifierIdx),
revision(_revision)
{
if (notifierIdx >= 0) {
flags |= Notify;
notifySignal = notifierIdx;
}
}
QByteArray name;
@ -213,7 +210,6 @@ public:
staticMetacallFunction = nullptr;
}
bool hasRevisionedProperties() const;
bool hasRevisionedMethods() const;
QByteArray className;
@ -229,15 +225,6 @@ public:
int flags;
};
bool QMetaObjectBuilderPrivate::hasRevisionedProperties() const
{
for (const auto &property : properties) {
if (property.revision)
return true;
}
return false;
}
bool QMetaObjectBuilderPrivate::hasRevisionedMethods() const
{
for (const auto &method : methods) {
@ -605,7 +592,6 @@ QMetaPropertyBuilder QMetaObjectBuilder::addProperty(const QMetaProperty& protot
if (index == -1)
index = addMethod(method).index();
d->properties[property._index].notifySignal = index;
d->properties[property._index].setFlag(Notify, true);
}
return property;
}
@ -879,7 +865,6 @@ void QMetaObjectBuilder::removeMethod(int index)
// Adjust the indices of property notify signal references.
if (property.notifySignal == index) {
property.notifySignal = -1;
property.setFlag(Notify, false);
} else if (property.notifySignal > index)
property.notifySignal--;
}
@ -1180,8 +1165,6 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
int enumIndex;
int index;
bool hasRevisionedMethods = d->hasRevisionedMethods();
bool hasRevisionedProperties = d->hasRevisionedProperties();
bool hasNotifySignals = false;
if (relocatable &&
(d->relatedMetaObjects.size() > 0 || d->staticMetacallFunction))
@ -1204,12 +1187,6 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
= reinterpret_cast<QMetaObjectPrivate *>(buf + size);
int pmetaSize = size;
dataIndex = MetaObjectPrivateFieldCount;
for (const auto &property : d->properties) {
if (property.notifySignal != -1) {
hasNotifySignals = true;
break;
}
}
int methodParametersDataSize =
((aggregateParameterCount(d->methods)
+ aggregateParameterCount(d->constructors)) * 2) // types and parameter names
@ -1236,11 +1213,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
pmeta->propertyCount = int(d->properties.size());
pmeta->propertyData = dataIndex;
dataIndex += 3 * int(d->properties.size());
if (hasNotifySignals)
dataIndex += int(d->properties.size());
if (hasRevisionedProperties)
dataIndex += int(d->properties.size());
dataIndex += QMetaObjectPrivate::IntsPerProperty * int(d->properties.size());
pmeta->enumeratorCount = int(d->enumerators.size());
pmeta->enumeratorData = dataIndex;
@ -1256,11 +1229,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
dataIndex += int(d->methods.size());
paramsIndex = dataIndex;
dataIndex += methodParametersDataSize;
dataIndex += 3 * int(d->properties.size());
if (hasNotifySignals)
dataIndex += int(d->properties.size());
if (hasRevisionedProperties)
dataIndex += int(d->properties.size());
dataIndex += QMetaObjectPrivate::IntsPerProperty * int(d->properties.size());
dataIndex += QMetaObjectPrivate::IntsPerEnum * int(d->enumerators.size());
dataIndex += QMetaObjectPrivate::IntsPerMethod * int(d->constructors.size());
}
@ -1387,26 +1356,10 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
data[dataIndex] = name;
data[dataIndex + 1] = typeInfo;
data[dataIndex + 2] = flags;
data[dataIndex + 3] = prop.notifySignal;
data[dataIndex + 4] = prop.revision;
}
dataIndex += 3;
}
if (hasNotifySignals) {
for (const auto &prop : d->properties) {
if (buf) {
if (prop.notifySignal != -1)
data[dataIndex] = prop.notifySignal;
else
data[dataIndex] = 0;
}
++dataIndex;
}
}
if (hasRevisionedProperties) {
for (const auto &prop : d->properties) {
if (buf)
data[dataIndex] = prop.revision;
++dataIndex;
}
dataIndex += QMetaObjectPrivate::IntsPerProperty;
}
// Output the enumerators in the class.
@ -1675,8 +1628,7 @@ void QMetaObjectBuilder::serialize(QDataStream& stream) const
stream << property.type;
stream << property.flags;
stream << property.notifySignal;
if (property.revision)
stream << property.revision;
stream << property.revision;
}
// Write the enumerators.
@ -1838,8 +1790,7 @@ void QMetaObjectBuilder::deserialize
stream.setStatus(QDataStream::ReadCorruptData);
return;
}
if (property.flags & Revisioned)
stream >> property.revision;
stream >> property.revision;
}
// Read the enumerators.
@ -2202,7 +2153,7 @@ bool QMetaPropertyBuilder::hasNotifySignal() const
{
QMetaPropertyBuilderPrivate *d = d_func();
if (d)
return d->flag(Notify);
return d->notifySignal != -1;
else
return false;
}
@ -2232,10 +2183,8 @@ void QMetaPropertyBuilder::setNotifySignal(const QMetaMethodBuilder& value)
if (d) {
if (value._mobj) {
d->notifySignal = value._index;
d->setFlag(Notify, true);
} else {
d->notifySignal = -1;
d->setFlag(Notify, false);
}
}
}
@ -2248,10 +2197,8 @@ void QMetaPropertyBuilder::setNotifySignal(const QMetaMethodBuilder& value)
void QMetaPropertyBuilder::removeNotifySignal()
{
QMetaPropertyBuilderPrivate *d = d_func();
if (d) {
if (d)
d->notifySignal = -1;
d->setFlag(Notify, false);
}
}
/*!
@ -2604,10 +2551,8 @@ int QMetaPropertyBuilder::revision() const
void QMetaPropertyBuilder::setRevision(int revision)
{
QMetaPropertyBuilderPrivate *d = d_func();
if (d) {
if (d)
d->revision = revision;
d->setFlag(Revisioned, revision != 0);
}
}

View File

@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
#ifndef Q_MOC_OUTPUT_REVISION
#define Q_MOC_OUTPUT_REVISION 67
#define Q_MOC_OUTPUT_REVISION 68
#endif
// The following macros can be defined by tools that understand Qt

View File

@ -432,12 +432,12 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
header->flags = RequiresVariantMetaObject;
header->signalCount = signals_.count();
// These are specific to QDBusMetaObject:
header->propertyDBusData = header->propertyData + header->propertyCount * 3;
header->propertyDBusData = header->propertyData + header->propertyCount * QMetaObjectPrivate::IntsPerProperty;
header->methodDBusData = header->propertyDBusData + header->propertyCount * intsPerProperty;
int data_size = idata.size() +
(header->methodCount * (QMetaObjectPrivate::IntsPerMethod+intsPerMethod)) + methodParametersDataSize +
(header->propertyCount * (3+intsPerProperty));
(header->propertyCount * (QMetaObjectPrivate::IntsPerProperty+intsPerProperty));
for (const Method &mm : qAsConst(signals_))
data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
for (const Method &mm : qAsConst(methods))
@ -545,6 +545,8 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
Q_ASSERT(mp.type != QMetaType::UnknownType);
idata[offset++] = mp.type;
idata[offset++] = mp.flags;
idata[offset++] = -1; // notify index
idata[offset++] = 0; // revision
idata[signatureOffset++] = strings.enter(mp.signature);
idata[signatureOffset++] = mp.type;

View File

@ -363,11 +363,7 @@ void Generator::generateCode()
- cdef->constructorList.count(); // "this" parameters don't have names
fprintf(out, " %4d, %4d, // properties\n", cdef->propertyList.count(), cdef->propertyList.count() ? index : 0);
index += cdef->propertyList.count() * 3;
if(cdef->notifyableProperties)
index += cdef->propertyList.count();
if (cdef->revisionedProperties)
index += cdef->propertyList.count();
index += cdef->propertyList.count() * QMetaObjectPrivate::IntsPerProperty;
fprintf(out, " %4d, %4d, // enums/sets\n", cdef->enumList.count(), cdef->enumList.count() ? index : 0);
int enumsIndex = index;
@ -888,12 +884,6 @@ void Generator::generateProperties()
if (p.user != "false")
flags |= User;
if (p.notifyId != -1)
flags |= Notify;
if (p.revision > 0)
flags |= Revisioned;
if (p.constant)
flags |= Constant;
if (p.final)
@ -906,32 +896,13 @@ void Generator::generateProperties()
fprintf(out, " %4d, ", stridx(p.name));
generateTypeInfo(p.type);
fprintf(out, ", 0x%.8x,\n", flags);
}
if(cdef->notifyableProperties) {
fprintf(out, "\n // properties: notify_signal_id\n");
for (int i = 0; i < cdef->propertyList.count(); ++i) {
const PropertyDef &p = cdef->propertyList.at(i);
if (p.notifyId == -1) {
fprintf(out, " %4d,\n",
0);
} else if (p.notifyId > -1) {
fprintf(out, " %4d,\n",
p.notifyId);
} else {
const int indexInStrings = strings.indexOf(p.notify);
fprintf(out, " %4d,\n",
indexInStrings | IsUnresolvedSignal);
}
}
}
if (cdef->revisionedProperties) {
fprintf(out, "\n // properties: revision\n");
for (int i = 0; i < cdef->propertyList.count(); ++i) {
const PropertyDef &p = cdef->propertyList.at(i);
fprintf(out, " %4d,\n", p.revision);
int notifyId = p.notifyId;
if (p.notifyId < -1) {
// signal is in parent class
const int indexInStrings = strings.indexOf(p.notify);
notifyId = indexInStrings | IsUnresolvedSignal;
}
fprintf(out, ", 0x%.8x, uint(%d), %d,\n", flags, notifyId, p.revision);
}
}

View File

@ -1415,10 +1415,6 @@ void Moc::parseProperty(ClassDef *def)
createPropertyDef(propDef);
next(RPAREN);
if(!propDef.notify.isEmpty())
def->notifyableProperties++;
if (propDef.revision > 0)
++def->revisionedProperties;
def->propertyList += propDef;
}
@ -1512,11 +1508,6 @@ void Moc::parsePrivateProperty(ClassDef *def)
createPropertyDef(propDef);
if(!propDef.notify.isEmpty())
def->notifyableProperties++;
if (propDef.revision > 0)
++def->revisionedProperties;
def->propertyList += propDef;
}
@ -1550,9 +1541,6 @@ void Moc::parsePrivateQProperty(ClassDef *def)
next(RPAREN);
if (!propDef.notify.isEmpty())
def->notifyableProperties++;
def->propertyList += propDef;
}

View File

@ -201,9 +201,7 @@ struct ClassDef : BaseDef {
QVector<PropertyDef> propertyList;
QVector<PrivateQPropertyDef> privateQProperties;
QSet<QByteArray> qPropertyMembers;
int notifyableProperties = 0;
int revisionedMethods = 0;
int revisionedProperties = 0;
bool hasQObject = false;
bool hasQGadget = false;

View File

@ -30,6 +30,6 @@
#define OUTPUTREVISION_H
// if the output revision changes, you MUST change it in qobjectdefs.h too
enum { mocOutputRevision = 67 }; // moc format output revision
enum { mocOutputRevision = 68 }; // moc format output revision
#endif // OUTPUTREVISION_H

View File

@ -21,7 +21,7 @@
}
],
"inputFile": "backslash-newlines.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -38,7 +38,7 @@
}
],
"inputFile": "c-comments.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -69,7 +69,7 @@
}
],
"inputFile": "cstyle-enums.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -235,7 +235,7 @@
}
],
"inputFile": "cxx11-enums.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -538,7 +538,7 @@
}
],
"inputFile": "cxx11-explicit-override-control.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -643,7 +643,7 @@
}
],
"inputFile": "cxx11-final-classes.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -679,7 +679,7 @@
}
],
"inputFile": "cxx17-namespaces.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -708,7 +708,7 @@
}
],
"inputFile": "dir-in-include-path.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -725,7 +725,7 @@
}
],
"inputFile": "enum_with_include.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -756,7 +756,7 @@
}
],
"inputFile": "escapes-in-string-literals.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -957,7 +957,7 @@
}
],
"inputFile": "forward-declared-param.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -986,7 +986,7 @@
}
],
"inputFile": "function-with-attributes.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1018,7 +1018,7 @@
}
],
"inputFile": "gadgetwithnoenums.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1051,7 +1051,7 @@
}
],
"inputFile": "grand-parent-gadget-class.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1117,7 +1117,7 @@
}
],
"inputFile": "moc_include.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1180,7 +1180,7 @@
}
],
"inputFile": "namespace.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1266,7 +1266,7 @@
}
],
"inputFile": "namespaced-flags.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1297,7 +1297,7 @@
}
],
"inputFile": "no-keywords.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1314,7 +1314,7 @@
}
],
"inputFile": "non-gadget-parent-class.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1373,7 +1373,7 @@
}
],
"inputFile": "oldstyle-casts.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1573,7 +1573,7 @@
}
],
"inputFile": "parse-defines.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1590,7 +1590,7 @@
}
],
"inputFile": "plugin_metadata.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1607,7 +1607,7 @@
}
],
"inputFile": "pointery_to_incomplete.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1676,7 +1676,7 @@
}
],
"inputFile": "pure-virtual-signals.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1723,7 +1723,7 @@
}
],
"inputFile": "qinvokable.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1754,7 +1754,7 @@
}
],
"inputFile": "qprivateslots.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1775,7 +1775,7 @@
}
],
"inputFile": "qtbug-35657-gadget.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1807,7 +1807,7 @@
}
],
"inputFile": "related-metaobjects-in-gadget.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -1860,7 +1860,7 @@
}
],
"inputFile": "related-metaobjects-in-namespaces.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2300,7 +2300,7 @@
}
],
"inputFile": "related-metaobjects-name-conflict.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2327,7 +2327,7 @@
}
],
"inputFile": "single-quote-digit-separator-n3781.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2408,7 +2408,7 @@
}
],
"inputFile": "single_function_keyword.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2474,7 +2474,7 @@
}
],
"inputFile": "slots-with-void-template.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2491,7 +2491,7 @@
}
],
"inputFile": "task192552.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2519,7 +2519,7 @@
}
],
"inputFile": "task234909.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2669,7 +2669,7 @@
}
],
"inputFile": "task240368.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2686,7 +2686,7 @@
}
],
"inputFile": "task87883.h",
"outputRevision": 67
"outputRevision": 68
},
{
"classes": [
@ -2759,6 +2759,6 @@
}
],
"inputFile": "trigraphs.h",
"outputRevision": 67
"outputRevision": 68
}
]