| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtDBus module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qdbusextratypes.h" |
| 41 | #include "qdbusutil_p.h" |
| 42 | |
| 43 | #ifndef QT_NO_DBUS |
| 44 | |
| 45 | QT_BEGIN_NAMESPACE |
| 46 | |
| 47 | void QDBusObjectPath::doCheck() |
| 48 | { |
| 49 | if (!QDBusUtil::isValidObjectPath(path: m_path)) { |
| 50 | qWarning(msg: "QDBusObjectPath: invalid path \"%s\"" , qPrintable(m_path)); |
| 51 | m_path.clear(); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | void QDBusSignature::doCheck() |
| 56 | { |
| 57 | if (!QDBusUtil::isValidSignature(signature: m_signature)) { |
| 58 | qWarning(msg: "QDBusSignature: invalid signature \"%s\"" , qPrintable(m_signature)); |
| 59 | m_signature.clear(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /*! |
| 64 | \class QDBusVariant |
| 65 | \inmodule QtDBus |
| 66 | \since 4.2 |
| 67 | |
| 68 | \brief The QDBusVariant class enables the programmer to identify |
| 69 | the variant type provided by the D-Bus typesystem. |
| 70 | |
| 71 | A D-Bus function that takes an integer, a D-Bus variant and a string as parameters |
| 72 | can be called with the following argument list (see QDBusMessage::setArguments()): |
| 73 | |
| 74 | \snippet qdbusextratypes/qdbusextratypes.cpp 0 |
| 75 | |
| 76 | When a D-Bus function returns a D-Bus variant, it can be retrieved as follows: |
| 77 | |
| 78 | \snippet qdbusextratypes/qdbusextratypes.cpp 1 |
| 79 | |
| 80 | The QVariant within a QDBusVariant is required to distinguish between a normal |
| 81 | D-Bus value and a value within a D-Bus variant. |
| 82 | |
| 83 | \sa {The Qt D-Bus Type System} |
| 84 | */ |
| 85 | |
| 86 | /*! |
| 87 | \fn QDBusVariant::QDBusVariant() |
| 88 | |
| 89 | Constructs a new D-Bus variant. |
| 90 | */ |
| 91 | |
| 92 | /*! |
| 93 | \fn QDBusVariant::QDBusVariant(const QVariant &variant) |
| 94 | |
| 95 | Constructs a new D-Bus variant from the given Qt \a variant. |
| 96 | |
| 97 | \sa setVariant() |
| 98 | */ |
| 99 | |
| 100 | /*! |
| 101 | \fn QVariant QDBusVariant::variant() const |
| 102 | |
| 103 | Returns this D-Bus variant as a QVariant object. |
| 104 | |
| 105 | \sa setVariant() |
| 106 | */ |
| 107 | |
| 108 | /*! |
| 109 | \fn void QDBusVariant::setVariant(const QVariant &variant) |
| 110 | |
| 111 | Assigns the value of the given Qt \a variant to this D-Bus variant. |
| 112 | |
| 113 | \sa variant() |
| 114 | */ |
| 115 | |
| 116 | /*! |
| 117 | \class QDBusObjectPath |
| 118 | \inmodule QtDBus |
| 119 | \since 4.2 |
| 120 | |
| 121 | \brief The QDBusObjectPath class enables the programmer to |
| 122 | identify the OBJECT_PATH type provided by the D-Bus typesystem. |
| 123 | |
| 124 | \sa {The Qt D-Bus Type System} |
| 125 | */ |
| 126 | |
| 127 | /*! |
| 128 | \fn QDBusObjectPath::QDBusObjectPath() |
| 129 | |
| 130 | Constructs a new object path. |
| 131 | */ |
| 132 | |
| 133 | /*! |
| 134 | \fn QDBusObjectPath::QDBusObjectPath(const char *path) |
| 135 | |
| 136 | Constructs a new object path from the given \a path. |
| 137 | |
| 138 | \sa setPath() |
| 139 | */ |
| 140 | |
| 141 | /*! |
| 142 | \fn QDBusObjectPath::QDBusObjectPath(QLatin1String path) |
| 143 | |
| 144 | Constructs a new object path from the given \a path. |
| 145 | */ |
| 146 | |
| 147 | /*! |
| 148 | \fn QDBusObjectPath::QDBusObjectPath(const QString &path) |
| 149 | |
| 150 | Constructs a new object path from the given \a path. |
| 151 | */ |
| 152 | |
| 153 | /*! |
| 154 | \fn QString QDBusObjectPath::path() const |
| 155 | |
| 156 | Returns this object path. |
| 157 | |
| 158 | \sa setPath() |
| 159 | */ |
| 160 | |
| 161 | /*! |
| 162 | \fn void QDBusObjectPath::setPath(const QString &path) |
| 163 | |
| 164 | Assigns the value of the given \a path to this object path. |
| 165 | |
| 166 | \sa path() |
| 167 | */ |
| 168 | |
| 169 | /*! |
| 170 | \since 5.14 |
| 171 | |
| 172 | Implicit cast to QVariant. Equivalent to calling |
| 173 | QVariant::fromValue() with this object as argument. |
| 174 | */ |
| 175 | QDBusObjectPath::operator QVariant() const { return QVariant::fromValue(value: *this); } |
| 176 | |
| 177 | /*! |
| 178 | \class QDBusSignature |
| 179 | \inmodule QtDBus |
| 180 | \since 4.2 |
| 181 | |
| 182 | \brief The QDBusSignature class enables the programmer to |
| 183 | identify the SIGNATURE type provided by the D-Bus typesystem. |
| 184 | |
| 185 | \sa {The Qt D-Bus Type System} |
| 186 | */ |
| 187 | |
| 188 | /*! |
| 189 | \fn QDBusSignature::QDBusSignature() |
| 190 | |
| 191 | Constructs a new signature. |
| 192 | |
| 193 | \sa setSignature() |
| 194 | */ |
| 195 | |
| 196 | /*! |
| 197 | \fn QDBusSignature::QDBusSignature(const char *signature) |
| 198 | |
| 199 | Constructs a new signature from the given \a signature. |
| 200 | */ |
| 201 | |
| 202 | /*! |
| 203 | \fn QDBusSignature::QDBusSignature(QLatin1String signature) |
| 204 | |
| 205 | Constructs a new signature from the given \a signature. |
| 206 | */ |
| 207 | |
| 208 | /*! |
| 209 | \fn QDBusSignature::QDBusSignature(const QString &signature) |
| 210 | |
| 211 | Constructs a new signature from the given \a signature. |
| 212 | */ |
| 213 | |
| 214 | /*! |
| 215 | \fn QString QDBusSignature::signature() const |
| 216 | |
| 217 | Returns this signature. |
| 218 | |
| 219 | \sa setSignature() |
| 220 | */ |
| 221 | |
| 222 | /*! |
| 223 | \fn void QDBusSignature::setSignature(const QString &signature) |
| 224 | |
| 225 | Assigns the value of the given \a signature to this signature. |
| 226 | \sa signature() |
| 227 | */ |
| 228 | |
| 229 | /*! |
| 230 | \fn void QDBusObjectPath::swap(QDBusObjectPath &other) |
| 231 | |
| 232 | Swaps this QDBusObjectPath instance with \a other. |
| 233 | */ |
| 234 | |
| 235 | /*! |
| 236 | \fn void QDBusSignature::swap(QDBusSignature &other) |
| 237 | |
| 238 | Swaps this QDBusSignature instance with \a other. |
| 239 | */ |
| 240 | |
| 241 | /*! |
| 242 | \fn void QDBusVariant::swap(QDBusVariant &other) |
| 243 | |
| 244 | Swaps this QDBusVariant instance with \a other. |
| 245 | */ |
| 246 | |
| 247 | QT_END_NAMESPACE |
| 248 | |
| 249 | #endif // QT_NO_DBUS |
| 250 | |