src/scripttools/debugging/qscriptdebuggercommandschedulerfrontend.cpp
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtSCriptTools module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    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::scheduleGetPropertyExpressionValue(
       
   255     int contextIndex, int lineNumber, const QStringList &path)
       
   256 {
       
   257     return scheduleCommand(QScriptDebuggerCommand::getPropertyExpressionValue(contextIndex, lineNumber, path));
       
   258 }
       
   259 
       
   260 int QScriptDebuggerCommandSchedulerFrontend::scheduleGetCompletions(int contextIndex, const QStringList &path)
       
   261 {
       
   262     return scheduleCommand(QScriptDebuggerCommand::getCompletions(contextIndex, path));
       
   263 }
       
   264 
       
   265 int QScriptDebuggerCommandSchedulerFrontend::scheduleEvaluate(int contextIndex,
       
   266                                               const QString &program,
       
   267                                               const QString &fileName,
       
   268                                               int lineNumber)
       
   269 {
       
   270     return scheduleCommand(QScriptDebuggerCommand::evaluateCommand(contextIndex, program, fileName, lineNumber));
       
   271 }
       
   272 
       
   273 int QScriptDebuggerCommandSchedulerFrontend::scheduleNewScriptValueIterator(const QScriptDebuggerValue &object)
       
   274 {
       
   275     return scheduleCommand(QScriptDebuggerCommand::newScriptValueIteratorCommand(object));
       
   276 }
       
   277 
       
   278 int QScriptDebuggerCommandSchedulerFrontend::scheduleGetPropertiesByIterator(int id, int count)
       
   279 {
       
   280     return scheduleCommand(QScriptDebuggerCommand::getPropertiesByIteratorCommand(id, count));
       
   281 }
       
   282 
       
   283 int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteScriptValueIterator(int id)
       
   284 {
       
   285     return scheduleCommand(QScriptDebuggerCommand::deleteScriptValueIteratorCommand(id));
       
   286 }
       
   287 
       
   288 int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptValueToString(const QScriptDebuggerValue &value)
       
   289 {
       
   290     return scheduleCommand(QScriptDebuggerCommand::scriptValueToStringCommand(value));
       
   291 }
       
   292 
       
   293 int QScriptDebuggerCommandSchedulerFrontend::scheduleSetScriptValueProperty(const QScriptDebuggerValue &object,
       
   294                                                             const QString &name,
       
   295                                                             const QScriptDebuggerValue &value)
       
   296 {
       
   297     return scheduleCommand(QScriptDebuggerCommand::setScriptValuePropertyCommand(object, name, value));
       
   298 }
       
   299 
       
   300 int QScriptDebuggerCommandSchedulerFrontend::scheduleClearExceptions()
       
   301 {
       
   302     return scheduleCommand(QScriptDebuggerCommand::clearExceptionsCommand());
       
   303 }
       
   304 
       
   305 int QScriptDebuggerCommandSchedulerFrontend::scheduleNewScriptObjectSnapshot()
       
   306 {
       
   307     return scheduleCommand(QScriptDebuggerCommand::newScriptObjectSnapshotCommand());
       
   308 }
       
   309 
       
   310 int QScriptDebuggerCommandSchedulerFrontend::scheduleScriptObjectSnapshotCapture(int id, const QScriptDebuggerValue &object)
       
   311 {
       
   312     return scheduleCommand(QScriptDebuggerCommand::scriptObjectSnapshotCaptureCommand(id, object));
       
   313 }
       
   314 
       
   315 int QScriptDebuggerCommandSchedulerFrontend::scheduleDeleteScriptObjectSnapshot(int id)
       
   316 {
       
   317     return scheduleCommand(QScriptDebuggerCommand::deleteScriptObjectSnapshotCommand(id));
       
   318 }
       
   319 
       
   320 QT_END_NAMESPACE