1/****************************************************************************
2**
3** Copyright (C) 2018 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
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 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#ifndef QSCRIPTDEBUGGERCOMMAND_P_H
41#define QSCRIPTDEBUGGERCOMMAND_P_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include <QtCore/qobjectdefs.h>
55#include <QtCore/qscopedpointer.h>
56#include <QtCore/qhash.h>
57#include <QtCore/qvariant.h>
58
59QT_BEGIN_NAMESPACE
60
61class QDataStream;
62class QScriptBreakpointData;
63class QScriptDebuggerValue;
64
65class QScriptDebuggerCommandPrivate;
66class Q_AUTOTEST_EXPORT QScriptDebuggerCommand
67{
68public:
69 friend Q_AUTOTEST_EXPORT QDataStream &operator<<(QDataStream &, const QScriptDebuggerCommand &);
70 friend Q_AUTOTEST_EXPORT QDataStream &operator>>(QDataStream &, QScriptDebuggerCommand &);
71
72 enum Type {
73 None,
74
75 Interrupt,
76 Continue,
77 StepInto,
78 StepOver,
79 StepOut,
80 RunToLocation,
81 RunToLocationByID,
82 ForceReturn,
83 Resume,
84
85 SetBreakpoint,
86 DeleteBreakpoint,
87 DeleteAllBreakpoints,
88 GetBreakpoints,
89 GetBreakpointData,
90 SetBreakpointData,
91
92 GetScripts,
93 GetScriptData,
94 ScriptsCheckpoint,
95 GetScriptsDelta,
96 ResolveScript,
97
98 GetBacktrace,
99 GetContextCount,
100 GetContextInfo,
101 GetContextState,
102 GetContextID,
103 GetThisObject,
104 GetActivationObject,
105 GetScopeChain,
106 ContextsCheckpoint,
107 GetPropertyExpressionValue,
108 GetCompletions,
109
110 NewScriptObjectSnapshot,
111 ScriptObjectSnapshotCapture,
112 DeleteScriptObjectSnapshot,
113
114 NewScriptValueIterator,
115 GetPropertiesByIterator,
116 DeleteScriptValueIterator,
117
118 Evaluate,
119
120 SetScriptValueProperty,
121 ScriptValueToString,
122
123 ClearExceptions,
124
125 UserCommand = 1000,
126 MaxUserCommand = 32767
127 };
128
129 enum Attribute {
130 ScriptID,
131 FileName,
132 LineNumber,
133 Program,
134 BreakpointID,
135 BreakpointData,
136 ContextIndex,
137 ScriptValue,
138 StepCount,
139 IteratorID,
140 Name,
141 SubordinateScriptValue,
142 SnapshotID,
143 UserAttribute = 1000,
144 MaxUserAttribute = 32767
145 };
146
147 QScriptDebuggerCommand();
148 QScriptDebuggerCommand(Type type);
149 QScriptDebuggerCommand(const QScriptDebuggerCommand &other);
150 ~QScriptDebuggerCommand();
151
152 Type type() const;
153
154 QVariant attribute(Attribute attribute, const QVariant &defaultValue = QVariant()) const;
155 void setAttribute(Attribute attribute, const QVariant &value);
156 QHash<Attribute, QVariant> attributes() const;
157
158 QString fileName() const;
159 void setFileName(const QString &fileName);
160
161 int lineNumber() const;
162 void setLineNumber(int lineNumber);
163
164 qint64 scriptId() const;
165 void setScriptId(qint64 id);
166
167 QString program() const;
168 void setProgram(const QString &program);
169
170 int breakpointId() const;
171 void setBreakpointId(int id);
172
173 QScriptBreakpointData breakpointData() const;
174 void setBreakpointData(const QScriptBreakpointData &data);
175
176 QScriptDebuggerValue scriptValue() const;
177 void setScriptValue(const QScriptDebuggerValue &value);
178
179 int contextIndex() const;
180 void setContextIndex(int index);
181
182 int iteratorId() const;
183 void setIteratorId(int id);
184
185 QString name() const;
186 void setName(const QString &name);
187
188 QScriptDebuggerValue subordinateScriptValue() const;
189 void setSubordinateScriptValue(const QScriptDebuggerValue &value);
190
191 int snapshotId() const;
192 void setSnapshotId(int id);
193
194 QScriptDebuggerCommand &operator=(const QScriptDebuggerCommand &other);
195
196 bool operator==(const QScriptDebuggerCommand &other) const;
197 bool operator!=(const QScriptDebuggerCommand &other) const;
198
199 static QScriptDebuggerCommand interruptCommand();
200 static QScriptDebuggerCommand continueCommand();
201 static QScriptDebuggerCommand stepIntoCommand(int count = 1);
202 static QScriptDebuggerCommand stepOverCommand(int count = 1);
203 static QScriptDebuggerCommand stepOutCommand();
204 static QScriptDebuggerCommand runToLocationCommand(const QString &fileName, int lineNumber);
205 static QScriptDebuggerCommand runToLocationCommand(qint64 scriptId, int lineNumber);
206 static QScriptDebuggerCommand forceReturnCommand(int contextIndex, const QScriptDebuggerValue &value);
207 static QScriptDebuggerCommand resumeCommand();
208
209 static QScriptDebuggerCommand setBreakpointCommand(const QString &fileName, int lineNumber);
210 static QScriptDebuggerCommand setBreakpointCommand(const QScriptBreakpointData &data);
211 static QScriptDebuggerCommand deleteBreakpointCommand(int id);
212 static QScriptDebuggerCommand deleteAllBreakpointsCommand();
213 static QScriptDebuggerCommand getBreakpointsCommand();
214 static QScriptDebuggerCommand getBreakpointDataCommand(int id);
215 static QScriptDebuggerCommand setBreakpointDataCommand(int id, const QScriptBreakpointData &data);
216
217 static QScriptDebuggerCommand getScriptsCommand();
218 static QScriptDebuggerCommand getScriptDataCommand(qint64 id);
219 static QScriptDebuggerCommand scriptsCheckpointCommand();
220 static QScriptDebuggerCommand getScriptsDeltaCommand();
221 static QScriptDebuggerCommand resolveScriptCommand(const QString &fileName);
222
223 static QScriptDebuggerCommand getBacktraceCommand();
224 static QScriptDebuggerCommand getContextCountCommand();
225 static QScriptDebuggerCommand getContextStateCommand(int contextIndex);
226 static QScriptDebuggerCommand getContextInfoCommand(int contextIndex);
227 static QScriptDebuggerCommand getContextIdCommand(int contextIndex);
228 static QScriptDebuggerCommand getThisObjectCommand(int contextIndex);
229 static QScriptDebuggerCommand getActivationObjectCommand(int contextIndex);
230 static QScriptDebuggerCommand getScopeChainCommand(int contextIndex);
231 static QScriptDebuggerCommand contextsCheckpoint();
232 static QScriptDebuggerCommand getPropertyExpressionValue(int contextIndex, int lineNumber,
233 const QStringList &path);
234 static QScriptDebuggerCommand getCompletions(int contextIndex, const QStringList &path);
235
236 static QScriptDebuggerCommand newScriptObjectSnapshotCommand();
237 static QScriptDebuggerCommand scriptObjectSnapshotCaptureCommand(int id, const QScriptDebuggerValue &object);
238 static QScriptDebuggerCommand deleteScriptObjectSnapshotCommand(int id);
239
240 static QScriptDebuggerCommand newScriptValueIteratorCommand(const QScriptDebuggerValue &object);
241 static QScriptDebuggerCommand getPropertiesByIteratorCommand(int id, int count);
242 static QScriptDebuggerCommand deleteScriptValueIteratorCommand(int id);
243
244 static QScriptDebuggerCommand evaluateCommand(int contextIndex, const QString &program,
245 const QString &fileName = QString(),
246 int lineNumber = 1);
247
248 static QScriptDebuggerCommand setScriptValuePropertyCommand(const QScriptDebuggerValue &object,
249 const QString &name,
250 const QScriptDebuggerValue &value);
251 static QScriptDebuggerCommand scriptValueToStringCommand(const QScriptDebuggerValue &value);
252
253 static QScriptDebuggerCommand clearExceptionsCommand();
254
255private:
256 QScopedPointer<QScriptDebuggerCommandPrivate> d_ptr;
257
258 Q_DECLARE_PRIVATE(QScriptDebuggerCommand)
259};
260
261Q_AUTOTEST_EXPORT QDataStream &operator<<(QDataStream &, const QScriptDebuggerCommand &);
262Q_AUTOTEST_EXPORT QDataStream &operator>>(QDataStream &, QScriptDebuggerCommand &);
263
264QT_END_NAMESPACE
265
266#endif
267

source code of qtscript/src/scripttools/debugging/qscriptdebuggercommand_p.h