Qt 4.8
Public Functions | List of all members
QScriptDebuggerScriptedConsoleCommandJob Class Reference
Inheritance diagram for QScriptDebuggerScriptedConsoleCommandJob:
QScriptDebuggerConsoleCommandJob QScriptDebuggerCommandSchedulerInterface QScriptDebuggerCommandSchedulerJob QScriptDebuggerJob QScriptDebuggerResponseHandlerInterface

Public Functions

void handleResponse (const QScriptDebuggerResponse &response, int commandId)
 
 QScriptDebuggerScriptedConsoleCommandJob (QScriptDebuggerScriptedConsoleCommandPrivate *command, const QStringList &arguments, QScriptDebuggerConsole *console, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *commandScheduler)
 
int scheduleCommand (const QScriptDebuggerCommand &command, QScriptDebuggerResponseHandlerInterface *responseHandler)
 
void start ()
 
 ~QScriptDebuggerScriptedConsoleCommandJob ()
 
- Public Functions inherited from QScriptDebuggerConsoleCommandJob
 QScriptDebuggerConsoleCommandJob (QScriptDebuggerConsole *console, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *scheduler)
 
 ~QScriptDebuggerConsoleCommandJob ()
 
- Public Functions inherited from QScriptDebuggerCommandSchedulerJob
QScriptDebuggerCommandSchedulerInterfacecommandScheduler () const
 
 QScriptDebuggerCommandSchedulerJob (QScriptDebuggerCommandSchedulerInterface *commandScheduler)
 
 ~QScriptDebuggerCommandSchedulerJob ()
 
- Public Functions inherited from QScriptDebuggerJob
virtual void evaluateFinished (const QScriptDebuggerValue &result)
 
void finish ()
 
void hibernateUntilEvaluateFinished ()
 
 QScriptDebuggerJob ()
 
virtual ~QScriptDebuggerJob ()
 
- Public Functions inherited from QScriptDebuggerResponseHandlerInterface
virtual ~QScriptDebuggerResponseHandlerInterface ()
 
- Public Functions inherited from QScriptDebuggerCommandSchedulerInterface
virtual ~QScriptDebuggerCommandSchedulerInterface ()
 

Additional Inherited Members

- Protected Functions inherited from QScriptDebuggerConsoleCommandJob
 QScriptDebuggerConsoleCommandJob (QScriptDebuggerConsoleCommandJobPrivate &dd, QScriptDebuggerConsole *console, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *scheduler)
 
- Protected Functions inherited from QScriptDebuggerCommandSchedulerJob
 QScriptDebuggerCommandSchedulerJob (QScriptDebuggerCommandSchedulerJobPrivate &dd, QScriptDebuggerCommandSchedulerInterface *commandScheduler)
 
- Protected Functions inherited from QScriptDebuggerJob
 QScriptDebuggerJob (QScriptDebuggerJobPrivate &dd)
 
- Protected Variables inherited from QScriptDebuggerJob
QScopedPointer< QScriptDebuggerJobPrivated_ptr
 

Detailed Description

Definition at line 131 of file qscriptdebuggerscriptedconsolecommand.cpp.

Constructors and Destructors

◆ QScriptDebuggerScriptedConsoleCommandJob()

QScriptDebuggerScriptedConsoleCommandJob::QScriptDebuggerScriptedConsoleCommandJob ( QScriptDebuggerScriptedConsoleCommandPrivate command,
const QStringList arguments,
QScriptDebuggerConsole console,
QScriptMessageHandlerInterface messageHandler,
QScriptDebuggerCommandSchedulerInterface commandScheduler 
)

Definition at line 169 of file qscriptdebuggerscriptedconsolecommand.cpp.

Referenced by QScriptDebuggerScriptedConsoleCommand::createJob().

