QDBus: Use type-safe object tree node flags
Change-Id: I7078b11d19d7a6444a020e0d400efbaea22f84a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
588700dbfa
commit
dad421222c
@ -115,9 +115,11 @@ public:
|
||||
{
|
||||
typedef QList<ObjectTreeNode> DataList;
|
||||
|
||||
inline ObjectTreeNode() : obj(nullptr), flags(0) { }
|
||||
inline ObjectTreeNode() : obj(nullptr) { }
|
||||
inline ObjectTreeNode(const QString &n) // intentionally implicit
|
||||
: name(n), obj(nullptr), flags(0) { }
|
||||
: name(n), obj(nullptr)
|
||||
{
|
||||
}
|
||||
inline bool operator<(const QString &other) const
|
||||
{ return name < other; }
|
||||
inline bool operator<(QStringView other) const
|
||||
@ -131,7 +133,7 @@ public:
|
||||
QObject *obj;
|
||||
QDBusVirtualObject *treeNode;
|
||||
};
|
||||
int flags;
|
||||
QDBusConnection::RegisterOptions flags;
|
||||
|
||||
DataList children;
|
||||
};
|
||||
@ -223,7 +225,8 @@ private:
|
||||
void activateSignal(const SignalHook& hook, const QDBusMessage &msg);
|
||||
void activateObject(ObjectTreeNode &node, const QDBusMessage &msg, int pathStartPos);
|
||||
bool activateInternalFilters(const ObjectTreeNode &node, const QDBusMessage &msg);
|
||||
bool activateCall(QObject *object, int flags, const QDBusMessage &msg);
|
||||
bool activateCall(QObject *object, QDBusConnection::RegisterOptions flags,
|
||||
const QDBusMessage &msg);
|
||||
|
||||
void sendInternal(QDBusPendingCallPrivate *pcall, void *msg, int timeout);
|
||||
void sendError(const QDBusMessage &msg, QDBusError::ErrorType code);
|
||||
|
@ -590,7 +590,7 @@ static void huntAndDestroy(QObject *needle, QDBusConnectionPrivate::ObjectTreeNo
|
||||
|
||||
if (needle == haystack.obj) {
|
||||
haystack.obj = nullptr;
|
||||
haystack.flags = 0;
|
||||
haystack.flags = {};
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,7 +601,7 @@ static void huntAndUnregister(const QList<QStringView> &pathComponents, int i,
|
||||
if (pathComponents.size() == i) {
|
||||
// found it
|
||||
node->obj = nullptr;
|
||||
node->flags = 0;
|
||||
node->flags = {};
|
||||
|
||||
if (mode == QDBusConnection::UnregisterTree) {
|
||||
// clear the sub-tree as well
|
||||
@ -817,7 +817,8 @@ void QDBusConnectionPrivate::activateSignal(const QDBusConnectionPrivate::Signal
|
||||
postEventToThread(ActivateSignalAction, hook.obj, call);
|
||||
}
|
||||
|
||||
bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBusMessage &msg)
|
||||
bool QDBusConnectionPrivate::activateCall(QObject *object, QDBusConnection::RegisterOptions flags,
|
||||
const QDBusMessage &msg)
|
||||
{
|
||||
// This is called by QDBusConnectionPrivate::handleObjectCall to place a call
|
||||
// to a slot on the object.
|
||||
@ -1042,7 +1043,7 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
|
||||
connect(this, &QDBusConnectionPrivate::messageNeedsSending,
|
||||
this, &QDBusConnectionPrivate::sendInternal);
|
||||
|
||||
rootNode.flags = 0;
|
||||
rootNode.flags = {};
|
||||
|
||||
// prepopulate watchedServices:
|
||||
// we know that the owner of org.freedesktop.DBus is itself
|
||||
@ -1453,7 +1454,7 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
|
||||
QDBusAdaptorConnector *connector;
|
||||
if (node.flags & QDBusConnection::ExportAdaptors &&
|
||||
(connector = qDBusFindAdaptorConnector(node.obj))) {
|
||||
int newflags = node.flags | QDBusConnection::ExportAllSlots;
|
||||
auto newflags = node.flags | QDBusConnection::ExportAllSlots;
|
||||
|
||||
if (msg.interface().isEmpty()) {
|
||||
// place the call in all interfaces
|
||||
|
@ -59,7 +59,7 @@ struct QDBusSlotCache
|
||||
struct Key
|
||||
{
|
||||
QString memberWithSignature;
|
||||
int flags;
|
||||
QDBusConnection::RegisterOptions flags;
|
||||
|
||||
friend bool operator==(const Key &lhs, const Key &rhs) noexcept
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user