****************************************************************************/
#include "qdbusmetatype.h"
+#include "qdbusmetatype_p.h"
#include <string.h>
#include "qdbus_symbols_p.h"
#include <qreadwritelock.h>
#include <qvector.h>
-#include "qdbusmessage.h"
-#include "qdbusunixfiledescriptor.h"
-#include "qdbusutil_p.h"
-#include "qdbusmetatype_p.h"
#include "qdbusargument_p.h"
+#include "qdbusutil_p.h"
+#include "qdbusunixfiledescriptor.h"
+#ifndef QT_BOOTSTRAPPED
+#include "qdbusmessage.h"
+#endif
#ifndef QT_NO_DBUS
# define DBUS_TYPE_UNIX_FD_AS_STRING "h"
#endif
-Q_DECLARE_METATYPE(QList<bool>)
-Q_DECLARE_METATYPE(QList<short>)
-Q_DECLARE_METATYPE(QList<ushort>)
-Q_DECLARE_METATYPE(QList<int>)
-Q_DECLARE_METATYPE(QList<uint>)
-Q_DECLARE_METATYPE(QList<qlonglong>)
-Q_DECLARE_METATYPE(QList<qulonglong>)
-Q_DECLARE_METATYPE(QList<double>)
-
QT_BEGIN_NAMESPACE
class QDBusCustomTypeInfo
{
public:
- QDBusCustomTypeInfo() : signature(0, '\0'), marshall(0), demarshall(0)
+ QDBusCustomTypeInfo() : signature(), marshall(0), demarshall(0)
{ }
// Suggestion:
reinterpret_cast<QDBusMetaType::DemarshallFunction>(df));
}
-int QDBusMetaTypeId::message;
-int QDBusMetaTypeId::argument;
-int QDBusMetaTypeId::variant;
-int QDBusMetaTypeId::objectpath;
-int QDBusMetaTypeId::signature;
-int QDBusMetaTypeId::error;
-int QDBusMetaTypeId::unixfd;
-
void QDBusMetaTypeId::init()
{
static volatile bool initialized = false;
// reentrancy is not a problem since everything else is locked on their own
// set the guard variable at the end
if (!initialized) {
- // register our types with QtCore
- message = qRegisterMetaType<QDBusMessage>("QDBusMessage");
- argument = qRegisterMetaType<QDBusArgument>("QDBusArgument");
- variant = qRegisterMetaType<QDBusVariant>("QDBusVariant");
- objectpath = qRegisterMetaType<QDBusObjectPath>("QDBusObjectPath");
- signature = qRegisterMetaType<QDBusSignature>("QDBusSignature");
- error = qRegisterMetaType<QDBusError>("QDBusError");
- unixfd = qRegisterMetaType<QDBusUnixFileDescriptor>("QDBusUnixFileDescriptor");
+ // register our types with QtCore (calling qMetaTypeId<T>() does this implicitly)
+ (void)message();
+ (void)argument();
+ (void)variant();
+ (void)objectpath();
+ (void)signature();
+ (void)error();
+ (void)unixfd();
#ifndef QDBUS_NO_SPECIALTYPES
// and register QtCore's with us
/*!
\class QDBusMetaType
+ \inmodule QtDBus
\brief Meta-type registration system for the QtDBus module.
\internal
Q_DECLARE_METATYPE() macro, and then registered as in the
following example:
- \snippet doc/src/snippets/code/src_qdbus_qdbusmetatype.cpp 0
+ \snippet code/src_qdbus_qdbusmetatype.cpp 0
If \c{T} isn't a type derived from one of
Qt's \l{container classes}, the \c{operator<<} and
} else
df = info.demarshall;
}
-
+#ifndef QT_BOOTSTRAPPED
QDBusArgument copy = arg;
df(copy, data);
+#else
+ Q_UNUSED(arg);
+ Q_UNUSED(data);
+ Q_UNUSED(df);
+#endif
return true;
}
return QVariant::String;
case DBUS_TYPE_OBJECT_PATH:
- return QDBusMetaTypeId::objectpath;
+ return QDBusMetaTypeId::objectpath();
case DBUS_TYPE_SIGNATURE:
- return QDBusMetaTypeId::signature;
+ return QDBusMetaTypeId::signature();
case DBUS_TYPE_UNIX_FD:
- return QDBusMetaTypeId::unixfd;
+ return QDBusMetaTypeId::unixfd();
case DBUS_TYPE_VARIANT:
- return QDBusMetaTypeId::variant;
+ return QDBusMetaTypeId::variant();
case DBUS_TYPE_ARRAY: // special case
switch (signature[1]) {
}
QDBusMetaTypeId::init();
- if (type == QDBusMetaTypeId::variant)
+ if (type == QDBusMetaTypeId::variant())
return DBUS_TYPE_VARIANT_AS_STRING;
- else if (type == QDBusMetaTypeId::objectpath)
+ else if (type == QDBusMetaTypeId::objectpath())
return DBUS_TYPE_OBJECT_PATH_AS_STRING;
- else if (type == QDBusMetaTypeId::signature)
+ else if (type == QDBusMetaTypeId::signature())
return DBUS_TYPE_SIGNATURE_AS_STRING;
- else if (type == QDBusMetaTypeId::unixfd)
+ else if (type == QDBusMetaTypeId::unixfd())
return DBUS_TYPE_UNIX_FD_AS_STRING;
// try the database