KIO

dbustypes.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2020 Henri Chain <henri.chain@enioka.com>
4
5 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef DBUSTYPES_H
9#define DBUSTYPES_H
10
11#include <QDBusArgument>
12
13struct QVariantMultiItem {
14 QString key;
15 QVariant value;
16};
17Q_DECLARE_METATYPE(QVariantMultiItem)
19Q_DECLARE_METATYPE(QVariantMultiMap)
20
21inline QDBusArgument &operator<<(QDBusArgument &argument, const QVariantMultiItem &item)
22{
23 argument.beginStructure();
24 argument << item.key << QDBusVariant(item.value);
25 argument.endStructure();
26 return argument;
27}
28
29inline const QDBusArgument &operator>>(const QDBusArgument &argument, QVariantMultiItem &item)
30{
31 argument.beginStructure();
32 argument >> item.key >> item.value;
33 argument.endStructure();
34 return argument;
35}
36
37struct ExecCommand {
38 QString path;
39 QStringList argv;
40 bool ignoreFailure;
41};
42Q_DECLARE_METATYPE(ExecCommand)
44Q_DECLARE_METATYPE(ExecCommandList)
45
46inline QDBusArgument &operator<<(QDBusArgument &argument, const ExecCommand &execCommand)
47{
48 argument.beginStructure();
49 argument << execCommand.path << execCommand.argv << execCommand.ignoreFailure;
50 argument.endStructure();
51 return argument;
52}
53
54inline const QDBusArgument &operator>>(const QDBusArgument &argument, ExecCommand &execCommand)
55{
56 argument.beginStructure();
57 argument >> execCommand.path >> execCommand.argv >> execCommand.ignoreFailure;
58 argument.endStructure();
59 return argument;
60}
61
62struct TransientAux {
63 QString name;
64 QVariantMultiMap properties;
65};
66Q_DECLARE_METATYPE(TransientAux)
68Q_DECLARE_METATYPE(TransientAuxList)
69
70inline QDBusArgument &operator<<(QDBusArgument &argument, const TransientAux &aux)
71{
72 argument.beginStructure();
73 argument << aux.name << aux.properties;
74 argument.endStructure();
75 return argument;
76}
77
78inline const QDBusArgument &operator>>(const QDBusArgument &argument, TransientAux &aux)
79{
80 argument.beginStructure();
81 argument >> aux.name >> aux.properties;
82 argument.endStructure();
83 return argument;
84}
85
86#endif // DBUSTYPES_H
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
void beginStructure()
void endStructure()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.