The function is redundant and can be replaced by QMetaType::type().
Change-Id: I131a7fd285a60d8bd0f3b958668a43bd5da2d6c4
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
// in qdbusmisc.cpp
extern int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes);
-extern int qDBusNameToTypeId(const char *name);
extern bool qDBusCheckAsyncTag(const char *tag);
extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
if (paren != name.length() || !slotname.startsWith(name))
continue;
- int returnType = qDBusNameToTypeId(mm.typeName());
+ int returnType = QMetaType::type(mm.typeName());
bool isAsync = qDBusCheckAsyncTag(mm.tag());
bool isScriptable = mm.attributes() & QMetaMethod::Scriptable;
// we found our property
// do we have the right type?
- int id = mp.type();
- if (id == QVariant::UserType) {
- // dynamic type
- id = qDBusNameToTypeId(mp.typeName());
- if (id == -1) {
- // type not registered?
- qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
- mp.typeName(), mo->className(), property_name.constData());
- return PropertyWriteFailed;
- }
+ int id = mp.userType();
+ if (!id){
+ // type not registered or invalid / void?
+ qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
+ mp.typeName(), mo->className(), property_name.constData());
+ return PropertyWriteFailed;
}
- if (id != 0xff && value.userType() == QDBusMetaTypeId::argument) {
+ if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument) {
// we have to demarshall before writing
void *null = 0;
QVariant other(id, null);
continue;
// is it a registered property?
- int typeId = qDBusNameToTypeId(mp.typeName());
+ int typeId = mp.userType();
if (!typeId)
continue;
const char *signature = QDBusMetaType::typeToSignature(typeId);
return false;
}
-int qDBusNameToTypeId(const char *name)
-{
- int id = static_cast<int>( QVariant::nameToType(name) );
- if (id == QVariant::UserType)
- id = QMetaType::type(name);
- return id;
-}
-
QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
{
QString interface;
QByteArray basictype = type;
basictype.truncate(type.length() - 1);
- int id = qDBusNameToTypeId(basictype);
+ int id = QMetaType::type(basictype);
if (id == 0) {
//qWarning("Could not parse the method '%s'", mm.signature());
// invalid type in method parameter list
return -1; // not allowed
}
- int id = qDBusNameToTypeId(type);
+ int id = QMetaType::type(type);
if (id == 0) {
//qWarning("Could not parse the method '%s'", mm.signature());
// invalid type in method parameter list
if (mp.isWritable())
access |= 2;
- int typeId = qDBusNameToTypeId(mp.typeName());
+ int typeId = mp.userType();
if (!typeId)
continue;
const char *signature = QDBusMetaType::typeToSignature(typeId);
.arg(QLatin1String(signature.left(paren)));
// check the return type first
- int typeId = qDBusNameToTypeId(mm.typeName());
+ int typeId = QMetaType::type(mm.typeName());
if (typeId) {
const char *typeName = QDBusMetaType::typeToSignature(typeId);
if (typeName) {