Qt 4.8
qscriptdebuggerconsole.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
50 #include "qscriptscriptdata_p.h"
51 
52 #include <QtCore/qdir.h>
53 #include <QtCore/qfileinfo.h>
54 #include <QtCore/qstring.h>
55 #include <QtCore/qstringlist.h>
56 #include <QtCore/qdebug.h>
57 #include <QtScript/qscriptcontextinfo.h>
58 #include <QtScript/qscriptengine.h>
59 
73 
75 
77 {
78  QScriptValue out = eng->newObject();
79  out.setProperty(QString::fromLatin1("result"), eng->toScriptValue(in.result()));
80  out.setProperty(QString::fromLatin1("error"), QScriptValue(eng, in.error()));
81  out.setProperty(QString::fromLatin1("async"), QScriptValue(eng, in.async()));
82  return out;
83 }
84 
86 {
87  Q_ASSERT(0);
88 }
89 
91 {
92  QScriptValue out = eng->newObject();
93  out.setProperty(QString::fromLatin1("scriptId"), QScriptValue(eng, qsreal(in.scriptId())));
94  out.setProperty(QString::fromLatin1("fileName"), QScriptValue(eng, in.fileName()));
95  out.setProperty(QString::fromLatin1("lineNumber"), QScriptValue(eng, in.lineNumber()));
96  out.setProperty(QString::fromLatin1("enabled"), QScriptValue(eng, in.isEnabled()));
97  out.setProperty(QString::fromLatin1("singleShot"), QScriptValue(eng, in.isSingleShot()));
98  out.setProperty(QString::fromLatin1("ignoreCount"), QScriptValue(eng, in.ignoreCount()));
99  out.setProperty(QString::fromLatin1("condition"), QScriptValue(eng, in.condition()));
100  return out;
101 }
102 
104 {
105  QScriptValue scriptId = in.property(QString::fromLatin1("scriptId"));
106  if (scriptId.isValid())
107  out.setScriptId((qint64)scriptId.toNumber());
108  out.setFileName(in.property(QString::fromLatin1("fileName")).toString());
109  out.setLineNumber(in.property(QString::fromLatin1("lineNumber")).toInt32());
111  if (enabled.isValid())
112  out.setEnabled(enabled.toBoolean());
113  QScriptValue singleShot = in.property(QString::fromLatin1("singleShot"));
114  if (singleShot.isValid())
115  out.setSingleShot(singleShot.toBoolean());
116  out.setIgnoreCount(in.property(QString::fromLatin1("ignoreCount")).toInt32());
117  out.setCondition(in.property(QString::fromLatin1("condition")).toString());
118 }
119 
121 {
122  QScriptValue out = eng->newObject();
124  for (it = in.constBegin(); it != in.constEnd(); ++it) {
125  out.setProperty(QString::number(it.key()), eng->toScriptValue(it.value()));
126  }
127  return out;
128 }
129 
131 {
132  Q_ASSERT(0);
133 }
134 
136 {
137  QScriptValue out = eng->newObject();
138  out.setProperty(QString::fromLatin1("contents"), QScriptValue(eng, in.contents()));
139  out.setProperty(QString::fromLatin1("fileName"), QScriptValue(eng, in.fileName()));
140  out.setProperty(QString::fromLatin1("baseLineNumber"), QScriptValue(eng, in.baseLineNumber()));
141  return out;
142 }
143 
145 {
146  QString contents = in.property(QString::fromLatin1("contents")).toString();
148  int baseLineNumber = in.property(QString::fromLatin1("baseLineNumber")).toInt32();
149  QScriptScriptData tmp(contents, fileName, baseLineNumber);
150  out = tmp;
151 }
152 
154 {
155  QScriptValue out = eng->newObject();
157  for (it = in.constBegin(); it != in.constEnd(); ++it) {
158  out.setProperty(QString::number(it.key()), eng->toScriptValue(it.value()));
159  }
160  return out;
161 }
162 
164 {
165  Q_ASSERT(0);
166 }
167 
170 {
171  if (!in)
172  return eng->undefinedValue();
173  QScriptValue out = eng->newObject();
174  out.setProperty(QString::fromLatin1("name"), QScriptValue(eng, in->name()));
175  out.setProperty(QString::fromLatin1("group"), QScriptValue(eng, in->group()));
176  out.setProperty(QString::fromLatin1("shortDescription"), QScriptValue(eng, in->shortDescription()));
177  out.setProperty(QString::fromLatin1("longDescription"), QScriptValue(eng, in->longDescription()));
178  out.setProperty(QString::fromLatin1("aliases"), eng->toScriptValue(in->aliases()));
179  out.setProperty(QString::fromLatin1("seeAlso"), eng->toScriptValue(in->seeAlso()));
180  return out;
181 }
182 
185 {
186  Q_ASSERT(0);
187 }
188 
191 {
192  QScriptValue out = eng->newObject();
193  out.setProperty(QString::fromLatin1("longDescription"), QScriptValue(eng, in.longDescription()));
194  out.setProperty(QString::fromLatin1("shortDescription"), QScriptValue(eng, in.shortDescription()));
195  return out;
196 }
197 
200 {
201  Q_ASSERT(0);
202 }
203 
206 {
207  QScriptValue out = eng->newObject();
209  for (it = in.constBegin(); it != in.constEnd(); ++it) {
210  out.setProperty(it.key(), eng->toScriptValue(it.value()));
211  }
212  return out;
213 }
214 
217 {
218  Q_ASSERT(0);
219 }
220 
222 {
223  QScriptValue out = eng->newObject();
224  out.setProperty(QString::fromLatin1("scriptId"), QScriptValue(eng, qsreal(in.scriptId())));
225  out.setProperty(QString::fromLatin1("fileName"), QScriptValue(eng, in.fileName()));
226  out.setProperty(QString::fromLatin1("lineNumber"), QScriptValue(eng, in.lineNumber()));
227  out.setProperty(QString::fromLatin1("columnNumber"), QScriptValue(eng, in.columnNumber()));
228  out.setProperty(QString::fromLatin1("functionName"), QScriptValue(eng, in.functionName()));
229  return out;
230 }
231 
233 {
234  Q_ASSERT(0);
235 }
236 
238 {
239  QScriptValue out = eng->newObject();
240  out.setProperty(QString::fromLatin1("name"), QScriptValue(eng, in.name()));
241  out.setProperty(QString::fromLatin1("value"), eng->toScriptValue(in.value()));
242  out.setProperty(QString::fromLatin1("valueAsString"), QScriptValue(eng, in.valueAsString()));
243  out.setProperty(QString::fromLatin1("flags"), QScriptValue(eng, static_cast<int>(in.flags())));
244  return out;
245 }
246 
248 {
251  QString valueAsString = in.property(QString::fromLatin1("valueAsString")).toString();
252  int flags = in.property(QString::fromLatin1("flags")).toInt32();
253  QScriptDebuggerValueProperty tmp(name, value, valueAsString, QScriptValue::PropertyFlags(flags));
254  out = tmp;
255 }
256 
269 {
271 public:
274 
275  void loadScriptedCommands(const QString &scriptsPath,
278  const QString &command,
279  QScriptMessageHandlerInterface *messageHandler,
280  QScriptDebuggerCommandSchedulerInterface *commandScheduler);
281 
292 
294 };
295 
297  : q_ptr(parent)
298 {
299  sessionId = 0;
300  currentFrameIndex = 0;
301  currentScriptId = -1;
302  currentLineNumber = -1;
303  evaluateAction = 0;
306 
308  qScriptRegisterMetaType<QScriptBreakpointData>(commandEngine, breakpointDataToScriptValue, breakpointDataFromScriptValue);
309  qScriptRegisterMetaType<QScriptBreakpointMap>(commandEngine, breakpointMapToScriptValue, breakpointMapFromScriptValue);
310  qScriptRegisterMetaType<QScriptScriptData>(commandEngine, scriptDataToScriptValue, scriptDataFromScriptValue);
311  qScriptRegisterMetaType<QScriptScriptMap>(commandEngine, scriptMapToScriptValue, scriptMapFromScriptValue);
312  qScriptRegisterMetaType<QScriptContextInfo>(commandEngine, contextInfoToScriptValue, contextInfoFromScriptValue);
313  qScriptRegisterMetaType<QScriptDebuggerValueProperty>(commandEngine, debuggerScriptValuePropertyToScriptValue, debuggerScriptValuePropertyFromScriptValue);
314  qScriptRegisterSequenceMetaType<QScriptDebuggerValuePropertyList>(commandEngine);
315  qScriptRegisterMetaType<QScriptDebuggerResponse>(commandEngine, debuggerResponseToScriptValue, debuggerResponseFromScriptValue);
316  qScriptRegisterMetaType<QScriptDebuggerConsoleCommand*>(commandEngine, consoleCommandToScriptValue, consoleCommandFromScriptValue);
317  qScriptRegisterSequenceMetaType<QScriptDebuggerConsoleCommandList>(commandEngine);
318  qScriptRegisterMetaType<QScriptDebuggerConsoleCommandGroupData>(commandEngine, consoleCommandGroupDataToScriptValue, consoleCommandGroupDataFromScriptValue);
319  qScriptRegisterMetaType<QScriptDebuggerConsoleCommandGroupMap>(commandEngine, consoleCommandGroupMapToScriptValue, consoleCommandGroupMapFromScriptValue);
320 // ### can't do this, if it's an object ID the conversion will be incorrect since
321 // ### the object ID refers to an object in a different engine!
322 // qScriptRegisterMetaType(commandEngine, debuggerScriptValueToScriptValue, debuggerScriptValueFromScriptValue);
323 }
324 
326 {
327  delete commandManager;
328  delete commandEngine;
329 }
330 
335  const QString &scriptsPath,
337 {
338  QDir dir(scriptsPath);
340  << QLatin1String("*.qs"));
341  for (int i = 0; i < entries.size(); ++i) {
342  const QFileInfo &fi = entries.at(i);
343  QString fileName = fi.fileName();
344  QFile file(scriptsPath + QLatin1Char('/') + fileName);
345  if (!file.open(QIODevice::ReadOnly))
346  continue;
347  QTextStream stream(&file);
348  QString program = stream.readAll();
351  program, fileName, commandEngine, messageHandler);
352  if (!command)
353  continue;
354  commandManager->addCommand(command);
355  }
356 }
357 
358 
366 {
367  QString name;
368  int i = command.indexOf(QLatin1Char(' '));
369  if (i == -1) {
370  name = command;
371  i = name.size();
372  } else {
373  name = command.left(i);
374  }
375  if (name.isEmpty())
376  return 0;
378  if (!cmd) {
379  // try to auto-complete
380  QStringList completions = commandManager->completions(name);
381  if (!completions.isEmpty()) {
382  if (completions.size() > 1) {
383  QString msg;
384  msg.append(QString::fromLatin1("Ambiguous command \"%0\": ")
385  .arg(name));
386  for (int j = 0; j < completions.size(); ++j) {
387  if (j > 0)
388  msg.append(QLatin1String(", "));
389  msg.append(completions.at(j));
390  }
391  msg.append(QLatin1Char('.'));
392  messageHandler->message(QtWarningMsg, msg);
393  return 0;
394  }
395  cmd = commandManager->findCommand(completions.at(0));
396  Q_ASSERT(cmd != 0);
397  }
398  if (!cmd) {
399  messageHandler->message(
400  QtWarningMsg,
401  QString::fromLatin1("Undefined command \"%0\". Try \"help\".")
402  .arg(name));
403  return 0;
404  }
405  }
406  QStringList args;
407  QString tmp = command.mid(i+1);
408  if (cmd->argumentTypes().contains(QString::fromLatin1("script"))) {
409  if (!tmp.isEmpty())
410  args.append(tmp);
411  } else {
412  args = tmp.split(QLatin1Char(' '), QString::SkipEmptyParts);
413  }
414  return cmd->createJob(args, q_func(), messageHandler, commandScheduler);
415 }
416 
418  : d_ptr(new QScriptDebuggerConsolePrivate(this))
419 {
420 }
421 
423 {
424 }
425 
428 {
430  d->loadScriptedCommands(scriptsPath, messageHandler);
431 }
432 
434 {
436  return d->commandManager;
437 }
438 
440 {
442  return !d->input.isEmpty();
443 }
444 
446 {
448  return d->input;
449 }
450 
452 {
454  d->input = input;
455 }
456 
458 {
460  return d->commandPrefix;
461 }
462 
471 {
473  static const int maximumHistoryCount = 100;
474  QString cmd;
475  if (d->input.isEmpty() && input.isEmpty()) {
476  if (d->commandHistory.isEmpty())
477  return 0;
478  cmd = d->commandHistory.first();
479  } else {
480  cmd = input;
481  }
482  if (d->input.isEmpty() && cmd.startsWith(d->commandPrefix)) {
483  if (!input.isEmpty()) {
484  d->commandHistory.prepend(cmd);
485  if (d->commandHistory.size() > maximumHistoryCount)
486  d->commandHistory.removeLast();
487  }
488  cmd.remove(0, d->commandPrefix.length());
489  return d->createJob(cmd, messageHandler, commandScheduler);
490  }
491  d->input += cmd;
492  d->input += QLatin1Char('\n');
495  return false;
496  d->input.chop(1); // remove the last \n
497  cmd = QString();
498  cmd.append(d->commandPrefix);
499  cmd.append(QString::fromLatin1("eval "));
500  cmd.append(d->input);
501  d->commandHistory.prepend(cmd);
502  if (d->commandHistory.size() > maximumHistoryCount)
503  d->commandHistory.removeLast();
504  d->input.clear();
505  cmd.remove(0, d->commandPrefix.length());
506  return d->createJob(cmd, messageHandler, commandScheduler);
507 }
508 
510 {
512  return d->currentFrameIndex;
513 }
514 
516 {
518  d->currentFrameIndex = index;
519 }
520 
522 {
524  return d->currentScriptId;
525 }
526 
528 {
530  d->currentScriptId = id;
531 }
532 
534 {
536  return d->currentLineNumber;
537 }
538 
540 {
542  d->currentLineNumber = lineNumber;
543 }
544 
546 {
548  return d->evaluateAction;
549 }
550 
552 {
554  d->evaluateAction = action;
555 }
556 
558 {
560  return d->sessionId;
561 }
562 
564 {
566  ++d->sessionId;
567 }
568 
571 {
572  messageHandler->message(
573  QtDebugMsg,
575  "Welcome to the Qt Script debugger.\n"
576  "Debugger commands start with a . (period).\n"
577  "Any other input will be evaluated by the script interpreter.\n"
578  "Type \".help\" for help.\n"));
579 }
580 
585 {
587  return d->commandHistory.size();
588 }
589 
594 {
596  return d->commandHistory.value(index);
597 }
598 
603 {
605  d->commandHistory[index] = newHistory;
606 }
607 
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
The QDir class provides access to directory structures and their contents.
Definition: qdir.h:58
double d
Definition: qnumeric_p.h:62
void loadScriptedCommands(const QString &scriptsPath, QScriptMessageHandlerInterface *messageHandler)
Loads command definitions from scripts located in the given scriptsPath.
QScriptDebuggerConsoleCommandManager * commandManager
static void debuggerScriptValuePropertyFromScriptValue(const QScriptValue &in, QScriptDebuggerValueProperty &out)
bool isSingleShot() const
Returns true if the breakpoint is single-shot, false otherwise.
QScriptValue property(const QString &name, const ResolveFlags &mode=ResolvePrototype) const
Returns the value of this QScriptValue&#39;s property with the given name, using the given mode to resolv...
virtual QString group() const =0
Returns the group that this console command belongs to.
void changeHistoryAt(int index, const QString &newHistory)
Reimplemented Function
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
Error error() const
Returns the error code of this response.
void addCommand(QScriptDebuggerConsoleCommand *command)
Adds the given command.
#define it(className, varName)
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition: qfile.cpp:1064
static QScriptValue scriptDataToScriptValue(QScriptEngine *eng, const QScriptScriptData &in)
static QScriptValue debuggerScriptValuePropertyToScriptValue(QScriptEngine *eng, const QScriptDebuggerValueProperty &in)
void setFileName(const QString &fileName)
qint32 toInt32() const
Returns the signed 32-bit integer value of this QScriptValue, using the conversion rules described in...
The QScriptDebuggerResponse class represents a front-end&#39;s response to a QScriptDebuggerCommand.
static QScriptDebuggerScriptedConsoleCommand * parse(const QString &program, const QString &fileName, QScriptEngine *engine, QScriptMessageHandlerInterface *messageHandler)
Parses a command defined by the given program.
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
QString name() const
Returns the name of this QScriptDebuggerValueProperty.
static void breakpointMapFromScriptValue(const QScriptValue &, QScriptBreakpointMap &)
QString fileName() const
Returns the name of the file, excluding the path.
Definition: qfileinfo.cpp:726
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
QT_DEPRECATED int columnNumber() const
int ignoreCount() const
Returns the ignore count of the breakpoint.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
QScriptDebuggerValue value() const
Returns the value of this QScriptDebuggerValueProperty.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setLineNumber(int lineNumber)
Sets the breakpoint line number to lineNumber.
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual QString name() const =0
Returns the name of this console command.
#define Q_D(Class)
Definition: qglobal.h:2482
static QScriptValue debuggerResponseToScriptValue(QScriptEngine *eng, const QScriptDebuggerResponse &in)
QStringList completions(const QString &prefix) const
Returns the possible completions for the given prefix.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QScriptValue::PropertyFlags flags() const
Returns the flags of this QScriptDebuggerValueProperty.
void setIncompleteInput(const QString &input)
static QScriptValue breakpointMapToScriptValue(QScriptEngine *eng, const QScriptBreakpointMap &in)
QString fileName() const
Returns the name of the file where the code being executed was defined, if available; otherwise retur...
void setSingleShot(bool singleShot)
Sets the singleShot state of the breakpoint.
The QScriptScriptData class holds data associated with a script.
static QScriptValue consoleCommandGroupDataToScriptValue(QScriptEngine *eng, const QScriptDebuggerConsoleCommandGroupData &in)
QScriptDebuggerConsoleCommandJob * createJob(const QString &command, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *commandScheduler)
Creates a job that will execute the given debugger command.
T qscriptvalue_cast(const QScriptValue &value)
Returns the given value converted to the template type T.
The QScriptDebuggerConsole class provides the core functionality of a debugger console.
void showDebuggerInfoMessage(QScriptMessageHandlerInterface *messageHandler)
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.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual QStringList seeAlso() const
Returns a list of names of commands that may also be of interest to users of this command...
static FILE * stream
int lineNumber() const
Returns the line number corresponding to the statement being executed, or -1 if the line number is no...
static void scriptDataFromScriptValue(const QScriptValue &in, QScriptScriptData &out)
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void setIgnoreCount(int count)
Sets the ignore count of the breakpoint.
const char * name
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
virtual QString shortDescription() const =0
Returns a short (one line) description of the command.
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static QScriptValue breakpointDataToScriptValue(QScriptEngine *eng, const QScriptBreakpointData &in)
static QScriptValue consoleCommandGroupMapToScriptValue(QScriptEngine *eng, const QScriptDebuggerConsoleCommandGroupMap &in)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
void setEnabled(bool enabled)
Sets the enabled state of the breakpoint.
The QScriptSyntaxCheckResult class provides the result of a script syntax check.
Definition: qscriptengine.h:75
QScriptValue newObject()
Creates a QtScript object of class Object.
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
QFileInfoList entryInfoList(Filters filters=NoFilter, SortFlags sort=NoSort) const
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
Definition: qdir.cpp:1316
virtual QString longDescription() const =0
Returns a detailed description of how to use the command.
__int64 qint64
Definition: qglobal.h:942
void setCondition(const QString &condition)
Sets the condition of the breakpoint.
QScriptDebuggerConsolePrivate(QScriptDebuggerConsole *)
void loadScriptedCommands(const QString &scriptsPath, QScriptMessageHandlerInterface *messageHandler)
The QScriptBreakpointData class contains data associated with a breakpoint.
static QScriptValue contextInfoToScriptValue(QScriptEngine *eng, const QScriptContextInfo &in)
bool toBoolean() const
Use toBool() instead.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
QScriptDebuggerConsoleCommandJob * consumeInput(const QString &input, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *commandScheduler)
Consumes the given line of input.
static void breakpointDataFromScriptValue(const QScriptValue &in, QScriptBreakpointData &out)
#define Q_DECLARE_METATYPE(TYPE)
This macro makes the type Type known to QMetaType as long as it provides a public default constructor...
Definition: qmetatype.h:265
qsreal toNumber() const
Returns the number value of this QScriptValue, as defined in ECMA-262 section 9.3, "ToNumber".
QScriptDebuggerConsoleCommand * findCommand(const QString &name) const
Returns the command with the given name if one exists, otherwise returns 0.
static void consoleCommandGroupMapFromScriptValue(const QScriptValue &, QScriptDebuggerConsoleCommandGroupMap &)
static const MacSpecialKey entries[NumEntries]
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
static QScriptValue consoleCommandToScriptValue(QScriptEngine *eng, QScriptDebuggerConsoleCommand *const &in)
The QScriptDebuggerValue class represents a script value.
The QScriptDebuggerConsoleCommandGroupData class holds data associated with a console command group...
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
void setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags=KeepExistingFlags)
Sets the value of this QScriptValue&#39;s property with the given name to the given value.
The QScriptContextInfo class provides additional information about a QScriptContext.
The QScriptDebuggerScriptedConsoleCommand class encapsulates a command defined in a script...
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
QString & append(QChar c)
Definition: qstring.cpp:1777
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
The QScriptDebuggerConsoleCommand class is the base class of console commands.
static void scriptMapFromScriptValue(const QScriptValue &, QScriptScriptMap &)
The QTextStream class provides a convenient interface for reading and writing text.
Definition: qtextstream.h:73
int historyCount() const
Reimplemented Function
PropertyFlags
Definition: qmetaobject_p.h:61
static QScriptValue scriptMapToScriptValue(QScriptEngine *eng, const QScriptScriptMap &in)
bool isEnabled() const
Returns true if the breakpoint is enabled, false otherwise.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
static void messageHandler(QtMsgType type, const char *msg)
Definition: qtestlog.cpp:121
virtual QScriptDebuggerConsoleCommandJob * createJob(const QStringList &arguments, QScriptDebuggerConsole *console, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *scheduler)=0
Creates a job that will execute this command with the given arguments.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QString historyAt(int index) const
Reimplemented Function
double qsreal
Definition: qscriptvalue.h:52
void setCurrentLineNumber(int lineNumber)
quint16 index
static QScriptSyntaxCheckResult checkSyntax(const QString &program)
Checks the syntax of the given program.
QString condition() const
Returns the condition of the breakpoint.
static void consoleCommandGroupDataFromScriptValue(const QScriptValue &, QScriptDebuggerConsoleCommandGroupData &)
QString readAll()
Reads the entire content of the stream, and returns it as a QString.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
QScriptValue undefinedValue()
Returns a QScriptValue of the primitive type Undefined.
qint64 scriptId() const
Returns the ID of the script where the code being executed was defined, or -1 if the ID is not availa...
QString contents() const
QScriptDebuggerConsoleCommandManager * commandManager() const
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60
static void consoleCommandFromScriptValue(const QScriptValue &, QScriptDebuggerConsoleCommand *&)
static void contextInfoFromScriptValue(const QScriptValue &, QScriptContextInfo &)
virtual void message(QtMsgType type, const QString &text, const QString &fileName=QString(), int lineNumber=-1, int columnNumber=-1, const QVariant &data=QVariant())=0
int lineNumber() const
Returns the breakpoint line number.
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
static QString fileName(const QString &fileUrl)
QVariant result() const
Returns the result of this response.
virtual QStringList aliases() const
Returns a list of aliases for this command.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
bool isValid() const
Returns true if this QScriptValue is valid; otherwise returns false.
static void debuggerResponseFromScriptValue(const QScriptValue &, QScriptDebuggerResponse &)
QString fileName() const
#define enabled
QString functionName() const
Returns the name of the called function, or an empty string if the name is not available.
State state() const
Returns the state of this QScriptSyntaxCheckResult.