summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-04-30 11:50:57 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-06-11 19:39:55 +0200
commitf5e8f9c814f0a0383192a5cb2ec5e6da8b3b8061 (patch)
tree9faac67e58b0047944d50abd62cea9f52d6dfee0 /src/corelib/kernel
parent630c7b481184b5e0dd2e87b967fed421d574ee02 (diff)
Cleanup QMetaClassInfo
Change-Id: I0b4fa4568f8479106053e0fae72fc802fca74a65 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp6
-rw-r--r--src/corelib/kernel/qmetaobject.h13
2 files changed, 14 insertions, 5 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 304bfc522f..3b401bb163 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1163,7 +1163,7 @@ QMetaClassInfo QMetaObject::classInfo(int index) const
QMetaClassInfo result;
if (i >= 0 && i < priv(d.data)->classInfoCount) {
result.mobj = this;
- result.handle = priv(d.data)->classInfoData + 2*i;
+ result.data = { d.data + priv(d.data)->classInfoData + i * QMetaClassInfo::Data::Size };
}
return result;
}
@@ -3554,7 +3554,7 @@ const char *QMetaClassInfo::name() const
{
if (!mobj)
return nullptr;
- return rawStringData(mobj, mobj->d.data[handle]);
+ return rawStringData(mobj, data.name());
}
/*!
@@ -3566,7 +3566,7 @@ const char* QMetaClassInfo::value() const
{
if (!mobj)
return nullptr;
- return rawStringData(mobj, mobj->d.data[handle + 1]);
+ return rawStringData(mobj, data.value());
}
/*!
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 0dcc74e120..ed65f8733f 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -351,13 +351,22 @@ private:
class Q_CORE_EXPORT QMetaClassInfo
{
public:
- Q_DECL_CONSTEXPR inline QMetaClassInfo() : mobj(nullptr), handle(0) {}
+ Q_DECL_CONSTEXPR inline QMetaClassInfo() : mobj(nullptr), data({ nullptr }) {}
const char *name() const;
const char *value() const;
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
private:
+ struct Data {
+ enum { Size = 2 };
+
+ uint name() const { return d[0]; }
+ uint value() const { return d[1]; }
+
+ const uint *d;
+ };
+
const QMetaObject *mobj;
- uint handle;
+ Data data;
friend struct QMetaObject;
};
Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE);