Rename QMetaTypeSwitcher::UnknownType to NotBuiltinType.
UnknownType suggest that a type is unknown to QMetaType, but QMetaTypeSwitcher is not checking for custom types. Change-Id: I6b8b692e0f20bed286c713672b35fb15757d389e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
729a73dfad
commit
60c6ed0e04
@ -1318,7 +1318,7 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void delegate(const T *where) { DestroyerImpl<T>::Destroy(m_type, const_cast<T*>(where)); }
|
void delegate(const T *where) { DestroyerImpl<T>::Destroy(m_type, const_cast<T*>(where)); }
|
||||||
void delegate(const void *) {}
|
void delegate(const void *) {}
|
||||||
void delegate(const QMetaTypeSwitcher::UnknownType *where) { customTypeDestroyer(m_type, (void*)where); }
|
void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestroyer(m_type, (void*)where); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void customTypeDestroyer(const int type, void *where)
|
static void customTypeDestroyer(const int type, void *where)
|
||||||
@ -1380,7 +1380,7 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void *delegate(const T *copy) { return ConstructorImpl<T>::Construct(m_type, m_where, copy); }
|
void *delegate(const T *copy) { return ConstructorImpl<T>::Construct(m_type, m_where, copy); }
|
||||||
void *delegate(const void *) { return m_where; }
|
void *delegate(const void *) { return m_where; }
|
||||||
void *delegate(const QMetaTypeSwitcher::UnknownType *copy) { return customTypeConstructor(m_type, m_where, copy); }
|
void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) { return customTypeConstructor(m_type, m_where, copy); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void *customTypeConstructor(const int type, void *where, const void *copy)
|
static void *customTypeConstructor(const int type, void *where, const void *copy)
|
||||||
@ -1468,7 +1468,7 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); }
|
void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); }
|
||||||
void delegate(const void *) {}
|
void delegate(const void *) {}
|
||||||
void delegate(const QMetaTypeSwitcher::UnknownType *where) { customTypeDestructor(m_type, (void*)where); }
|
void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void customTypeDestructor(const int type, void *where)
|
static void customTypeDestructor(const int type, void *where)
|
||||||
@ -1536,7 +1536,7 @@ public:
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); }
|
int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); }
|
||||||
int delegate(const QMetaTypeSwitcher::UnknownType*) { return customTypeSizeOf(m_type); }
|
int delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeSizeOf(m_type); }
|
||||||
private:
|
private:
|
||||||
static int customTypeSizeOf(const int type)
|
static int customTypeSizeOf(const int type)
|
||||||
{
|
{
|
||||||
@ -1606,7 +1606,7 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); }
|
quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); }
|
||||||
quint32 delegate(const void*) { return 0; }
|
quint32 delegate(const void*) { return 0; }
|
||||||
quint32 delegate(const QMetaTypeSwitcher::UnknownType*) { return customTypeFlags(m_type); }
|
quint32 delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeFlags(m_type); }
|
||||||
private:
|
private:
|
||||||
const int m_type;
|
const int m_type;
|
||||||
static quint32 customTypeFlags(const int type)
|
static quint32 customTypeFlags(const int type)
|
||||||
@ -1793,7 +1793,7 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void delegate(const T*) { TypeInfoImpl<T>(m_type, info); }
|
void delegate(const T*) { TypeInfoImpl<T>(m_type, info); }
|
||||||
void delegate(const void*) {}
|
void delegate(const void*) {}
|
||||||
void delegate(const QMetaTypeSwitcher::UnknownType*) { customTypeInfo(m_type); }
|
void delegate(const QMetaTypeSwitcher::NotBuiltinType*) { customTypeInfo(m_type); }
|
||||||
private:
|
private:
|
||||||
void customTypeInfo(const uint type)
|
void customTypeInfo(const uint type)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QMetaTypeSwitcher {
|
class QMetaTypeSwitcher {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef void *UnknownType;
|
typedef void *NotBuiltinType;
|
||||||
template<class ReturnType, class DelegateObject>
|
template<class ReturnType, class DelegateObject>
|
||||||
static ReturnType switcher(DelegateObject &logic, int type, const void *data);
|
static ReturnType switcher(DelegateObject &logic, int type, const void *data);
|
||||||
};
|
};
|
||||||
@ -91,7 +91,7 @@ ReturnType QMetaTypeSwitcher::switcher(DelegateObject &logic, int type, const vo
|
|||||||
QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS)
|
QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return logic.delegate(static_cast<const UnknownType *>(data));
|
return logic.delegate(static_cast<const NotBuiltinType *>(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ public:
|
|||||||
FilteredConstructor<T>(*this);
|
FilteredConstructor<T>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delegate(const QMetaTypeSwitcher::UnknownType*)
|
void delegate(const QMetaTypeSwitcher::NotBuiltinType*)
|
||||||
{
|
{
|
||||||
qWarning("Trying to construct an instance of an invalid type, type id: %i", m_x->type);
|
qWarning("Trying to construct an instance of an invalid type, type id: %i", m_x->type);
|
||||||
m_x->type = QVariant::Invalid;
|
m_x->type = QVariant::Invalid;
|
||||||
@ -395,7 +395,7 @@ public:
|
|||||||
FilteredDestructor<T> cleaner(m_d);
|
FilteredDestructor<T> cleaner(m_d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delegate(const QMetaTypeSwitcher::UnknownType*)
|
void delegate(const QMetaTypeSwitcher::NotBuiltinType*)
|
||||||
{
|
{
|
||||||
qWarning("Trying to destruct an instance of an invalid type, type id: %i", m_d->type);
|
qWarning("Trying to destruct an instance of an invalid type, type id: %i", m_d->type);
|
||||||
}
|
}
|
||||||
@ -441,7 +441,7 @@ public:
|
|||||||
Filtered<T> streamIt(m_debugStream, m_d);
|
Filtered<T> streamIt(m_debugStream, m_d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delegate(const QMetaTypeSwitcher::UnknownType*)
|
void delegate(const QMetaTypeSwitcher::NotBuiltinType*)
|
||||||
{
|
{
|
||||||
qWarning("Trying to stream an instance of an invalid type, type id: %i", m_d->type);
|
qWarning("Trying to stream an instance of an invalid type, type id: %i", m_d->type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user