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#include "qscriptdebuggercommandschedulerfrontend_p.h"
41#include "qscriptdebuggercommandschedulerinterface_p.h"
42#include "qscriptdebuggercommand_p.h"
43
44QT_BEGIN_NAMESPACE
45
46QScriptDebuggerCommandSchedulerFrontend::QScriptDebuggerCommandSchedulerFrontend(
47 QScriptDebuggerCommandSchedulerInterface *scheduler,
48 QScriptDebuggerResponseHandlerInterface *responseHandler)
49 : m_scheduler(scheduler), m_responseHandler(responseHandler)
50{
51}
52
53QScriptDebuggerCommandSchedulerFrontend::~QScriptDebuggerCommandSchedulerFrontend()
54{
55}
56
57int QScriptDebuggerCommandSchedulerFrontend::scheduleCommand(const QScriptDebuggerCommand &command)
58{
59 return m_scheduler->scheduleCommand(command, responseHandler: m_responseHandler);
60}
61
62/*!
63 Instructs the front-end to break at the next script statement, and
64 returns a unique identifier associated with this command.
65
66 When the next script statement is encountered, the client will be
67 notified, and the front-end will be ready to accept commands.
68
69 \sa scheduleContinue()
70*/
71int QScriptDebuggerCommandSchedulerFrontend::scheduleInterrupt()
72{
73 return scheduleCommand(command: QScriptDebuggerCommand::interruptCommand());
74}
75
76/*!
77 Instructs the front-end to continue evaluation, and returns a unique
78 identifier associated with this command.
79
80 \sa scheduleBreak()
81*/
82int QScriptDebuggerCommandSchedulerFrontend::scheduleContinue()
83{
84 return scheduleCommand(command: QScriptDebuggerCommand::continueCommand());
85}
86
87/*!
88 Instructs the front-end to step into the next script statement, and
89 returns a unique identifier associated with this command.
90
91 Evaluation will automatically be continued, and the client()'s event()
92 function will be called when the statement has been stepped into.
93*/
94int QScriptDebuggerCommandSchedulerFrontend::scheduleStepInto(int count)
95{
96 return scheduleCommand(command: QScriptDebuggerCommand::stepIntoCommand(count));
97}
98
99/*!
100 Instructs the front-end to step over the next script statement, and
101 returns a unique identifier associated with this command.
102
103 Evaluation will automatically be continued, and the client()'s event()
104 function will be called when the statement has been stepped over.
105*/
106int QScriptDebuggerCommandSchedulerFrontend::scheduleStepOver(int count)
107{
108 return scheduleCommand(command: QScriptDebuggerCommand::stepOverCommand(count));
109}
110
111/*!
112 Instructs the front-end to step out of the current script function, and
113 returns a unique identifier associated with this command.
114
115 Evaluation will automatically be continued, and the client()'s
116 event() function will be called when the script function has been
117 stepped out of.
118*/
119int QScriptDebuggerCommandSchedulerFrontend::scheduleStepOut()
120{
121 return scheduleCommand(command: QScriptDebuggerCommand::stepOutCommand());
122}
123
124/*!
125 Instructs the front-end to continue evaluation until the location
126 specified by the given \a fileName and \a lineNumber is reached.
127*/
128int QScriptDebuggerCommandSchedulerFrontend::scheduleRunToLocation(const QString &fileName, int lineNumber)
129{
130 return scheduleCommand(command: QScriptDebuggerCommand::runToLocationCommand(fileName, lineNumber));
131}
132
133/*!
134 Instructs the front-end to continue evaluation until the location
135 specified by the given \a scriptId and \a lineNumber is reached.
136*/
137int QScriptDebuggerCommandSchedulerFrontend::scheduleRunToLocation(qint64 scriptId, int lineNumber)
138{
139 return scheduleCommand(command: QScriptDebuggerCommand::runToLocationCommand(scriptId, lineNumber));
140}
141
142int QScriptDebuggerCommandSchedulerFrontend::scheduleForceReturn(int contextIndex, const QScriptDebuggerValue &value)
143{
144 return scheduleCommand(command: QScriptDebuggerCommand::forceReturnCommand(contextIndex, value));
145}
146
147int QScriptDebuggerCommandSchedulerFrontend::scheduleSetBreakpoint(const QString &fileName, int lineNumber)
148{
149 return scheduleCommand(command: QScriptDebuggerCommand::setBreakpointCommand(fileName, lineNumber));
150}
151
152int QScriptDebuggerCommandSchedulerFrontend::scheduleSetBreakpoint(const QScriptBreakpointData &data)
153{
154 return scheduleCommand(command: QScriptDebuggerCommand::setBreakpointCommand(data));
155}
156
157int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteBreakpoint(int id)
158{
159 return scheduleCommand(command: QScriptDebuggerCommand::deleteBreakpointCommand(id));
160}
161
162int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteAllBreakpoints()
163{
164 return scheduleCommand(command: QScriptDebuggerCommand::deleteAllBreakpointsCommand());
165}
166
167int QScriptDebuggerCommandSchedulerFrontend::scheduleGetBreakpoints()
168{
169 return scheduleCommand(command: QScriptDebuggerCommand::getBreakpointsCommand());
170}
171
172int QScriptDebuggerCommandSchedulerFrontend::scheduleGetBreakpointData(int id)
173{
174 return scheduleCommand(command: QScriptDebuggerCommand::getBreakpointDataCommand(id));
175}
176
177int QScriptDebuggerCommandSchedulerFrontend::scheduleSetBreakpointData(int id, const QScriptBreakpointData &data)
178{
179 return scheduleCommand(command: QScriptDebuggerCommand::setBreakpointDataCommand(id, data));
180}
181
182int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScripts()
183{
184 return scheduleCommand(command: QScriptDebuggerCommand::getScriptsCommand());
185}
186
187int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScriptData(qint64 id)
188{
189 return scheduleCommand(command: QScriptDebuggerCommand::getScriptDataCommand(id));
190}
191
192int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptsCheckpoint()
193{
194 return scheduleCommand(command: QScriptDebuggerCommand::scriptsCheckpointCommand());
195}
196
197int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScriptsDelta()
198{
199 return scheduleCommand(command: QScriptDebuggerCommand::getScriptsDeltaCommand());
200}
201
202int QScriptDebuggerCommandSchedulerFrontend::scheduleResolveScript(const QString &fileName)
203{
204 return scheduleCommand(command: QScriptDebuggerCommand::resolveScriptCommand(fileName));
205}
206
207int QScriptDebuggerCommandSchedulerFrontend::scheduleGetBacktrace()
208{
209 return scheduleCommand(command: QScriptDebuggerCommand::getBacktraceCommand());
210}
211
212int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextCount()
213{
214 return scheduleCommand(command: QScriptDebuggerCommand::getContextCountCommand());
215}
216
217int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextState(int contextIndex)
218{
219 return scheduleCommand(command: QScriptDebuggerCommand::getContextStateCommand(contextIndex));
220}
221
222int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextInfo(int contextIndex)
223{
224 return scheduleCommand(command: QScriptDebuggerCommand::getContextInfoCommand(contextIndex));
225}
226
227int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextId(int contextIndex)
228{
229 return scheduleCommand(command: QScriptDebuggerCommand::getContextIdCommand(contextIndex));
230}
231
232int QScriptDebuggerCommandSchedulerFrontend::scheduleGetThisObject(int contextIndex)
233{
234 return scheduleCommand(command: QScriptDebuggerCommand::getThisObjectCommand(contextIndex));
235}
236
237int QScriptDebuggerCommandSchedulerFrontend::scheduleGetActivationObject(int contextIndex)
238{
239 return scheduleCommand(command: QScriptDebuggerCommand::getActivationObjectCommand(contextIndex));
240}
241
242int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScopeChain(int contextIndex)
243{
244 return scheduleCommand(command: QScriptDebuggerCommand::getScopeChainCommand(contextIndex));
245}
246
247int QScriptDebuggerCommandSchedulerFrontend::scheduleContextsCheckpoint()
248{
249 return scheduleCommand(command: QScriptDebuggerCommand::contextsCheckpoint());
250}
251
252int QScriptDebuggerCommandSchedulerFrontend::scheduleGetPropertyExpressionValue(
253 int contextIndex, int lineNumber, const QStringList &path)
254{
255 return scheduleCommand(command: QScriptDebuggerCommand::getPropertyExpressionValue(contextIndex, lineNumber, path));
256}
257
258int QScriptDebuggerCommandSchedulerFrontend::scheduleGetCompletions(int contextIndex, const QStringList &path)
259{
260 return scheduleCommand(command: QScriptDebuggerCommand::getCompletions(contextIndex, path));
261}
262
263int QScriptDebuggerCommandSchedulerFrontend::scheduleEvaluate(int contextIndex,
264 const QString &program,
265 const QString &fileName,
266 int lineNumber)
267{
268 return scheduleCommand(command: QScriptDebuggerCommand::evaluateCommand(contextIndex, program, fileName, lineNumber));
269}
270
271int QScriptDebuggerCommandSchedulerFrontend::scheduleNewScriptValueIterator(const QScriptDebuggerValue &object)
272{
273 return scheduleCommand(command: QScriptDebuggerCommand::newScriptValueIteratorCommand(object));
274}
275
276int QScriptDebuggerCommandSchedulerFrontend::scheduleGetPropertiesByIterator(int id, int count)
277{
278 return scheduleCommand(command: QScriptDebuggerCommand::getPropertiesByIteratorCommand(id, count));
279}
280
281int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteScriptValueIterator(int id)
282{
283 return scheduleCommand(command: QScriptDebuggerCommand::deleteScriptValueIteratorCommand(id));
284}
285
286int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptValueToString(const QScriptDebuggerValue &value)
287{
288 return scheduleCommand(command: QScriptDebuggerCommand::scriptValueToStringCommand(value));
289}
290
291int QScriptDebuggerCommandSchedulerFrontend::scheduleSetScriptValueProperty(const QScriptDebuggerValue &object,
292 const QString &name,
293 const QScriptDebuggerValue &value)
294{
295 return scheduleCommand(command: QScriptDebuggerCommand::setScriptValuePropertyCommand(object, name, value));
296}
297
298int QScriptDebuggerCommandSchedulerFrontend::scheduleClearExceptions()
299{
300 return scheduleCommand(command: QScriptDebuggerCommand::clearExceptionsCommand());
301}
302
303int QScriptDebuggerCommandSchedulerFrontend::scheduleNewScriptObjectSnapshot()
304{
305 return scheduleCommand(command: QScriptDebuggerCommand::newScriptObjectSnapshotCommand());
306}
307
308int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptObjectSnapshotCapture(int id, const QScriptDebuggerValue &object)
309{
310 return scheduleCommand(command: QScriptDebuggerCommand::scriptObjectSnapshotCaptureCommand(id, object));
311}
312
313int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteScriptObjectSnapshot(int id)
314{
315 return scheduleCommand(command: QScriptDebuggerCommand::deleteScriptObjectSnapshotCommand(id));
316}
317
318QT_END_NAMESPACE
319

source code of qtscript/src/scripttools/debugging/qscriptdebuggercommandschedulerfrontend.cpp