summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusargument_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus/qdbusargument_p.h')
-rw-r--r--src/dbus/qdbusargument_p.h103
1 files changed, 37 insertions, 66 deletions
diff --git a/src/dbus/qdbusargument_p.h b/src/dbus/qdbusargument_p.h
index 3553d3d151..d9a7382742 100644
--- a/src/dbus/qdbusargument_p.h
+++ b/src/dbus/qdbusargument_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtDBus module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDBUSARGUMENT_P_H
#define QDBUSARGUMENT_P_H
@@ -53,6 +17,7 @@
#include <QtDBus/private/qtdbusglobal_p.h>
#include <qdbusargument.h>
+#include "qdbusconnection.h"
#include "qdbusunixfiledescriptor.h"
#include "qdbus_symbols_p.h"
@@ -69,10 +34,10 @@ class QDBusMarshaller;
class QDBusDemarshaller;
class QDBusArgumentPrivate
{
+ Q_DISABLE_COPY_MOVE(QDBusArgumentPrivate)
public:
- inline QDBusArgumentPrivate(int flags = 0)
- : message(nullptr), ref(1), capabilities(flags)
- { }
+ enum class Direction { Marshalling, Demarshalling };
+
virtual ~QDBusArgumentPrivate();
static bool checkRead(QDBusArgumentPrivate *d);
@@ -82,7 +47,7 @@ public:
QDBusMarshaller *marshaller();
QDBusDemarshaller *demarshaller();
- static QByteArray createSignature(int id);
+ static QByteArray createSignature(QMetaType type);
static inline QDBusArgument create(QDBusArgumentPrivate *d)
{
QDBusArgument q(d);
@@ -91,21 +56,26 @@ public:
static inline QDBusArgumentPrivate *d(QDBusArgument &q)
{ return q.d; }
-public:
- DBusMessage *message;
- QAtomicInt ref;
- int capabilities;
- enum Direction {
- Marshalling,
- Demarshalling
- } direction;
+ DBusMessage *message = nullptr;
+ QAtomicInt ref = 1;
+ QDBusConnection::ConnectionCapabilities capabilities;
+ Direction direction;
+
+protected:
+ explicit QDBusArgumentPrivate(Direction direction,
+ QDBusConnection::ConnectionCapabilities flags = {})
+ : capabilities(flags), direction(direction)
+ {
+ }
};
-class QDBusMarshaller: public QDBusArgumentPrivate
+class QDBusMarshaller final : public QDBusArgumentPrivate
{
public:
- QDBusMarshaller(int flags) : QDBusArgumentPrivate(flags), parent(nullptr), ba(nullptr), closeCode(0), ok(true), skipSignature(false)
- { direction = Marshalling; }
+ explicit QDBusMarshaller(QDBusConnection::ConnectionCapabilities flags = {})
+ : QDBusArgumentPrivate(Direction::Marshalling, flags)
+ {
+ }
~QDBusMarshaller();
QString currentSignature();
@@ -129,9 +99,9 @@ public:
QDBusMarshaller *beginStructure();
QDBusMarshaller *endStructure();
- QDBusMarshaller *beginArray(int id);
+ QDBusMarshaller *beginArray(QMetaType id);
QDBusMarshaller *endArray();
- QDBusMarshaller *beginMap(int kid, int vid);
+ QDBusMarshaller *beginMap(QMetaType kid, QMetaType vid);
QDBusMarshaller *endMap();
QDBusMarshaller *beginMapEntry();
QDBusMarshaller *endMapEntry();
@@ -145,24 +115,26 @@ public:
bool appendRegisteredType(const QVariant &arg);
bool appendCrossMarshalling(QDBusDemarshaller *arg);
-public:
DBusMessageIter iterator;
- QDBusMarshaller *parent;
- QByteArray *ba;
+ QDBusMarshaller *parent = nullptr;
+ QByteArray *ba = nullptr;
QString errorString;
- char closeCode;
- bool ok;
- bool skipSignature;
+ char closeCode = 0;
+ bool ok = true;
+ bool skipSignature = false;
private:
+ Q_DECL_COLD_FUNCTION void unregisteredTypeError(QMetaType t);
Q_DISABLE_COPY_MOVE(QDBusMarshaller)
};
-class QDBusDemarshaller: public QDBusArgumentPrivate
+class QDBusDemarshaller final : public QDBusArgumentPrivate
{
public:
- inline QDBusDemarshaller(int flags) : QDBusArgumentPrivate(flags), parent(nullptr)
- { direction = Demarshalling; }
+ explicit QDBusDemarshaller(QDBusConnection::ConnectionCapabilities flags = {})
+ : QDBusArgumentPrivate(Direction::Demarshalling, flags)
+ {
+ }
~QDBusDemarshaller();
QString currentSignature();
@@ -203,9 +175,8 @@ public:
QDBusArgument::ElementType currentType();
bool isCurrentTypeStringLike();
-public:
DBusMessageIter iterator;
- QDBusDemarshaller *parent;
+ QDBusDemarshaller *parent = nullptr;
private:
Q_DISABLE_COPY_MOVE(QDBusDemarshaller)