blob: 8f049519668759476d92cba58ce24ca144196f6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtSCriptTools module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qscriptdebuggerresponse_p.h"
#include "qscriptdebuggervalue_p.h"
#include <QtScript/qscriptcontextinfo.h>
#include <QtCore/qdatastream.h>
Q_DECLARE_METATYPE(QScriptBreakpointData)
Q_DECLARE_METATYPE(QScriptBreakpointMap)
Q_DECLARE_METATYPE(QScriptScriptData)
Q_DECLARE_METATYPE(QScriptScriptMap)
Q_DECLARE_METATYPE(QScriptDebuggerValue)
Q_DECLARE_METATYPE(QScriptDebuggerValueList)
Q_DECLARE_METATYPE(QScriptDebuggerValueProperty)
Q_DECLARE_METATYPE(QScriptDebuggerValuePropertyList)
Q_DECLARE_METATYPE(QScriptContextInfo)
QT_BEGIN_NAMESPACE
/*!
\since 4.5
\class QScriptDebuggerResponse
\internal
\brief The QScriptDebuggerResponse class represents a front-end's response to a QScriptDebuggerCommand.
A response contains an error code and result.
*/
class QScriptDebuggerResponsePrivate
{
public:
QScriptDebuggerResponsePrivate();
~QScriptDebuggerResponsePrivate();
QScriptDebuggerResponse::Error error;
QVariant result;
bool async;
};
QScriptDebuggerResponsePrivate::QScriptDebuggerResponsePrivate()
{
error = QScriptDebuggerResponse::NoError;
async = false;
}
QScriptDebuggerResponsePrivate::~QScriptDebuggerResponsePrivate()
{
}
QScriptDebuggerResponse::QScriptDebuggerResponse()
: d_ptr(new QScriptDebuggerResponsePrivate)
{
}
QScriptDebuggerResponse::QScriptDebuggerResponse(const QScriptDebuggerResponse &other)
: d_ptr(new QScriptDebuggerResponsePrivate)
{
*d_ptr = *other.d_ptr;
}
QScriptDebuggerResponse::~QScriptDebuggerResponse()
{
}
QScriptDebuggerResponse &QScriptDebuggerResponse::operator=(const QScriptDebuggerResponse &other)
{
*d_ptr = *other.d_ptr;
return *this;
}
/*!
Returns the error code of this response.
*/
QScriptDebuggerResponse::Error QScriptDebuggerResponse::error() const
{
Q_D(const QScriptDebuggerResponse);
return d->error;
}
/*!
Sets the \a error code of this response.
*/
void QScriptDebuggerResponse::setError(Error error)
{
Q_D(QScriptDebuggerResponse);
d->error = error;
}
/*!
Returns the result of this response. This function is provided for
convenience.
*/
QVariant QScriptDebuggerResponse::result() const
{
Q_D(const QScriptDebuggerResponse);
return d->result;
}
/*!
Sets the Result attribute of this response to the given \a
value. This function is provided for convenience.
*/
void QScriptDebuggerResponse::setResult(const QVariant &value)
{
Q_D(QScriptDebuggerResponse);
d->result = value;
}
void QScriptDebuggerResponse::setResult(int value)
{
Q_D(QScriptDebuggerResponse);
d->result = value;
}
void QScriptDebuggerResponse::setResult(const QString &value)
{
Q_D(QScriptDebuggerResponse);
d->result = value;
}
void QScriptDebuggerResponse::setResult(const QScriptBreakpointData &data)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(data);
}
void QScriptDebuggerResponse::setResult(const QScriptBreakpointMap &breakpoints)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(breakpoints);
}
void QScriptDebuggerResponse::setResult(const QScriptScriptMap &scripts)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(scripts);
}
void QScriptDebuggerResponse::setResult(const QScriptScriptData &data)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(data);
}
void QScriptDebuggerResponse::setResult(const QScriptDebuggerValue &value)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(value);
}
void QScriptDebuggerResponse::setResult(const QScriptDebuggerValueList &values)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(values);
}
void QScriptDebuggerResponse::setResult(const QScriptDebuggerValuePropertyList &props)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(props);
}
void QScriptDebuggerResponse::setResult(const QScriptContextInfo &info)
{
Q_D(QScriptDebuggerResponse);
d->result = qVariantFromValue(info);
}
int QScriptDebuggerResponse::resultAsInt() const
{
Q_D(const QScriptDebuggerResponse);
return d->result.toInt();
}
qint64 QScriptDebuggerResponse::resultAsLongLong() const
{
Q_D(const QScriptDebuggerResponse);
return d->result.toLongLong();
}
QString QScriptDebuggerResponse::resultAsString() const
{
Q_D(const QScriptDebuggerResponse);
return d->result.toString();
}
QScriptBreakpointData QScriptDebuggerResponse::resultAsBreakpointData() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptBreakpointData>(d->result);
}
QScriptBreakpointMap QScriptDebuggerResponse::resultAsBreakpoints() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptBreakpointMap>(d->result);
}
QScriptScriptMap QScriptDebuggerResponse::resultAsScripts() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptScriptMap>(d->result);
}
QScriptScriptData QScriptDebuggerResponse::resultAsScriptData() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptScriptData>(d->result);
}
QScriptDebuggerValue QScriptDebuggerResponse::resultAsScriptValue() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptDebuggerValue>(d->result);
}
QScriptDebuggerValueList QScriptDebuggerResponse::resultAsScriptValueList() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptDebuggerValueList>(d->result);
}
QScriptDebuggerValuePropertyList QScriptDebuggerResponse::resultAsScriptValuePropertyList() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptDebuggerValuePropertyList>(d->result);
}
QScriptContextInfo QScriptDebuggerResponse::resultAsContextInfo() const
{
Q_D(const QScriptDebuggerResponse);
return qvariant_cast<QScriptContextInfo>(d->result);
}
bool QScriptDebuggerResponse::async() const
{
Q_D(const QScriptDebuggerResponse);
return d->async;
}
void QScriptDebuggerResponse::setAsync(bool async)
{
Q_D(QScriptDebuggerResponse);
d->async = async;
}
/*!
Returns true if this QScriptDebuggerResponse is equal to the \a other
response, otherwise returns false.
*/
bool QScriptDebuggerResponse::operator==(const QScriptDebuggerResponse &other) const
{
Q_D(const QScriptDebuggerResponse);
const QScriptDebuggerResponsePrivate *od = other.d_func();
if (d == od)
return true;
if (!d || !od)
return false;
return ((d->error == od->error)
&& (d->result == od->result)
&& (d->async == od->async));
}
/*!
Returns true if this QScriptDebuggerResponse is not equal to the \a
other response, otherwise returns false.
*/
bool QScriptDebuggerResponse::operator!=(const QScriptDebuggerResponse &other) const
{
return !(*this == other);
}
/*!
\fn QDataStream &operator<<(QDataStream &stream, const QScriptDebuggerResponse &response)
\relates QScriptDebuggerResponse
Writes the given \a response to the specified \a stream.
*/
QDataStream &operator<<(QDataStream &out, const QScriptDebuggerResponse &response)
{
const QScriptDebuggerResponsePrivate *d = response.d_ptr.data();
out << (quint32)d->error;
out << d->result;
out << d->async;
return out;
}
/*!
\fn QDataStream &operator>>(QDataStream &stream, QScriptDebuggerResponse &response)
\relates QScriptDebuggerResponse
Reads a QScriptDebuggerResponse from the specified \a stream into the
given \a response.
*/
QDataStream &operator>>(QDataStream &in, QScriptDebuggerResponse &response)
{
QScriptDebuggerResponsePrivate *d = response.d_ptr.data();
quint32 error;
in >> error;
d->error = QScriptDebuggerResponse::Error(error);
in >> d->result;
in >> d->async;
return in;
}
QT_END_NAMESPACE
|