Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdbusargument_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QDBUSARGUMENT_P_H
6#define QDBUSARGUMENT_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists for the convenience
13// of the QLibrary class. This header file may change from
14// version to version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtDBus/private/qtdbusglobal_p.h>
20#include <qdbusargument.h>
24
25#ifndef QT_NO_DBUS
26
28# define DBUS_TYPE_UNIX_FD int('h')
29# define DBUS_TYPE_UNIX_FD_AS_STRING "h"
30#endif
31
33
34class QDBusMarshaller;
37{
39public:
41
42 virtual ~QDBusArgumentPrivate();
43
44 static bool checkRead(QDBusArgumentPrivate *d);
46 static bool checkWrite(QDBusArgumentPrivate *&d);
47
48 QDBusMarshaller *marshaller();
50
51 static QByteArray createSignature(QMetaType type);
53 {
54 QDBusArgument q(d);
55 return q;
56 }
57 static inline QDBusArgumentPrivate *d(QDBusArgument &q)
58 { return q.d; }
59
60 DBusMessage *message = nullptr;
64
65protected:
66 explicit QDBusArgumentPrivate(Direction direction,
67 QDBusConnection::ConnectionCapabilities flags = {})
69 {
70 }
71};
72
73class QDBusMarshaller final : public QDBusArgumentPrivate
74{
75public:
81
83
84 void append(uchar arg);
85 void append(bool arg);
86 void append(short arg);
87 void append(ushort arg);
88 void append(int arg);
89 void append(uint arg);
90 void append(qlonglong arg);
91 void append(qulonglong arg);
92 void append(double arg);
93 void append(const QString &arg);
94 void append(const QDBusObjectPath &arg);
95 void append(const QDBusSignature &arg);
96 void append(const QDBusUnixFileDescriptor &arg);
97 void append(const QStringList &arg);
98 void append(const QByteArray &arg);
99 bool append(const QDBusVariant &arg); // this one can fail
100
101 QDBusMarshaller *beginStructure();
102 QDBusMarshaller *endStructure();
103 QDBusMarshaller *beginArray(QMetaType id);
104 QDBusMarshaller *endArray();
105 QDBusMarshaller *beginMap(QMetaType kid, QMetaType vid);
106 QDBusMarshaller *endMap();
107 QDBusMarshaller *beginMapEntry();
108 QDBusMarshaller *endMapEntry();
109 QDBusMarshaller *beginCommon(int code, const char *signature);
110 QDBusMarshaller *endCommon();
111 void open(QDBusMarshaller &sub, int code, const char *signature);
112 void close();
113 void error(const QString &message);
114
115 bool appendVariantInternal(const QVariant &arg);
116 bool appendRegisteredType(const QVariant &arg);
118
120 QDBusMarshaller *parent = nullptr;
121 QByteArray *ba = nullptr;
123 char closeCode = 0;
124 bool ok = true;
125 bool skipSignature = false;
126
127private:
128 Q_DECL_COLD_FUNCTION void unregisteredTypeError(QMetaType t);
129 Q_DISABLE_COPY_MOVE(QDBusMarshaller)
130};
131
133{
134public:
140
142
143 uchar toByte();
144 bool toBool();
146 short toShort();
147 int toInt();
148 uint toUInt();
151 double toDouble();
155 QDBusUnixFileDescriptor toUnixFileDescriptor();
159
171 inline void close() { }
172
173 bool atEnd();
174
178
181
182private:
185 QDBusObjectPath toObjectPathUnchecked();
186 QDBusSignature toSignatureUnchecked();
187 QStringList toStringListUnchecked();
188 QByteArray toByteArrayUnchecked();
189};
190
191inline QDBusMarshaller *QDBusArgumentPrivate::marshaller()
192{ return static_cast<QDBusMarshaller *>(this); }
193
195{ return static_cast<QDBusDemarshaller *>(this); }
196
197QT_END_NAMESPACE
198
199#endif // QT_NO_DBUS
200#endif
static QDBusArgument create(QDBusArgumentPrivate *d)
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
virtual ~QDBusArgumentPrivate()
QDBusArgumentPrivate(Direction direction, QDBusConnection::ConnectionCapabilities flags={})
static QByteArray createSignature(QMetaType type)
static QDBusArgumentPrivate * d(QDBusArgument &q)
QDBusMarshaller * marshaller()
static bool checkRead(QDBusArgumentPrivate *d)
static bool checkWrite(QDBusArgumentPrivate *&d)
\inmodule QtDBus
QDBusDemarshaller * beginArray()
QDBusArgument duplicate()
QDBusDemarshaller * endArray()
QDBusDemarshaller * endStructure()
QDBusDemarshaller * endMapEntry()
QDBusSignature toSignature()
QDBusUnixFileDescriptor toUnixFileDescriptor()
QDBusObjectPath toObjectPath()
QDBusDemarshaller * beginStructure()
QDBusDemarshaller * endCommon()
QDBusDemarshaller * beginMapEntry()
QDBusDemarshaller(QDBusConnection::ConnectionCapabilities flags={})
QDBusDemarshaller * beginCommon()
DBusMessageIter iterator
QDBusDemarshaller * endMap()
QDBusDemarshaller * beginMap()
QDBusDemarshaller * parent
QDBusArgument::ElementType currentType()
void append(const QString &arg)
void append(uchar arg)
QDBusMarshaller * parent
void append(short arg)
QDBusMarshaller * endMapEntry()
void append(double arg)
QDBusMarshaller * endCommon()
QDBusMarshaller * endStructure()
void append(bool arg)
void open(QDBusMarshaller &sub, int code, const char *signature)
QString currentSignature()
bool appendVariantInternal(const QVariant &arg)
QDBusMarshaller * beginMap(QMetaType kid, QMetaType vid)
QDBusMarshaller(QDBusConnection::ConnectionCapabilities flags={})
QDBusMarshaller * endMap()
QDBusMarshaller * beginCommon(int code, const char *signature)
void append(const QDBusUnixFileDescriptor &arg)
QDBusMarshaller * beginMapEntry()
bool appendRegisteredType(const QVariant &arg)
void error(const QString &message)
QDBusMarshaller * beginStructure()
QDBusMarshaller * beginArray(QMetaType id)
bool appendCrossMarshalling(QDBusDemarshaller *arg)
DBusMessageIter iterator
QDBusMarshaller * endArray()
\inmodule QtDBus
\inmodule QtCore\reentrant
Definition qpoint.h:231
\inmodule QtCore\reentrant
Definition qpoint.h:29
#define DBUS_MESSAGE_TYPE_METHOD_CALL
#define DBUS_TYPE_BYTE
#define DBUS_TYPE_UNIX_FD
#define DBUS_STRUCT_BEGIN_CHAR
#define DBUS_TYPE_STRING
#define DBUS_TYPE_ARRAY
bool qdbus_loadLibDBus()
QT_END_NAMESPACE QT_BEGIN_NAMESPACE const QDBusArgument & operator>>(const QDBusArgument &a, QVariant &v)
QDBusArgument & operator<<(QDBusArgument &a, const QPointF &pt)
const QDBusArgument & operator>>(const QDBusArgument &a, QPointF &pt)
QDBusArgument & operator<<(QDBusArgument &a, const QSize &size)
QDBusArgument & operator<<(QDBusArgument &a, const QDateTime &dt)
const QDBusArgument & operator>>(const QDBusArgument &a, QSize &size)
QDBusArgument & operator<<(QDBusArgument &a, const QSizeF &size)
QDBusArgument & operator<<(QDBusArgument &a, const QDate &date)
QDBusArgument & operator<<(QDBusArgument &a, const QTime &time)
const QDBusArgument & operator>>(const QDBusArgument &a, QRect &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QLineF &line)
const QDBusArgument & operator>>(const QDBusArgument &a, QDateTime &dt)
QDBusArgument & operator<<(QDBusArgument &a, const QRect &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QSizeF &size)
QDBusArgument & operator<<(QDBusArgument &a, const QRectF &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QTime &time)
const QDBusArgument & operator>>(const QDBusArgument &a, QRectF &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QDate &date)
const QDBusArgument & operator>>(const QDBusArgument &a, QLine &line)
const QDBusArgument & operator>>(const QDBusArgument &a, QPoint &pt)
QDBusArgument & operator<<(QDBusArgument &a, const QLine &line)
QDBusArgument & operator<<(QDBusArgument &a, const QPoint &pt)
QDBusArgument & operator<<(QDBusArgument &a, const QLineF &line)