1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDBUSINTROSPECTION_P_H
5#define QDBUSINTROSPECTION_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the QLibrary class. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtDBus/private/qtdbusglobal_p.h>
19#include <QtCore/qlist.h>
20#include <QtCore/qmap.h>
21#include <QtCore/qpair.h>
22#include <QtCore/qshareddata.h>
23#include <QtCore/qstring.h>
24#include <QtCore/qstringlist.h>
25
26#ifndef QT_NO_DBUS
27
28QT_BEGIN_NAMESPACE
29
30class Q_DBUS_EXPORT QDBusIntrospection
31{
32public:
33 // forward declarations
34 struct Argument;
35 struct Method;
36 struct Signal;
37 struct Property;
38 struct Interface;
39 struct Object;
40 struct ObjectTree;
41
42 // typedefs
43 typedef QMap<QString, QString> Annotations;
44 typedef QList<Argument> Arguments;
45 typedef QMultiMap<QString, Method> Methods;
46 typedef QMultiMap<QString, Signal> Signals;
47 typedef QMap<QString, Property> Properties;
48 typedef QMap<QString, QSharedDataPointer<Interface> > Interfaces;
49 typedef QMap<QString, QSharedDataPointer<ObjectTree> > Objects;
50
51public:
52 // the structs
53
54 struct Argument
55 {
56 QString type;
57 QString name;
58
59 inline bool operator==(const Argument& other) const
60 { return name == other.name && type == other.type; }
61 };
62
63 struct Method
64 {
65 QString name;
66 Arguments inputArgs;
67 Arguments outputArgs;
68 Annotations annotations;
69
70 inline bool operator==(const Method& other) const
71 { return name == other.name && annotations == other.annotations &&
72 inputArgs == other.inputArgs && outputArgs == other.outputArgs; }
73 };
74
75 struct Signal
76 {
77 QString name;
78 Arguments outputArgs;
79 Annotations annotations;
80
81 inline bool operator==(const Signal& other) const
82 { return name == other.name && annotations == other.annotations &&
83 outputArgs == other.outputArgs; }
84 };
85
86 struct Property
87 {
88 enum Access { Read, Write, ReadWrite };
89 QString name;
90 QString type;
91 Access access;
92 Annotations annotations;
93
94 inline bool operator==(const Property& other) const
95 { return access == other.access && name == other.name &&
96 annotations == other.annotations && type == other.type; }
97 };
98
99 struct Interface: public QSharedData
100 {
101 QString name;
102 QString introspection;
103
104 Annotations annotations;
105 Methods methods;
106 Signals signals_;
107 Properties properties;
108
109 inline bool operator==(const Interface &other) const
110 { return !name.isEmpty() && name == other.name; }
111 };
112
113 struct Object: public QSharedData
114 {
115 QString service;
116 QString path;
117
118 QStringList interfaces;
119 QStringList childObjects;
120 };
121
122public:
123 static Interface parseInterface(const QString &xml);
124 static Interfaces parseInterfaces(const QString &xml);
125 static Object parseObject(const QString &xml, const QString &service = QString(),
126 const QString &path = QString());
127
128private:
129 QDBusIntrospection();
130};
131
132QT_END_NAMESPACE
133
134#endif // QT_NO_DBUS
135#endif
136

source code of qtbase/src/dbus/qdbusintrospection_p.h