Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qdbusextratypes.cpp
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
#
include
"qdbusextratypes.h"
6
#
include
"qdbusutil_p.h"
7
8
#
ifndef
QT_NO_DBUS
9
10
QT_BEGIN_NAMESPACE
11
12
QT_IMPL_METATYPE_EXTERN(QDBusVariant)
13
QT_IMPL_METATYPE_EXTERN(QDBusObjectPath)
14
QT_IMPL_METATYPE_EXTERN(QDBusSignature)
15
16
#
ifndef
QT_NO_DEBUG_STREAM
17
/*!
18
\fn QDebug QDBusObjectPath::operator<<(QDebug dbg, const QDBusObjectPath &path)
19
\since 6.8
20
Writes the contents of \a path to \a dbg.
21
*/
22
QDebug operator<<(QDebug dbg,
const
QDBusObjectPath &path)
23
{
24
QDebugStateSaver saver(dbg);
25
dbg.nospace() <<
"QDBusObjectPath("
<< path.path() <<
')'
;
26
return
dbg;
27
}
28
#
endif
29
30
void
QDBusObjectPath::doCheck()
31
{
32
if
(!QDBusUtil::isValidObjectPath(m_path)) {
33
qWarning(
"QDBusObjectPath: invalid path \"%s\""
, qPrintable(m_path));
34
m_path.clear();
35
}
36
}
37
38
QDBusSignature::QDBusSignature()
noexcept
39
: m_signature(QLatin1StringView(
""
))
// mark non-null (empty signatures are valid)
40
{}
41
42
void
QDBusSignature::doCheck()
43
{
44
if
(!QDBusUtil::isValidSignature(m_signature)) {
45
qWarning(
"QDBusSignature: invalid signature \"%s\""
, qPrintable(m_signature));
46
m_signature.clear();
47
}
else
if
(m_signature.isEmpty()) {
48
m_signature.detach();
// we need it to not be null
49
}
50
}
51
52
/*!
53
\class QDBusVariant
54
\inmodule QtDBus
55
\since 4.2
56
57
\brief The QDBusVariant class enables the programmer to identify
58
the variant type provided by the D-Bus typesystem.
59
60
A D-Bus function that takes an integer, a D-Bus variant and a string as parameters
61
can be called with the following argument list (see QDBusMessage::setArguments()):
62
63
\snippet qdbusextratypes/qdbusextratypes.cpp 0
64
65
When a D-Bus function returns a D-Bus variant, it can be retrieved as follows:
66
67
\snippet qdbusextratypes/qdbusextratypes.cpp 1
68
69
The QVariant within a QDBusVariant is required to distinguish between a normal
70
D-Bus value and a value within a D-Bus variant.
71
72
\sa {The Qt D-Bus Type System}
73
*/
74
75
/*!
76
\fn QDBusVariant::QDBusVariant()
77
78
Constructs a new D-Bus variant.
79
*/
80
81
/*!
82
\fn QDBusVariant::QDBusVariant(const QVariant &variant)
83
84
Constructs a new D-Bus variant from the given Qt \a variant.
85
86
\sa setVariant()
87
*/
88
89
/*!
90
\fn QVariant QDBusVariant::variant() const
91
92
Returns this D-Bus variant as a QVariant object.
93
94
\sa setVariant()
95
*/
96
97
/*!
98
\fn void QDBusVariant::setVariant(const QVariant &variant)
99
100
Assigns the value of the given Qt \a variant to this D-Bus variant.
101
102
\sa variant()
103
*/
104
105
/*!
106
\class QDBusObjectPath
107
\inmodule QtDBus
108
\since 4.2
109
110
\brief The QDBusObjectPath class enables the programmer to
111
identify the OBJECT_PATH type provided by the D-Bus typesystem.
112
113
\sa {The Qt D-Bus Type System}
114
*/
115
116
/*!
117
\fn QDBusObjectPath::QDBusObjectPath()
118
119
Constructs a new object path.
120
*/
121
122
/*!
123
\fn QDBusObjectPath::QDBusObjectPath(const char *path)
124
125
Constructs a new object path from the given \a path.
126
127
\sa setPath()
128
*/
129
130
/*!
131
\fn QDBusObjectPath::QDBusObjectPath(QLatin1StringView path)
132
133
Constructs a new object path from the Latin-1 string viewed by \a path.
134
*/
135
136
/*!
137
\fn QDBusObjectPath::QDBusObjectPath(const QString &path)
138
139
Constructs a new object path from the given \a path.
140
*/
141
142
/*!
143
\fn QString QDBusObjectPath::path() const
144
145
Returns this object path.
146
147
\sa setPath()
148
*/
149
150
/*!
151
\fn void QDBusObjectPath::setPath(const QString &path)
152
153
Assigns the value of the given \a path to this object path.
154
155
\sa path()
156
*/
157
158
/*!
159
\since 5.14
160
161
Implicit cast to QVariant. Equivalent to calling
162
QVariant::fromValue() with this object as argument.
163
*/
164
QDBusObjectPath::operator QVariant()
const
{
return
QVariant::fromValue(*
this
); }
165
166
/*!
167
\class QDBusSignature
168
\inmodule QtDBus
169
\since 4.2
170
171
\brief The QDBusSignature class enables the programmer to
172
identify the SIGNATURE type provided by the D-Bus typesystem.
173
174
\sa {The Qt D-Bus Type System}
175
*/
176
177
/*!
178
\fn QDBusSignature::QDBusSignature()
179
180
Constructs a new signature.
181
182
\sa setSignature()
183
*/
184
185
/*!
186
\fn QDBusSignature::QDBusSignature(const char *signature)
187
188
Constructs a new signature from the given \a signature.
189
*/
190
191
/*!
192
\fn QDBusSignature::QDBusSignature(QLatin1StringView signature)
193
194
Constructs a new signature from the Latin-1 string viewed by \a signature.
195
*/
196
197
/*!
198
\fn QDBusSignature::QDBusSignature(const QString &signature)
199
200
Constructs a new signature from the given \a signature.
201
*/
202
203
/*!
204
\fn QString QDBusSignature::signature() const
205
206
Returns this signature.
207
208
\sa setSignature()
209
*/
210
211
/*!
212
\fn void QDBusSignature::setSignature(const QString &signature)
213
214
Assigns the value of the given \a signature to this signature.
215
\sa signature()
216
*/
217
218
/*!
219
\fn void QDBusObjectPath::swap(QDBusObjectPath &other)
220
\memberswap{object path}
221
*/
222
223
/*!
224
\fn void QDBusSignature::swap(QDBusSignature &other)
225
\memberswap{signature}
226
*/
227
228
/*!
229
\fn void QDBusVariant::swap(QDBusVariant &other)
230
\memberswap{variant}
231
*/
232
233
QT_END_NAMESPACE
234
235
#
endif
// QT_NO_DBUS
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
dbus
qdbusextratypes.cpp
Generated on
for Qt by
1.18.0