QDBusArgumentPrivate: Use type-safe enum for flags
Declare flags as QDBusConnection::ConnectionCapabilities instead of bare int. Do the same for derived classes QDBusMarshaller and QDBusDemarshaller. Make the constructors explicit, replacing useless `inline` where it was used. Make flags argument default to empty flags. Change-Id: I6caedde06b2ef41d725f15348ee780d1cc20b355 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
e4eabbf3e4
commit
946992b9b0
|
|
@ -37,7 +37,7 @@ QByteArray QDBusArgumentPrivate::createSignature(QMetaType type)
|
|||
return "";
|
||||
|
||||
QByteArray signature;
|
||||
QDBusMarshaller *marshaller = new QDBusMarshaller(0);
|
||||
QDBusMarshaller *marshaller = new QDBusMarshaller;
|
||||
marshaller->ba = &signature;
|
||||
|
||||
// run it
|
||||
|
|
@ -260,7 +260,7 @@ QDBusArgument::QDBusArgument()
|
|||
return;
|
||||
}
|
||||
|
||||
QDBusMarshaller *dd = new QDBusMarshaller(0);
|
||||
QDBusMarshaller *dd = new QDBusMarshaller;
|
||||
d = dd;
|
||||
|
||||
// create a new message with any type, we won't sent it anyways
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <QtDBus/private/qtdbusglobal_p.h>
|
||||
#include <qdbusargument.h>
|
||||
#include "qdbusconnection.h"
|
||||
#include "qdbusunixfiledescriptor.h"
|
||||
#include "qdbus_symbols_p.h"
|
||||
|
||||
|
|
@ -34,7 +35,10 @@ class QDBusDemarshaller;
|
|||
class QDBusArgumentPrivate
|
||||
{
|
||||
public:
|
||||
inline QDBusArgumentPrivate(int flags = 0) : capabilities(flags) { }
|
||||
explicit QDBusArgumentPrivate(QDBusConnection::ConnectionCapabilities flags = {})
|
||||
: capabilities(flags)
|
||||
{
|
||||
}
|
||||
virtual ~QDBusArgumentPrivate();
|
||||
|
||||
static bool checkRead(QDBusArgumentPrivate *d);
|
||||
|
|
@ -55,7 +59,7 @@ public:
|
|||
|
||||
DBusMessage *message = nullptr;
|
||||
QAtomicInt ref = 1;
|
||||
int capabilities;
|
||||
QDBusConnection::ConnectionCapabilities capabilities;
|
||||
enum Direction {
|
||||
Marshalling,
|
||||
Demarshalling
|
||||
|
|
@ -65,7 +69,11 @@ public:
|
|||
class QDBusMarshaller: public QDBusArgumentPrivate
|
||||
{
|
||||
public:
|
||||
QDBusMarshaller(int flags) : QDBusArgumentPrivate(flags) { direction = Marshalling; }
|
||||
explicit QDBusMarshaller(QDBusConnection::ConnectionCapabilities flags = {})
|
||||
: QDBusArgumentPrivate(flags)
|
||||
{
|
||||
direction = Marshalling;
|
||||
}
|
||||
~QDBusMarshaller();
|
||||
|
||||
QString currentSignature();
|
||||
|
|
@ -121,7 +129,11 @@ private:
|
|||
class QDBusDemarshaller: public QDBusArgumentPrivate
|
||||
{
|
||||
public:
|
||||
inline QDBusDemarshaller(int flags) : QDBusArgumentPrivate(flags) { direction = Demarshalling; }
|
||||
explicit QDBusDemarshaller(QDBusConnection::ConnectionCapabilities flags = {})
|
||||
: QDBusArgumentPrivate(flags)
|
||||
{
|
||||
direction = Demarshalling;
|
||||
}
|
||||
~QDBusDemarshaller();
|
||||
|
||||
QString currentSignature();
|
||||
|
|
|
|||
Loading…
Reference in New Issue