| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the QtSCriptTools module of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial Usage | 
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and Nokia. | 
|---|
| 14 | ** | 
|---|
| 15 | ** GNU Lesser General Public License Usage | 
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 19 | ** packaging of this file.  Please review the following information to | 
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 22 | ** | 
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 26 | ** package. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please | 
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | #include "qscriptdebuggercommandschedulerfrontend_p.h" | 
|---|
| 43 | #include "qscriptdebuggercommandschedulerinterface_p.h" | 
|---|
| 44 | #include "qscriptdebuggercommand_p.h" | 
|---|
| 45 |  | 
|---|
| 46 | QT_BEGIN_NAMESPACE | 
|---|
| 47 |  | 
|---|
| 48 | QScriptDebuggerCommandSchedulerFrontend::QScriptDebuggerCommandSchedulerFrontend( | 
|---|
| 49 | QScriptDebuggerCommandSchedulerInterface *scheduler, | 
|---|
| 50 | QScriptDebuggerResponseHandlerInterface *responseHandler) | 
|---|
| 51 | : m_scheduler(scheduler), m_responseHandler(responseHandler) | 
|---|
| 52 | { | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 | QScriptDebuggerCommandSchedulerFrontend::~QScriptDebuggerCommandSchedulerFrontend() | 
|---|
| 56 | { | 
|---|
| 57 | } | 
|---|
| 58 |  | 
|---|
| 59 | int QScriptDebuggerCommandSchedulerFrontend::scheduleCommand(const QScriptDebuggerCommand &command) | 
|---|
| 60 | { | 
|---|
| 61 | return m_scheduler->scheduleCommand(command, m_responseHandler); | 
|---|
| 62 | } | 
|---|
| 63 |  | 
|---|
| 64 | /*! | 
|---|
| 65 | Instructs the front-end to break at the next script statement, and | 
|---|
| 66 | returns a unique identifier associated with this command. | 
|---|
| 67 |  | 
|---|
| 68 | When the next script statement is encountered, the client will be | 
|---|
| 69 | notified, and the front-end will be ready to accept commands. | 
|---|
| 70 |  | 
|---|
| 71 | \sa scheduleContinue() | 
|---|
| 72 | */ | 
|---|
| 73 | int QScriptDebuggerCommandSchedulerFrontend::scheduleInterrupt() | 
|---|
| 74 | { | 
|---|
| 75 | return scheduleCommand(QScriptDebuggerCommand::interruptCommand()); | 
|---|
| 76 | } | 
|---|
| 77 |  | 
|---|
| 78 | /*! | 
|---|
| 79 | Instructs the front-end to continue evaluation, and returns a unique | 
|---|
| 80 | identifier associated with this command. | 
|---|
| 81 |  | 
|---|
| 82 | \sa scheduleBreak() | 
|---|
| 83 | */ | 
|---|
| 84 | int QScriptDebuggerCommandSchedulerFrontend::scheduleContinue() | 
|---|
| 85 | { | 
|---|
| 86 | return scheduleCommand(QScriptDebuggerCommand::continueCommand()); | 
|---|
| 87 | } | 
|---|
| 88 |  | 
|---|
| 89 | /*! | 
|---|
| 90 | Instructs the front-end to step into the next script statement, and | 
|---|
| 91 | returns a unique identifier associated with this command. | 
|---|
| 92 |  | 
|---|
| 93 | Evaluation will automatically be continued, and the client()'s event() | 
|---|
| 94 | function will be called when the statement has been stepped into. | 
|---|
| 95 | */ | 
|---|
| 96 | int QScriptDebuggerCommandSchedulerFrontend::scheduleStepInto(int count) | 
|---|
| 97 | { | 
|---|
| 98 | return scheduleCommand(QScriptDebuggerCommand::stepIntoCommand(count)); | 
|---|
| 99 | } | 
|---|
| 100 |  | 
|---|
| 101 | /*! | 
|---|
| 102 | Instructs the front-end to step over the next script statement, and | 
|---|
| 103 | returns a unique identifier associated with this command. | 
|---|
| 104 |  | 
|---|
| 105 | Evaluation will automatically be continued, and the client()'s event() | 
|---|
| 106 | function will be called when the statement has been stepped over. | 
|---|
| 107 | */ | 
|---|
| 108 | int QScriptDebuggerCommandSchedulerFrontend::scheduleStepOver(int count) | 
|---|
| 109 | { | 
|---|
| 110 | return scheduleCommand(QScriptDebuggerCommand::stepOverCommand(count)); | 
|---|
| 111 | } | 
|---|
| 112 |  | 
|---|
| 113 | /*! | 
|---|
| 114 | Instructs the front-end to step out of the current script function, and | 
|---|
| 115 | returns a unique identifier associated with this command. | 
|---|
| 116 |  | 
|---|
| 117 | Evaluation will automatically be continued, and the client()'s | 
|---|
| 118 | event() function will be called when the script function has been | 
|---|
| 119 | stepped out of. | 
|---|
| 120 | */ | 
|---|
| 121 | int QScriptDebuggerCommandSchedulerFrontend::scheduleStepOut() | 
|---|
| 122 | { | 
|---|
| 123 | return scheduleCommand(QScriptDebuggerCommand::stepOutCommand()); | 
|---|
| 124 | } | 
|---|
| 125 |  | 
|---|
| 126 | /*! | 
|---|
| 127 | Instructs the front-end to continue evaluation until the location | 
|---|
| 128 | specified by the given \a fileName and \a lineNumber is reached. | 
|---|
| 129 | */ | 
|---|
| 130 | int QScriptDebuggerCommandSchedulerFrontend::scheduleRunToLocation(const QString &fileName, int lineNumber) | 
|---|
| 131 | { | 
|---|
| 132 | return scheduleCommand(QScriptDebuggerCommand::runToLocationCommand(fileName, lineNumber)); | 
|---|
| 133 | } | 
|---|
| 134 |  | 
|---|
| 135 | /*! | 
|---|
| 136 | Instructs the front-end to continue evaluation until the location | 
|---|
| 137 | specified by the given \a scriptId and \a lineNumber is reached. | 
|---|
| 138 | */ | 
|---|
| 139 | int QScriptDebuggerCommandSchedulerFrontend::scheduleRunToLocation(qint64 scriptId, int lineNumber) | 
|---|
| 140 | { | 
|---|
| 141 | return scheduleCommand(QScriptDebuggerCommand::runToLocationCommand(scriptId, lineNumber)); | 
|---|
| 142 | } | 
|---|
| 143 |  | 
|---|
| 144 | int QScriptDebuggerCommandSchedulerFrontend::scheduleForceReturn(int contextIndex, const QScriptDebuggerValue &value) | 
|---|
| 145 | { | 
|---|
| 146 | return scheduleCommand(QScriptDebuggerCommand::forceReturnCommand(contextIndex, value)); | 
|---|
| 147 | } | 
|---|
| 148 |  | 
|---|
| 149 | int QScriptDebuggerCommandSchedulerFrontend::scheduleSetBreakpoint(const QString &fileName, int lineNumber) | 
|---|
| 150 | { | 
|---|
| 151 | return scheduleCommand(QScriptDebuggerCommand::setBreakpointCommand(fileName, lineNumber)); | 
|---|
| 152 | } | 
|---|
| 153 |  | 
|---|
| 154 | int QScriptDebuggerCommandSchedulerFrontend::scheduleSetBreakpoint(const QScriptBreakpointData &data) | 
|---|
| 155 | { | 
|---|
| 156 | return scheduleCommand(QScriptDebuggerCommand::setBreakpointCommand(data)); | 
|---|
| 157 | } | 
|---|
| 158 |  | 
|---|
| 159 | int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteBreakpoint(int id) | 
|---|
| 160 | { | 
|---|
| 161 | return scheduleCommand(QScriptDebuggerCommand::deleteBreakpointCommand(id)); | 
|---|
| 162 | } | 
|---|
| 163 |  | 
|---|
| 164 | int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteAllBreakpoints() | 
|---|
| 165 | { | 
|---|
| 166 | return scheduleCommand(QScriptDebuggerCommand::deleteAllBreakpointsCommand()); | 
|---|
| 167 | } | 
|---|
| 168 |  | 
|---|
| 169 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetBreakpoints() | 
|---|
| 170 | { | 
|---|
| 171 | return scheduleCommand(QScriptDebuggerCommand::getBreakpointsCommand()); | 
|---|
| 172 | } | 
|---|
| 173 |  | 
|---|
| 174 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetBreakpointData(int id) | 
|---|
| 175 | { | 
|---|
| 176 | return scheduleCommand(QScriptDebuggerCommand::getBreakpointDataCommand(id)); | 
|---|
| 177 | } | 
|---|
| 178 |  | 
|---|
| 179 | int QScriptDebuggerCommandSchedulerFrontend::scheduleSetBreakpointData(int id, const QScriptBreakpointData &data) | 
|---|
| 180 | { | 
|---|
| 181 | return scheduleCommand(QScriptDebuggerCommand::setBreakpointDataCommand(id, data)); | 
|---|
| 182 | } | 
|---|
| 183 |  | 
|---|
| 184 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScripts() | 
|---|
| 185 | { | 
|---|
| 186 | return scheduleCommand(QScriptDebuggerCommand::getScriptsCommand()); | 
|---|
| 187 | } | 
|---|
| 188 |  | 
|---|
| 189 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScriptData(qint64 id) | 
|---|
| 190 | { | 
|---|
| 191 | return scheduleCommand(QScriptDebuggerCommand::getScriptDataCommand(id)); | 
|---|
| 192 | } | 
|---|
| 193 |  | 
|---|
| 194 | int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptsCheckpoint() | 
|---|
| 195 | { | 
|---|
| 196 | return scheduleCommand(QScriptDebuggerCommand::scriptsCheckpointCommand()); | 
|---|
| 197 | } | 
|---|
| 198 |  | 
|---|
| 199 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScriptsDelta() | 
|---|
| 200 | { | 
|---|
| 201 | return scheduleCommand(QScriptDebuggerCommand::getScriptsDeltaCommand()); | 
|---|
| 202 | } | 
|---|
| 203 |  | 
|---|
| 204 | int QScriptDebuggerCommandSchedulerFrontend::scheduleResolveScript(const QString &fileName) | 
|---|
| 205 | { | 
|---|
| 206 | return scheduleCommand(QScriptDebuggerCommand::resolveScriptCommand(fileName)); | 
|---|
| 207 | } | 
|---|
| 208 |  | 
|---|
| 209 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetBacktrace() | 
|---|
| 210 | { | 
|---|
| 211 | return scheduleCommand(QScriptDebuggerCommand::getBacktraceCommand()); | 
|---|
| 212 | } | 
|---|
| 213 |  | 
|---|
| 214 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextCount() | 
|---|
| 215 | { | 
|---|
| 216 | return scheduleCommand(QScriptDebuggerCommand::getContextCountCommand()); | 
|---|
| 217 | } | 
|---|
| 218 |  | 
|---|
| 219 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextState(int contextIndex) | 
|---|
| 220 | { | 
|---|
| 221 | return scheduleCommand(QScriptDebuggerCommand::getContextStateCommand(contextIndex)); | 
|---|
| 222 | } | 
|---|
| 223 |  | 
|---|
| 224 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextInfo(int contextIndex) | 
|---|
| 225 | { | 
|---|
| 226 | return scheduleCommand(QScriptDebuggerCommand::getContextInfoCommand(contextIndex)); | 
|---|
| 227 | } | 
|---|
| 228 |  | 
|---|
| 229 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetContextId(int contextIndex) | 
|---|
| 230 | { | 
|---|
| 231 | return scheduleCommand(QScriptDebuggerCommand::getContextIdCommand(contextIndex)); | 
|---|
| 232 | } | 
|---|
| 233 |  | 
|---|
| 234 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetThisObject(int contextIndex) | 
|---|
| 235 | { | 
|---|
| 236 | return scheduleCommand(QScriptDebuggerCommand::getThisObjectCommand(contextIndex)); | 
|---|
| 237 | } | 
|---|
| 238 |  | 
|---|
| 239 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetActivationObject(int contextIndex) | 
|---|
| 240 | { | 
|---|
| 241 | return scheduleCommand(QScriptDebuggerCommand::getActivationObjectCommand(contextIndex)); | 
|---|
| 242 | } | 
|---|
| 243 |  | 
|---|
| 244 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetScopeChain(int contextIndex) | 
|---|
| 245 | { | 
|---|
| 246 | return scheduleCommand(QScriptDebuggerCommand::getScopeChainCommand(contextIndex)); | 
|---|
| 247 | } | 
|---|
| 248 |  | 
|---|
| 249 | int QScriptDebuggerCommandSchedulerFrontend::scheduleContextsCheckpoint() | 
|---|
| 250 | { | 
|---|
| 251 | return scheduleCommand(QScriptDebuggerCommand::contextsCheckpoint()); | 
|---|
| 252 | } | 
|---|
| 253 |  | 
|---|
| 254 | int QScriptDebuggerCommandSchedulerFrontend::scheduleEvaluate(int contextIndex, | 
|---|
| 255 | const QString &program, | 
|---|
| 256 | const QString &fileName, | 
|---|
| 257 | int lineNumber) | 
|---|
| 258 | { | 
|---|
| 259 | return scheduleCommand(QScriptDebuggerCommand::evaluateCommand(contextIndex, program, fileName, lineNumber)); | 
|---|
| 260 | } | 
|---|
| 261 |  | 
|---|
| 262 | int QScriptDebuggerCommandSchedulerFrontend::scheduleNewScriptValueIterator(const QScriptDebuggerValue &object) | 
|---|
| 263 | { | 
|---|
| 264 | return scheduleCommand(QScriptDebuggerCommand::newScriptValueIteratorCommand(object)); | 
|---|
| 265 | } | 
|---|
| 266 |  | 
|---|
| 267 | int QScriptDebuggerCommandSchedulerFrontend::scheduleGetPropertiesByIterator(int id, int count) | 
|---|
| 268 | { | 
|---|
| 269 | return scheduleCommand(QScriptDebuggerCommand::getPropertiesByIteratorCommand(id, count)); | 
|---|
| 270 | } | 
|---|
| 271 |  | 
|---|
| 272 | int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteScriptValueIterator(int id) | 
|---|
| 273 | { | 
|---|
| 274 | return scheduleCommand(QScriptDebuggerCommand::deleteScriptValueIteratorCommand(id)); | 
|---|
| 275 | } | 
|---|
| 276 |  | 
|---|
| 277 | int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptValueToString(const QScriptDebuggerValue &value) | 
|---|
| 278 | { | 
|---|
| 279 | return scheduleCommand(QScriptDebuggerCommand::scriptValueToStringCommand(value)); | 
|---|
| 280 | } | 
|---|
| 281 |  | 
|---|
| 282 | int QScriptDebuggerCommandSchedulerFrontend::scheduleSetScriptValueProperty(const QScriptDebuggerValue &object, | 
|---|
| 283 | const QString &name, | 
|---|
| 284 | const QScriptDebuggerValue &value) | 
|---|
| 285 | { | 
|---|
| 286 | return scheduleCommand(QScriptDebuggerCommand::setScriptValuePropertyCommand(object, name, value)); | 
|---|
| 287 | } | 
|---|
| 288 |  | 
|---|
| 289 | int QScriptDebuggerCommandSchedulerFrontend::scheduleClearExceptions() | 
|---|
| 290 | { | 
|---|
| 291 | return scheduleCommand(QScriptDebuggerCommand::clearExceptionsCommand()); | 
|---|
| 292 | } | 
|---|
| 293 |  | 
|---|
| 294 | int QScriptDebuggerCommandSchedulerFrontend::scheduleNewScriptObjectSnapshot() | 
|---|
| 295 | { | 
|---|
| 296 | return scheduleCommand(QScriptDebuggerCommand::newScriptObjectSnapshotCommand()); | 
|---|
| 297 | } | 
|---|
| 298 |  | 
|---|
| 299 | int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptObjectSnapshotCapture(int id, const QScriptDebuggerValue &object) | 
|---|
| 300 | { | 
|---|
| 301 | return scheduleCommand(QScriptDebuggerCommand::scriptObjectSnapshotCaptureCommand(id, object)); | 
|---|
| 302 | } | 
|---|
| 303 |  | 
|---|
| 304 | int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteScriptObjectSnapshot(int id) | 
|---|
| 305 | { | 
|---|
| 306 | return scheduleCommand(QScriptDebuggerCommand::deleteScriptObjectSnapshotCommand(id)); | 
|---|
| 307 | } | 
|---|
| 308 |  | 
|---|
| 309 | QT_END_NAMESPACE | 
|---|