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#include "qspi_struct_marshallers_p.h"
6
7#include <atspi/atspi-constants.h>
8#include <QtCore/qdebug.h>
9#include <QtDBus/qdbusmetatype.h>
10
11#include "qspiaccessiblebridge_p.h"
12
13#if QT_CONFIG(accessibility)
14QT_BEGIN_NAMESPACE
15
16QT_IMPL_METATYPE_EXTERN(QSpiIntList)
17QT_IMPL_METATYPE_EXTERN(QSpiUIntList)
18QT_IMPL_METATYPE_EXTERN(QSpiObjectReference)
19QT_IMPL_METATYPE_EXTERN(QSpiObjectReferenceArray)
20QT_IMPL_METATYPE_EXTERN(QSpiAccessibleCacheItem)
21QT_IMPL_METATYPE_EXTERN(QSpiAccessibleCacheArray)
22QT_IMPL_METATYPE_EXTERN(QSpiAction)
23QT_IMPL_METATYPE_EXTERN(QSpiActionArray)
24QT_IMPL_METATYPE_EXTERN(QSpiEventListener)
25QT_IMPL_METATYPE_EXTERN(QSpiEventListenerArray)
26QT_IMPL_METATYPE_EXTERN(QSpiRelationArrayEntry)
27QT_IMPL_METATYPE_EXTERN(QSpiRelationArray)
28QT_IMPL_METATYPE_EXTERN(QSpiTextRange)
29QT_IMPL_METATYPE_EXTERN(QSpiTextRangeList)
30QT_IMPL_METATYPE_EXTERN(QSpiAttributeSet)
31QT_IMPL_METATYPE_EXTERN(QSpiAppUpdate)
32QT_IMPL_METATYPE_EXTERN(QSpiDeviceEvent)
33
34QSpiObjectReference::QSpiObjectReference()
35 : path(QDBusObjectPath(ATSPI_DBUS_PATH_NULL))
36{}
37
38/* QSpiAccessibleCacheArray */
39/*---------------------------------------------------------------------------*/
40
41QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item)
42{
43 argument.beginStructure();
44 argument << item.path;
45 argument << item.application;
46 argument << item.parent;
47 argument << item.children;
48 argument << item.supportedInterfaces;
49 argument << item.name;
50 argument << item.role;
51 argument << item.description;
52 argument << item.state;
53 argument.endStructure();
54 return argument;
55}
56
57const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item)
58{
59 argument.beginStructure();
60 argument >> item.path;
61 argument >> item.application;
62 argument >> item.parent;
63 argument >> item.children;
64 argument >> item.supportedInterfaces;
65 argument >> item.name;
66 argument >> item.role;
67 argument >> item.description;
68 argument >> item.state;
69 argument.endStructure();
70 return argument;
71}
72
73/* QSpiObjectReference */
74/*---------------------------------------------------------------------------*/
75
76QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address)
77{
78 argument.beginStructure();
79 argument << address.service;
80 argument << address.path;
81 argument.endStructure();
82 return argument;
83}
84
85const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address)
86{
87 argument.beginStructure();
88 argument >> address.service;
89 argument >> address.path;
90 argument.endStructure();
91 return argument;
92}
93
94/* QSpiAction */
95/*---------------------------------------------------------------------------*/
96
97QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action)
98{
99 argument.beginStructure();
100 argument << action.name;
101 argument << action.description;
102 argument << action.keyBinding;
103 argument.endStructure();
104 return argument;
105}
106
107const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action)
108{
109 argument.beginStructure();
110 argument >> action.name;
111 argument >> action.description;
112 argument >> action.keyBinding;
113 argument.endStructure();
114 return argument;
115}
116
117
118QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &ev)
119{
120 argument.beginStructure();
121 argument << ev.listenerAddress;
122 argument << ev.eventName;
123 argument.endStructure();
124 return argument;
125}
126
127const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &ev)
128{
129 argument.beginStructure();
130 argument >> ev.listenerAddress;
131 argument >> ev.eventName;
132 argument.endStructure();
133 return argument;
134}
135
136/* QSpiAppUpdate */
137/*---------------------------------------------------------------------------*/
138
139QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update) {
140 argument.beginStructure();
141 argument << update.type << update.address;
142 argument.endStructure();
143 return argument;
144}
145
146const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update) {
147 argument.beginStructure();
148 argument >> update.type >> update.address;
149 argument.endStructure();
150 return argument;
151}
152
153/* QSpiRelationArrayEntry */
154/*---------------------------------------------------------------------------*/
155
156QDBusArgument &operator<<(QDBusArgument &argument, const QSpiRelationArrayEntry &entry) {
157 argument.beginStructure();
158 argument << entry.first << entry.second;
159 argument.endStructure();
160 return argument;
161}
162
163const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiRelationArrayEntry &entry) {
164 argument.beginStructure();
165 argument >> entry.first >> entry.second;
166 argument.endStructure();
167 return argument;
168}
169
170/* QSpiDeviceEvent */
171/*---------------------------------------------------------------------------*/
172
173QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event) {
174 argument.beginStructure();
175 argument << event.type
176 << event.id
177 << event.hardwareCode
178 << event.modifiers
179 << event.timestamp
180 << event.text
181 << event.isText;
182 argument.endStructure();
183 return argument;
184}
185
186const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event) {
187 argument.beginStructure();
188 argument >> event.type
189 >> event.id
190 >> event.hardwareCode
191 >> event.modifiers
192 >> event.timestamp
193 >> event.text
194 >> event.isText;
195 argument.endStructure();
196 return argument;
197}
198
199void qSpiInitializeStructTypes()
200{
201 qDBusRegisterMetaType<QSpiIntList>();
202 qDBusRegisterMetaType<QSpiUIntList>();
203 qDBusRegisterMetaType<QSpiAccessibleCacheItem>();
204 qDBusRegisterMetaType<QSpiAccessibleCacheArray>();
205 qDBusRegisterMetaType<QSpiObjectReference>();
206 qDBusRegisterMetaType<QSpiObjectReferenceArray>();
207 qDBusRegisterMetaType<QSpiAttributeSet>();
208 qDBusRegisterMetaType<QSpiAction>();
209 qDBusRegisterMetaType<QSpiActionArray>();
210 qDBusRegisterMetaType<QSpiEventListener>();
211 qDBusRegisterMetaType<QSpiEventListenerArray>();
212 qDBusRegisterMetaType<QSpiDeviceEvent>();
213 qDBusRegisterMetaType<QSpiAppUpdate>();
214 qDBusRegisterMetaType<QSpiRelationArrayEntry>();
215 qDBusRegisterMetaType<QSpiRelationArray>();
216}
217
218QT_END_NAMESPACE
219#endif // QT_CONFIG(accessibility)
220

source code of qtbase/src/gui/accessible/linux/qspi_struct_marshallers.cpp