GXDE Bernese
Toggle main menu visibility
Loading...
Searching...
No Matches
src
dbus_introspection
dbus_introspection.h
1
/*
2
* Copyright (C) 2026 CharOfString <root@charofstring.cc>
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the Free
6
* Software Foundation, either version 3 of the License, or (at your option)
7
* any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along with
15
* this program. If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef DBUS_INTROSPECTION_DBUS_INTROSPECTION_H_
19
#define DBUS_INTROSPECTION_DBUS_INTROSPECTION_H_
20
21
#include "QList"
22
#include "QMap"
23
#include "QMultiMap"
24
#include "QSharedPointer"
25
#include "QString"
26
27
#include "bernese/export.h"
28
29
namespace
bernese {
30
namespace
dbus_introspection {
31
32
// Annotation values by annotation name. A later annotation with the same
33
// name replaces the earlier one.
34
using
Annotations = QMap<QString, QString>;
35
36
// One argument of a method or a signal.
37
struct
Argument
{
38
QString type;
// D-Bus type signature, like "a{sv}".
39
QString name;
// May be empty.
40
};
41
42
using
Arguments = QList<Argument>;
43
44
// One method of an interface.
45
struct
Method
{
46
QString name;
47
Arguments input_args;
48
Arguments output_args;
49
Annotations annotations;
50
};
51
52
// One signal of an interface. Signals only have output arguments.
53
struct
Signal
{
54
QString name;
55
Arguments output_args;
56
Annotations annotations;
57
};
58
59
// One property of an interface.
60
struct
Property
{
61
enum class
Access { kRead, kWrite, kReadWrite };
62
63
QString name;
64
QString type;
// D-Bus type signature.
65
Access access = Access::kRead;
66
Annotations annotations;
67
};
68
69
// One interface. The maps are sorted by member name. Overloaded methods and
70
// signals share one name, so they use multi maps.
71
struct
Interface
{
72
QString name;
73
// The interface written back as XML, in the same text form that QtDBus
74
// makes. Generated adaptors store it in their D-Bus Introspection
75
// class info.
76
QString introspection;
77
Annotations annotations;
78
QMultiMap<QString, Method> methods;
79
// Not named "signals" because that word is a Qt keyword macro.
80
QMultiMap<QString, Signal> signal_map;
81
QMap<QString, Property> properties;
82
};
83
84
// Interfaces by interface name.
85
using
Interfaces = QMap<QString, QSharedPointer<const Interface>>;
86
97
BERNESE_EXPORT Interfaces ParseInterfaces(
const
QString& xml);
98
108
BERNESE_EXPORT
bool
IsValidMemberName(
const
QString& name);
109
119
BERNESE_EXPORT
bool
IsValidInterfaceName(
const
QString& name);
120
121
}
// namespace dbus_introspection
122
}
// namespace bernese
123
124
#endif
// DBUS_INTROSPECTION_DBUS_INTROSPECTION_H_
bernese::dbus_introspection::Argument
Definition
dbus_introspection.h:37
bernese::dbus_introspection::Interface
Definition
dbus_introspection.h:71
bernese::dbus_introspection::Method
Definition
dbus_introspection.h:45
bernese::dbus_introspection::Property
Definition
dbus_introspection.h:60
bernese::dbus_introspection::Signal
Definition
dbus_introspection.h:53
Generated by
1.18.0