summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandr Akulich <akulichalexander@gmail.com>2016-06-10 20:49:56 +0500
committerAlexandr Akulich <akulichalexander@gmail.com>2016-06-10 20:49:56 +0500
commit8864249479ea2adbb5c88378aa082fa18d55f6b0 (patch)
treee13e0ad9c057c76854ee668358182c5cb076aa1f
parent7dfa899ce592d80910c1d5b0c9864bec4d36f081 (diff)
Tools/qt-types-gen: Added QDBusArgument stream operators for lists.
Previously we used operators are now deprecated and will be removed in Qt-5.8.
-rw-r--r--tools/qt-types-gen.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/qt-types-gen.py b/tools/qt-types-gen.py
index b87c3651..9a234da7 100644
--- a/tools/qt-types-gen.py
+++ b/tools/qt-types-gen.py
@@ -302,6 +302,40 @@ TP_QT_NO_EXPORT void _registerTypes()
self.decl(self.faketype(val, real))
self.to_declare.append(self.namespace + '::' + val)
+ self.both('%s QDBusArgument& operator<<(QDBusArgument& arg, const %s &list)' %
+ (self.visibility, val))
+ self.decl(';\n')
+ self.impl("""
+{
+ int id = qMetaTypeId<%s>();
+ arg.beginArray(id);
+ for (int i = 0; i < list.count(); ++i) {
+ arg << list.at(i);
+ }
+ arg.endArray();
+ return arg;
+}
+
+""" % (array_of))
+
+ self.both('%s const QDBusArgument& operator>>(const QDBusArgument& arg, %s &list)' %
+ (self.visibility, val))
+ self.decl(';\n\n')
+ self.impl("""
+{
+ arg.beginArray();
+ list.clear();
+ while (!arg.atEnd()) {
+ %s item;
+ arg >> item;
+ list.append(item);
+ }
+ arg.endArray();
+ return arg;
+}
+
+""" % (array_of))
+
structs = self.spec.getElementsByTagNameNS(NS_TP, 'struct')
mappings = self.spec.getElementsByTagNameNS(NS_TP, 'mapping')
exts = self.spec.getElementsByTagNameNS(NS_TP, 'external-type')