-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstalldetail.cc
37 lines (34 loc) · 933 Bytes
/
installdetail.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "installdetail.h"
QDebug operator<<(QDebug d, const InstallDetail& o) {
const QVariant name = o.contents["name"];
const QVariant version = o.contents["version"];
d << "InstallDetail(" << name << ", " << version << ")";
return d;
}
/** QDBus Argument */
QDBusArgument& operator<<(QDBusArgument& a, const InstallDetail& d) {
a.beginMap(qMetaTypeId<QString>(), qMetaTypeId<QDBusVariant>());
a.beginMapEntry();
for (auto i = d.contents.begin(); i != d.contents.end(); ++i) {
a.beginMapEntry();
a << i.key();
a << QDBusVariant(i.value());
a.endMapEntry();
}
a.endMap();
return a;
}
const QDBusArgument& operator>>(const QDBusArgument& a, InstallDetail& res) {
res.contents.clear();
a.beginMap();
while (!a.atEnd()) {
QString key;
QVariant value;
a.beginMapEntry();
a >> key >> value;
a.endMapEntry();
res.contents[key] = value;
}
a.endMap();
return a;
}