Move isBuiltinType() to namespace QtPrivate and export it.

There is currently a symbol clash with a duplicated
isBuiltinType() in ActiveQt's dumpcpp-tool, which breaks static
building. Reuse the function.

Task-number: QTBUG-28131
Change-Id: I4985e8405924754aa613311ca3f06d6ba29758b8
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This commit is contained in:
Friedemann Kleint 2012-11-26 10:57:14 +01:00 committed by The Qt Project
parent c8c8e1990c
commit 141d718ce2
2 changed files with 9 additions and 5 deletions

View File

@ -79,13 +79,15 @@ QT_BEGIN_NAMESPACE
*/
// copied from moc's generator.cpp
bool isBuiltinType(const QByteArray &type)
namespace QtPrivate {
Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type)
{
int id = QMetaType::type(type);
if (!id && !type.isEmpty() && type != "void")
return false;
return (id < QMetaType::User);
}
} // namespace QtPrivate
// copied from qmetaobject.cpp
static inline const QMetaObjectPrivate *priv(const uint* data)
@ -1324,7 +1326,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
for (int i = -1; i < paramCount; ++i) {
const QByteArray &typeName = (i < 0) ? method->returnType : paramTypeNames.at(i);
int typeInfo;
if (isBuiltinType(typeName))
if (QtPrivate::isBuiltinType(typeName))
typeInfo = QMetaType::type(typeName);
else
typeInfo = IsUnresolvedType | strings.enter(typeName);
@ -1352,14 +1354,14 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
int name = strings.enter(prop->name);
int typeInfo;
if (isBuiltinType(prop->type))
if (QtPrivate::isBuiltinType(prop->type))
typeInfo = QMetaType::type(prop->type);
else
typeInfo = IsUnresolvedType | strings.enter(prop->type);
int flags = prop->flags;
if (!isBuiltinType(prop->type))
if (!QtPrivate::isBuiltinType(prop->type))
flags |= EnumOrFlag;
if (buf) {

View File

@ -509,7 +509,9 @@ namespace QtPrivate
{
enum { Value = true };
};
}
Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type);
} // namespace QtPrivate
template <typename T, bool = QtPrivate::IsPointerToTypeDerivedFromQObject<T>::Value>
struct QMetaTypeIdQObject