Make some DBus classes bootstrapping-ready.

Change-Id: Ib7611fb0bf8e226a36064a100280e1ab7a0e159d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Stephen Kelly 2012-03-08 18:49:51 +01:00 committed by Qt by Nokia
parent b05139b2dc
commit ded80cfc8a
6 changed files with 55 additions and 3 deletions

View File

@ -88,6 +88,8 @@ class QDBusAbstractInterface;
class QDBusConnectionInterface;
class QDBusPendingCallPrivate;
#ifndef QT_BOOTSTRAPPED
class QDBusErrorInternal
{
mutable DBusError error;
@ -336,7 +338,10 @@ public:
// in qdbusmisc.cpp
extern int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes);
#endif // QT_BOOTSTRAPPED
extern int qDBusParametersForMethod(const QList<QByteArray> &parameters, QList<int>& metaTypes);
extern bool qDBusCheckAsyncTag(const char *tag);
#ifndef QT_BOOTSTRAPPED
extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
@ -348,6 +353,7 @@ extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNod
const QDBusMessage &msg);
extern QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg);
#endif // QT_BOOTSTRAPPED
QT_END_NAMESPACE

View File

@ -44,9 +44,11 @@
#include <qdebug.h>
#include <qvarlengtharray.h>
#ifndef QT_BOOTSTRAPPED
#include "qdbus_symbols_p.h"
#include "qdbusmessage.h"
#include "qdbusmessage_p.h"
#endif
#ifndef QT_NO_DBUS
@ -239,6 +241,7 @@ static inline QDBusError::ErrorType get(const char *name)
\value UnknownObject The remote object could not be found.
*/
#ifndef QT_BOOTSTRAPPED
/*!
\internal
Constructs a QDBusError from a DBusError structure.
@ -268,6 +271,7 @@ QDBusError::QDBusError(const QDBusMessage &qdmsg)
nm = qdmsg.errorName();
msg = qdmsg.errorMessage();
}
#endif
/*!
\internal
@ -302,6 +306,7 @@ QDBusError &QDBusError::operator=(const QDBusError &other)
return *this;
}
#ifndef QT_BOOTSTRAPPED
/*!
\internal
Assignment operator from a QDBusMessage
@ -319,6 +324,7 @@ QDBusError &QDBusError::operator=(const QDBusMessage &qdmsg)
}
return *this;
}
#endif
/*!
Returns this error's ErrorType.

View File

@ -93,12 +93,16 @@ public:
#endif
};
#ifndef QT_BOOTSTRAPPED
explicit QDBusError(const DBusError *error = 0);
/*implicit*/ QDBusError(const QDBusMessage& msg);
#endif
QDBusError(ErrorType error, const QString &message);
QDBusError(const QDBusError &other);
QDBusError &operator=(const QDBusError &other);
#ifndef QT_BOOTSTRAPPED
QDBusError &operator=(const QDBusMessage &msg);
#endif
ErrorType type() const;
QString name() const;

View File

@ -49,11 +49,13 @@
#include <qreadwritelock.h>
#include <qvector.h>
#include "qdbusmetatype_p.h"
#ifndef QT_BOOTSTRAPPED
#include "qdbusmessage.h"
#include "qdbusunixfiledescriptor.h"
#include "qdbusutil_p.h"
#include "qdbusmetatype_p.h"
#include "qdbusargument_p.h"
#endif
#ifndef QT_NO_DBUS
@ -73,6 +75,20 @@ Q_DECLARE_METATYPE(QList<double>)
QT_BEGIN_NAMESPACE
#ifdef QT_BOOTSTRAPPED
int QDBusMetaTypeId::message = QMetaType::User + 1;
int QDBusMetaTypeId::argument = QMetaType::User + 2;
int QDBusMetaTypeId::variant = QMetaType::User + 3;
int QDBusMetaTypeId::objectpath = QMetaType::User + 4;
int QDBusMetaTypeId::signature = QMetaType::User + 5;
int QDBusMetaTypeId::error = QMetaType::User + 6;
int QDBusMetaTypeId::unixfd = QMetaType::User + 7;
void QDBusMetaTypeId::init()
{
}
#else
class QDBusCustomTypeInfo
{
public:
@ -295,6 +311,7 @@ bool QDBusMetaType::demarshall(const QDBusArgument &arg, int id, void *data)
df(copy, data);
return true;
}
#endif
/*!
\fn QDBusMetaType::signatureToType(const char *signature)
@ -447,6 +464,7 @@ const char *QDBusMetaType::typeToSignature(int type)
else if (type == QDBusMetaTypeId::unixfd)
return DBUS_TYPE_UNIX_FD_AS_STRING;
#ifndef QT_BOOTSTRAPPED
// try the database
QVector<QDBusCustomTypeInfo> *ct = customTypes();
{
@ -476,6 +494,9 @@ const char *QDBusMetaType::typeToSignature(int type)
info->signature = signature;
}
return info->signature;
#else
return 0;
#endif
}
QT_END_NAMESPACE

View File

@ -41,14 +41,16 @@
#include <string.h>
#ifndef QT_BOOTSTRAPPED
#include <QtCore/qcoreapplication.h>
#include <QtCore/qvariant.h>
#include <QtCore/qmetaobject.h>
#include "qdbusutil_p.h"
#include "qdbusconnection_p.h"
#include "qdbusmetatype_p.h"
#include "qdbusabstractadaptor_p.h" // for QCLASSINFO_DBUS_*
#endif
#include "qdbusmetatype_p.h"
#ifndef QT_NO_DBUS
@ -69,6 +71,8 @@ bool qDBusCheckAsyncTag(const char *tag)
return false;
}
#ifndef QT_BOOTSTRAPPED
QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
{
QString interface;
@ -129,8 +133,13 @@ bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name)
int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
{
QDBusMetaTypeId::init();
return qDBusParametersForMethod(mm.parameterTypes(), metaTypes);
}
QList<QByteArray> parameterTypes = mm.parameterTypes();
#endif // QT_BOOTSTRAPPED
int qDBusParametersForMethod(const QList<QByteArray> &parameterTypes, QList<int>& metaTypes)
{
metaTypes.clear();
metaTypes.append(0); // return type

View File

@ -76,6 +76,7 @@ static inline bool isValidNumber(QChar c)
return (u >= '0' && u <= '9');
}
#ifndef QT_BOOTSTRAPPED
static bool argToString(const QDBusArgument &arg, QString &out);
static bool variantToString(const QVariant &arg, QString &out)
@ -237,6 +238,7 @@ bool argToString(const QDBusArgument &busArg, QString &out)
return true;
}
#endif
//------- D-Bus Types --------
static const char oneLetterTypes[] = "vsogybnqiuxtdh";
@ -319,7 +321,11 @@ namespace QDBusUtil
{
QString out;
#ifndef QT_BOOTSTRAPPED
variantToString(arg, out);
#else
Q_UNUSED(arg);
#endif
return out;
}