1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#include "struct_marshallers_p.h"
42
43#include <atspi/atspi-constants.h>
44#include <QtCore/qdebug.h>
45#include <QtDBus/qdbusmetatype.h>
46
47#include "bridge_p.h"
48
49#ifndef QT_NO_ACCESSIBILITY
50QT_BEGIN_NAMESPACE
51
52QSpiObjectReference::QSpiObjectReference()
53 : path(QDBusObjectPath(ATSPI_DBUS_PATH_NULL))
54{}
55
56/* QSpiAccessibleCacheArray */
57/*---------------------------------------------------------------------------*/
58
59QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item)
60{
61 argument.beginStructure();
62 argument << item.path;
63 argument << item.application;
64 argument << item.parent;
65 argument << item.children;
66 argument << item.supportedInterfaces;
67 argument << item.name;
68 argument << item.role;
69 argument << item.description;
70 argument << item.state;
71 argument.endStructure();
72 return argument;
73}
74
75const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item)
76{
77 argument.beginStructure();
78 argument >> item.path;
79 argument >> item.application;
80 argument >> item.parent;
81 argument >> item.children;
82 argument >> item.supportedInterfaces;
83 argument >> item.name;
84 argument >> item.role;
85 argument >> item.description;
86 argument >> item.state;
87 argument.endStructure();
88 return argument;
89}
90
91/* QSpiObjectReference */
92/*---------------------------------------------------------------------------*/
93
94QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address)
95{
96 argument.beginStructure();
97 argument << address.service;
98 argument << address.path;
99 argument.endStructure();
100 return argument;
101}
102
103const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address)
104{
105 argument.beginStructure();
106 argument >> address.service;
107 argument >> address.path;
108 argument.endStructure();
109 return argument;
110}
111
112/* QSpiAction */
113/*---------------------------------------------------------------------------*/
114
115QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action)
116{
117 argument.beginStructure();
118 argument << action.name;
119 argument << action.description;
120 argument << action.keyBinding;
121 argument.endStructure();
122 return argument;
123}
124
125const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action)
126{
127 argument.beginStructure();
128 argument >> action.name;
129 argument >> action.description;
130 argument >> action.keyBinding;
131 argument.endStructure();
132 return argument;
133}
134
135
136QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &ev)
137{
138 argument.beginStructure();
139 argument << ev.listenerAddress;
140 argument << ev.eventName;
141 argument.endStructure();
142 return argument;
143}
144
145const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &ev)
146{
147 argument.beginStructure();
148 argument >> ev.listenerAddress;
149 argument >> ev.eventName;
150 argument.endStructure();
151 return argument;
152}
153
154/* QSpiAppUpdate */
155/*---------------------------------------------------------------------------*/
156
157QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update) {
158 argument.beginStructure();
159 argument << update.type << update.address;
160 argument.endStructure();
161 return argument;
162}
163
164const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update) {
165 argument.beginStructure();
166 argument >> update.type >> update.address;
167 argument.endStructure();
168 return argument;
169}
170
171/* QSpiRelationArrayEntry */
172/*---------------------------------------------------------------------------*/
173
174QDBusArgument &operator<<(QDBusArgument &argument, const QSpiRelationArrayEntry &entry) {
175 argument.beginStructure();
176 argument << entry.first << entry.second;
177 argument.endStructure();
178 return argument;
179}
180
181const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiRelationArrayEntry &entry) {
182 argument.beginStructure();
183 argument >> entry.first >> entry.second;
184 argument.endStructure();
185 return argument;
186}
187
188/* QSpiDeviceEvent */
189/*---------------------------------------------------------------------------*/
190
191QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event) {
192 argument.beginStructure();
193 argument << event.type
194 << event.id
195 << event.hardwareCode
196 << event.modifiers
197 << event.timestamp
198 << event.text
199 << event.isText;
200 argument.endStructure();
201 return argument;
202}
203
204const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event) {
205 argument.beginStructure();
206 argument >> event.type
207 >> event.id
208 >> event.hardwareCode
209 >> event.modifiers
210 >> event.timestamp
211 >> event.text
212 >> event.isText;
213 argument.endStructure();
214 return argument;
215}
216
217void qSpiInitializeStructTypes()
218{
219 qDBusRegisterMetaType<QSpiIntList>();
220 qDBusRegisterMetaType<QSpiUIntList>();
221 qDBusRegisterMetaType<QSpiAccessibleCacheItem>();
222 qDBusRegisterMetaType<QSpiAccessibleCacheArray>();
223 qDBusRegisterMetaType<QSpiObjectReference>();
224 qDBusRegisterMetaType<QSpiObjectReferenceArray>();
225 qDBusRegisterMetaType<QSpiAttributeSet>();
226 qDBusRegisterMetaType<QSpiAction>();
227 qDBusRegisterMetaType<QSpiActionArray>();
228 qDBusRegisterMetaType<QSpiEventListener>();
229 qDBusRegisterMetaType<QSpiEventListenerArray>();
230 qDBusRegisterMetaType<QSpiDeviceEvent>();
231 qDBusRegisterMetaType<QSpiAppUpdate>();
232 qDBusRegisterMetaType<QSpiRelationArrayEntry>();
233 qDBusRegisterMetaType<QSpiRelationArray>();
234}
235
236QT_END_NAMESPACE
237#endif //QT_NO_ACCESSIBILITY
238

source code of qtbase/src/platformsupport/linuxaccessibility/struct_marshallers.cpp