176  console, messageHandler, commandScheduler)
177 {
179  d->command = command;
180  d->arguments = arguments;
181 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
QScriptDebuggerConsoleCommandJob(QScriptDebuggerConsole *console, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *scheduler)

◆ ~QScriptDebuggerScriptedConsoleCommandJob()

QScriptDebuggerScriptedConsoleCommandJob::~QScriptDebuggerScriptedConsoleCommandJob ( )

Definition at line 183 of file qscriptdebuggerscriptedconsolecommand.cpp.

184 {
185 }

Functions

◆ handleResponse()

void QScriptDebuggerScriptedConsoleCommandJob::handleResponse ( const QScriptDebuggerResponse response,
int  commandId 
)
virtual

Implements QScriptDebuggerResponseHandlerInterface.

Definition at line 224 of file qscriptdebuggerscriptedconsolecommand.cpp.

227 {
229  // ### generalize
230  QScriptEngine *engine = d->command->globalObject.engine();
231  engine->setGlobalObject(d->command->globalObject);
232  QScriptValueList args;
233  args.append(engine->toScriptValue(response));
234  args.append(QScriptValue(engine, commandId));
236  global = qobject_cast<QScriptDebuggerConsoleGlobalObject*>(d->command->globalObject.toQObject());
237  Q_ASSERT(global != 0);
238  global->setScheduler(this);
239  global->setResponseHandler(this);
240  global->setMessageHandler(d->messageHandler);
241  global->setConsole(d->console);
242  d->commandCount = 0;
243  QScriptValue ret = d->command->responseFunction.call(QScriptValue(), args);
244  global->setScheduler(0);
245  global->setResponseHandler(0);
246  global->setMessageHandler(0);
247  global->setConsole(0);
248  if (ret.isError()) {
249  qWarning("*** internal error: %s", qPrintable(ret.toString()));
250  }
251  if (d->commandCount == 0)
252  finish();
253 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
double d
Definition: qnumeric_p.h:62
bool isError() const
Returns true if this QScriptValue is an object of the Error class; otherwise returns false...
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
void setConsole(QScriptDebuggerConsole *console)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
The QScriptEngine class provides an environment for evaluating Qt Script code.
void setScheduler(QScriptDebuggerCommandSchedulerInterface *scheduler)
Q_CORE_EXPORT void qWarning(const char *,...)
void setGlobalObject(const QScriptValue &object)
Sets this engine&#39;s Global Object to be the given object.
void setResponseHandler(QScriptDebuggerResponseHandlerInterface *responseHandler)
void setMessageHandler(QScriptMessageHandlerInterface *messageHandler)
#define qPrintable(string)
Definition: qglobal.h:1750
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ scheduleCommand()

int QScriptDebuggerScriptedConsoleCommandJob::scheduleCommand ( const QScriptDebuggerCommand command,
QScriptDebuggerResponseHandlerInterface responseHandler 
)
virtual

Implements QScriptDebuggerCommandSchedulerInterface.

Definition at line 187 of file qscriptdebuggerscriptedconsolecommand.cpp.

190 {
192  ++d->commandCount;
193  return commandScheduler()->scheduleCommand(command, responseHandler);
194 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
virtual int scheduleCommand(const QScriptDebuggerCommand &command, QScriptDebuggerResponseHandlerInterface *responseHandler)=0
QScriptDebuggerCommandSchedulerInterface * commandScheduler() const

◆ start()

void QScriptDebuggerScriptedConsoleCommandJob::start ( )
virtual

Implements QScriptDebuggerJob.

Definition at line 196 of file qscriptdebuggerscriptedconsolecommand.cpp.

197 {
199  QScriptEngine *engine = d->command->globalObject.engine();
200  engine->setGlobalObject(d->command->globalObject);
201  QScriptValueList args;
202  for (int i = 0; i < d->arguments.size(); ++i)
203  args.append(QScriptValue(engine, d->arguments.at(i)));
206  Q_ASSERT(global != 0);
207  global->setScheduler(this);
208  global->setResponseHandler(this);
209  global->setMessageHandler(d->messageHandler);
210  global->setConsole(d->console);
211  d->commandCount = 0;
212  QScriptValue ret = d->command->execFunction.call(QScriptValue(), args);
213  global->setScheduler(0);
214  global->setResponseHandler(0);
215  global->setMessageHandler(0);
216  global->setConsole(0);
217  if (ret.isError()) {
218  qWarning("*** internal error: %s", qPrintable(ret.toString()));
219  }
220  if (d->commandCount == 0)
221  finish();
222 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
double d
Definition: qnumeric_p.h:62
bool isError() const
Returns true if this QScriptValue is an object of the Error class; otherwise returns false...
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
QScriptValue globalObject() const
Returns this engine&#39;s Global Object.
QObject * toQObject() const
If this QScriptValue is a QObject, returns the QObject pointer that the QScriptValue represents; othe...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
void setConsole(QScriptDebuggerConsole *console)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
The QScriptEngine class provides an environment for evaluating Qt Script code.
void setScheduler(QScriptDebuggerCommandSchedulerInterface *scheduler)
Q_CORE_EXPORT void qWarning(const char *,...)
void setGlobalObject(const QScriptValue &object)
Sets this engine&#39;s Global Object to be the given object.
void setResponseHandler(QScriptDebuggerResponseHandlerInterface *responseHandler)
void setMessageHandler(QScriptMessageHandlerInterface *messageHandler)
#define qPrintable(string)
Definition: qglobal.h:1750
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

The documentation for this class was generated from the following file: