summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusargument.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus/qdbusargument.h')
-rw-r--r--src/dbus/qdbusargument.h72
1 files changed, 15 insertions, 57 deletions
diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h
index cf09543912..70f6703d2f 100644
--- a/src/dbus/qdbusargument.h
+++ b/src/dbus/qdbusargument.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_H
#define QDBUSARGUMENT_H
@@ -81,9 +45,9 @@ public:
QDBusArgument &operator=(const QDBusArgument &other);
~QDBusArgument();
- void swap(QDBusArgument &other) noexcept { qSwap(d, other.d); }
+ void swap(QDBusArgument &other) noexcept { qt_ptr_swap(d, other.d); }
- // used for marshalling (Qt -> D-BUS)
+ // used for marshalling (Qt -> D-Bus)
QDBusArgument &operator<<(uchar arg);
QDBusArgument &operator<<(bool arg);
QDBusArgument &operator<<(short arg);
@@ -116,7 +80,7 @@ public:
void appendVariant(const QVariant &v);
- // used for de-marshalling (D-BUS -> Qt)
+ // used for de-marshalling (D-Bus -> Qt)
QString currentSignature() const;
ElementType currentType() const;
@@ -157,7 +121,7 @@ protected:
Q_DECLARE_SHARED(QDBusArgument)
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDBusArgument)
+QT_DECL_METATYPE_EXTERN(QDBusArgument, Q_DBUS_EXPORT)
QT_BEGIN_NAMESPACE
template<typename T> inline T qdbus_cast(const QDBusArgument &arg)
@@ -258,10 +222,8 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &l
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list)
{
arg.beginArray(QMetaType::fromType<QDBusVariant>());
- QVariantList::ConstIterator it = list.constBegin();
- QVariantList::ConstIterator end = list.constEnd();
- for ( ; it != end; ++it)
- arg << QDBusVariant(*it);
+ for (const QVariant &value : list)
+ arg << QDBusVariant(value);
arg.endArray();
return arg;
}
@@ -300,7 +262,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const Container<Key, T> &ma
}
template <template <typename, typename> class Container, typename Key, typename T,
- typename = typename Container<Key, T>::iterator>
+ QtPrivate::IfAssociativeIteratorHasKeyAndValue<typename Container<Key, T>::iterator> = true>
inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<Key, T> &map)
{
arg.beginMap();
@@ -320,11 +282,9 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<Key,
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map)
{
arg.beginMap(QMetaType::fromType<QString>(), QMetaType::fromType<QDBusVariant>());
- QVariantMap::ConstIterator it = map.constBegin();
- QVariantMap::ConstIterator end = map.constEnd();
- for ( ; it != end; ++it) {
+ for (const auto &[key, value] : map.asKeyValueRange()) {
arg.beginMapEntry();
- arg << it.key() << QDBusVariant(it.value());
+ arg << key << QDBusVariant(value);
arg.endMapEntry();
}
arg.endMap();
@@ -334,11 +294,9 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map)
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantHash &map)
{
arg.beginMap(QMetaType::fromType<QString>(), QMetaType::fromType<QDBusVariant>());
- QVariantHash::ConstIterator it = map.constBegin();
- QVariantHash::ConstIterator end = map.constEnd();
- for ( ; it != end; ++it) {
+ for (const auto &[key, value] : map.asKeyValueRange()) {
arg.beginMapEntry();
- arg << it.key() << QDBusVariant(it.value());
+ arg << key << QDBusVariant(value);
arg.endMapEntry();
}
arg.endMap();
@@ -346,7 +304,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantHash &map)
}
template <typename T1, typename T2>
-inline QDBusArgument &operator<<(QDBusArgument &arg, const QPair<T1, T2> &pair)
+inline QDBusArgument &operator<<(QDBusArgument &arg, const std::pair<T1, T2> &pair)
{
arg.beginStructure();
arg << pair.first << pair.second;
@@ -355,7 +313,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QPair<T1, T2> &pair)
}
template <typename T1, typename T2>
-inline const QDBusArgument &operator>>(const QDBusArgument &arg, QPair<T1, T2> &pair)
+inline const QDBusArgument &operator>>(const QDBusArgument &arg, std::pair<T1, T2> &pair)
{
arg.beginStructure();
arg >> pair.first >> pair.second;