Qt 4.8
qscriptdebuggerresponse.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtSCriptTools 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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
43 #include "qscriptdebuggervalue_p.h"
44 
45 #include <QtScript/qscriptcontextinfo.h>
46 #include <QtCore/qdatastream.h>
47 
57 
59 
74 {
75 public:
78 
81  bool async;
82 };
83 
85 {
87  async = false;
88 }
89 
91 {
92 }
93 
96 {
97 }
98 
101 {
102  *d_ptr = *other.d_ptr;
103 }
104 
106 {
107 }
108 
110 {
111  *d_ptr = *other.d_ptr;
112  return *this;
113 }
114 
119 {
121  return d->error;
122 }
123 
128 {
130  d->error = error;
131 }
132 
138 {
140  return d->result;
141 }
142 
148 {
150  d->result = value;
151 }
152 
154 {
156  d->result = value;
157 }
158 
160 {
162  d->result = value;
163 }
164 
166 {
168  d->result = QVariant::fromValue(data);
169 }
170 
172 {
174  d->result = QVariant::fromValue(breakpoints);
175 }
176 
178 {
180  d->result = QVariant::fromValue(scripts);
181 }
182 
184 {
186  d->result = QVariant::fromValue(data);
187 }
188 
190 {
192  d->result = QVariant::fromValue(value);
193 }
194 
196 {
198  d->result = QVariant::fromValue(values);
199 }
200 
202 {
204  d->result = QVariant::fromValue(props);
205 }
206 
208 {
210  d->result = QVariant::fromValue(info);
211 }
212 
214 {
216  return d->result.toInt();
217 }
218 
220 {
222  return d->result.toLongLong();
223 }
224 
226 {
228  return d->result.toString();
229 }
230 
232 {
234  return qvariant_cast<QScriptBreakpointData>(d->result);
235 }
236 
238 {
240  return qvariant_cast<QScriptBreakpointMap>(d->result);
241 }
242 
244 {
246  return qvariant_cast<QScriptScriptMap>(d->result);
247 }
248 
250 {
252  return qvariant_cast<QScriptScriptData>(d->result);
253 }
254 
256 {
258  return qvariant_cast<QScriptDebuggerValue>(d->result);
259 }
260 
262 {
264  return qvariant_cast<QScriptDebuggerValueList>(d->result);
265 }
266 
268 {
271 }
272 
274 {
276  return qvariant_cast<QScriptContextInfo>(d->result);
277 }
278 
280 {
282  return d->async;
283 }
284 
286 {
288  d->async = async;
289 }
290 
296 {
298  const QScriptDebuggerResponsePrivate *od = other.d_func();
299  if (d == od)
300  return true;
301  if (!d || !od)
302  return false;
303  return ((d->error == od->error)
304  && (d->result == od->result)
305  && (d->async == od->async));
306 }
307 
313 {
314  return !(*this == other);
315 }
316 
327 {
328  const QScriptDebuggerResponsePrivate *d = response.d_ptr.data();
329  out << (quint32)d->error;
330  out << d->result;
331  out << d->async;
332  return out;
333 }
334 
346 {
348 
349  quint32 error;
350  in >> error;
352  in >> d->result;
353  in >> d->async;
354 
355  return in;
356 }
357 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
QScriptBreakpointMap resultAsBreakpoints() const
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
Error error() const
Returns the error code of this response.
QScriptScriptData resultAsScriptData() const
QScriptDebuggerValue resultAsScriptValue() const
T * data() const
Returns the value of the pointer referenced by this object.
The QScriptDebuggerResponse class represents a front-end&#39;s response to a QScriptDebuggerCommand.
QScriptDebuggerValuePropertyList resultAsScriptValuePropertyList() const
QScriptContextInfo resultAsContextInfo() const
The QString class provides a Unicode character string.
Definition: qstring.h:83
QScopedPointer< QScriptDebuggerResponsePrivate > d_ptr
#define Q_D(Class)
Definition: qglobal.h:2482
QScriptDebuggerResponse & operator=(const QScriptDebuggerResponse &other)
The QScriptScriptData class holds data associated with a script.
QScriptScriptMap resultAsScripts() const
QScriptBreakpointData resultAsBreakpointData() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QScriptDebuggerResponse::Error error
void setError(Error error)
Sets the error code of this response.
static const char * data(const QByteArray &arr)
__int64 qint64
Definition: qglobal.h:942
The QScriptBreakpointData class contains data associated with a breakpoint.
quint16 values[128]
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
Definition: qvariant.h:336
#define Q_DECLARE_METATYPE(TYPE)
This macro makes the type Type known to QMetaType as long as it provides a public default constructor...
Definition: qmetatype.h:265
bool operator!=(const QScriptDebuggerResponse &other) const
Returns true if this QScriptDebuggerResponse is not equal to the other response, otherwise returns fa...
bool operator==(const QScriptDebuggerResponse &other) const
Returns true if this QScriptDebuggerResponse is equal to the other response, otherwise returns false...
friend Q_AUTOTEST_EXPORT QDataStream & operator<<(QDataStream &, const QScriptDebuggerResponse &)
Writes the given response to the specified stream.
The QScriptDebuggerValue class represents a script value.
QScriptDebuggerValueList resultAsScriptValueList() const
The QScriptContextInfo class provides additional information about a QScriptContext.
void setResult(const QVariant &value)
Sets the Result attribute of this response to the given value.
unsigned int quint32
Definition: qglobal.h:938
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
friend Q_AUTOTEST_EXPORT QDataStream & operator>>(QDataStream &, QScriptDebuggerResponse &)
Reads a QScriptDebuggerResponse from the specified stream into the given response.
QVariant result() const
Returns the result of this response.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62