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
5#ifndef Q_SPI_STRUCT_MARSHALLERS_H
6#define Q_SPI_STRUCT_MARSHALLERS_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtGui/private/qtguiglobal_p.h>
20#include <QtCore/qlist.h>
21#include <QtCore/qpair.h>
22#include <QtDBus/QDBusArgument>
23#include <QtDBus/QDBusConnection>
24#include <QtDBus/QDBusObjectPath>
25
26QT_REQUIRE_CONFIG(accessibility);
27
28QT_BEGIN_NAMESPACE
29
30using QSpiIntList = QList<int>;
31using QSpiUIntList = QList<uint>;
32
33// FIXME: make this copy on write
34struct QSpiObjectReference
35{
36 QString service;
37 QDBusObjectPath path;
38
39 QSpiObjectReference();
40 QSpiObjectReference(const QDBusConnection& connection, const QDBusObjectPath& path)
41 : service(connection.baseService()), path(path) {}
42};
43Q_DECLARE_TYPEINFO(QSpiObjectReference, Q_RELOCATABLE_TYPE); // QDBusObjectPath is movable, even though it
44 // cannot be marked that way until Qt 6
45
46QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address);
47const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address);
48
49typedef QList<QSpiObjectReference> QSpiObjectReferenceArray;
50
51struct QSpiAccessibleCacheItem
52{
53 QSpiObjectReference path;
54 QSpiObjectReference application;
55 QSpiObjectReference parent;
56 QSpiObjectReferenceArray children;
57 QStringList supportedInterfaces;
58 QString name;
59 uint role;
60 QString description;
61 QSpiUIntList state;
62};
63Q_DECLARE_TYPEINFO(QSpiAccessibleCacheItem, Q_RELOCATABLE_TYPE);
64
65typedef QList<QSpiAccessibleCacheItem> QSpiAccessibleCacheArray;
66
67QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item);
68const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item);
69
70struct QSpiAction
71{
72 QString name;
73 QString description;
74 QString keyBinding;
75};
76Q_DECLARE_TYPEINFO(QSpiAction, Q_RELOCATABLE_TYPE);
77
78typedef QList<QSpiAction> QSpiActionArray;
79
80QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action);
81const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action);
82
83struct QSpiEventListener
84{
85 QString listenerAddress;
86 QString eventName;
87};
88Q_DECLARE_TYPEINFO(QSpiEventListener, Q_RELOCATABLE_TYPE);
89
90typedef QList<QSpiEventListener> QSpiEventListenerArray;
91
92QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action);
93const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action);
94
95typedef QPair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry;
96typedef QList<QSpiRelationArrayEntry> QSpiRelationArray;
97
98//a(iisv)
99struct QSpiTextRange {
100 int startOffset;
101 int endOffset;
102 QString contents;
103 QVariant v;
104};
105Q_DECLARE_TYPEINFO(QSpiTextRange, Q_RELOCATABLE_TYPE);
106
107typedef QList<QSpiTextRange> QSpiTextRangeList;
108typedef QMap <QString, QString> QSpiAttributeSet;
109
110enum QSpiAppUpdateType {
111 QSPI_APP_UPDATE_ADDED = 0,
112 QSPI_APP_UPDATE_REMOVED = 1
113};
114Q_DECLARE_TYPEINFO(QSpiAppUpdateType, Q_PRIMITIVE_TYPE);
115
116struct QSpiAppUpdate {
117 int type; /* Is an application added or removed */
118 QString address; /* D-Bus address of application added or removed */
119};
120Q_DECLARE_TYPEINFO(QSpiAppUpdate, Q_RELOCATABLE_TYPE);
121
122QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update);
123const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update);
124
125struct QSpiDeviceEvent {
126 unsigned int type;
127 int id;
128 int hardwareCode;
129 int modifiers;
130 int timestamp;
131 QString text;
132 bool isText;
133};
134Q_DECLARE_TYPEINFO(QSpiDeviceEvent, Q_RELOCATABLE_TYPE);
135
136QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event);
137const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event);
138
139void qSpiInitializeStructTypes();
140
141QT_END_NAMESPACE
142
143QT_DECL_METATYPE_EXTERN(QSpiIntList, /* not exported */)
144QT_DECL_METATYPE_EXTERN(QSpiUIntList, /* not exported */)
145QT_DECL_METATYPE_EXTERN(QSpiObjectReference, /* not exported */)
146QT_DECL_METATYPE_EXTERN(QSpiObjectReferenceArray, /* not exported */)
147QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheItem, /* not exported */)
148QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheArray, /* not exported */)
149QT_DECL_METATYPE_EXTERN(QSpiAction, /* not exported */)
150QT_DECL_METATYPE_EXTERN(QSpiActionArray, /* not exported */)
151QT_DECL_METATYPE_EXTERN(QSpiEventListener, /* not exported */)
152QT_DECL_METATYPE_EXTERN(QSpiEventListenerArray, /* not exported */)
153QT_DECL_METATYPE_EXTERN(QSpiRelationArrayEntry, /* not exported */)
154QT_DECL_METATYPE_EXTERN(QSpiRelationArray, /* not exported */)
155QT_DECL_METATYPE_EXTERN(QSpiTextRange, /* not exported */)
156QT_DECL_METATYPE_EXTERN(QSpiTextRangeList, /* not exported */)
157QT_DECL_METATYPE_EXTERN(QSpiAttributeSet, /* not exported */)
158QT_DECL_METATYPE_EXTERN(QSpiAppUpdate, /* not exported */)
159QT_DECL_METATYPE_EXTERN(QSpiDeviceEvent, /* not exported */)
160
161// For qdbusxml2cpp-generated code
162QT_USE_NAMESPACE
163
164#endif /* Q_SPI_STRUCT_MARSHALLERS_H */
165

source code of qtbase/src/gui/accessible/linux/qspi_struct_marshallers_p.h