Commit d55f2b1f authored by Marc Mutz's avatar Marc Mutz
Browse files

Revert "QDBusArgument: remove useless op<< overloads"

This reverts commit 5f542f3c

,
since it breaks streaming of types derived from QList and
the docs state that this should be possible without providing
custom op<</>> for such types.

Task-number: QTBUG-53376
Change-Id: I2bde714ac384f2aed67ad30decea702fb79aef1b
Reviewed-by: default avatarAlex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: default avatarThiago Macieira <thiago.macieira@intel.com>
parent c7d4858c
Branches
Tags
No related merge requests found
Showing with 31 additions and 0 deletions
......@@ -261,6 +261,35 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &l
return arg;
}
// QList specializations
template<typename T>
inline QDBusArgument &operator<<(QDBusArgument &arg, const QList<T> &list)
{
int id = qMetaTypeId<T>();
arg.beginArray(id);
typename QList<T>::ConstIterator it = list.constBegin();
typename QList<T>::ConstIterator end = list.constEnd();
for ( ; it != end; ++it)
arg << *it;
arg.endArray();
return arg;
}
template<typename T>
inline const QDBusArgument &operator>>(const QDBusArgument &arg, QList<T> &list)
{
arg.beginArray();
list.clear();
while (!arg.atEnd()) {
T item;
arg >> item;
list.push_back(item);
}
arg.endArray();
return arg;
}
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list)
{
int id = qMetaTypeId<QDBusVariant>();
......@@ -273,6 +302,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list)
return arg;
}
// QMap specializations
template<typename Key, typename T>
inline QDBusArgument &operator<<(QDBusArgument &arg, const QMap<Key, T> &map)
{
......@@ -321,6 +351,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map)
return arg;
}
// QHash specializations
template<typename Key, typename T>
inline QDBusArgument &operator<<(QDBusArgument &arg, const QHash<Key, T> &map)
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment