Qt 4.8
Classes | Functions
qscriptdebuggerconsole.cpp File Reference
#include "qscriptdebuggerconsole_p.h"
#include "qscriptdebuggerconsolecommandjob_p.h"
#include "qscriptdebuggerconsolecommandmanager_p.h"
#include "qscriptdebuggerscriptedconsolecommand_p.h"
#include "qscriptmessagehandlerinterface_p.h"
#include "qscriptbreakpointdata_p.h"
#include "qscriptdebuggerresponse_p.h"
#include "qscriptdebuggervalueproperty_p.h"
#include "qscriptscriptdata_p.h"
#include <QtCore/qdir.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
#include <QtScript/qscriptcontextinfo.h>
#include <QtScript/qscriptengine.h>

Go to the source code of this file.

Classes

class  QScriptDebuggerConsolePrivate
 

Functions

static void breakpointDataFromScriptValue (const QScriptValue &in, QScriptBreakpointData &out)
 
static QScriptValue breakpointDataToScriptValue (QScriptEngine *eng, const QScriptBreakpointData &in)
 
static void breakpointMapFromScriptValue (const QScriptValue &, QScriptBreakpointMap &)
 
static QScriptValue breakpointMapToScriptValue (QScriptEngine *eng, const QScriptBreakpointMap &in)
 
static void consoleCommandFromScriptValue (const QScriptValue &, QScriptDebuggerConsoleCommand *&)
 
static void consoleCommandGroupDataFromScriptValue (const QScriptValue &, QScriptDebuggerConsoleCommandGroupData &)
 
static QScriptValue consoleCommandGroupDataToScriptValue (QScriptEngine *eng, const QScriptDebuggerConsoleCommandGroupData &in)
 
static void consoleCommandGroupMapFromScriptValue (const QScriptValue &, QScriptDebuggerConsoleCommandGroupMap &)
 
static QScriptValue consoleCommandGroupMapToScriptValue (QScriptEngine *eng, const QScriptDebuggerConsoleCommandGroupMap &in)
 
static QScriptValue consoleCommandToScriptValue (QScriptEngine *eng, QScriptDebuggerConsoleCommand *const &in)
 
static void contextInfoFromScriptValue (const QScriptValue &, QScriptContextInfo &)
 
static QScriptValue contextInfoToScriptValue (QScriptEngine *eng, const QScriptContextInfo &in)
 
static void debuggerResponseFromScriptValue (const QScriptValue &, QScriptDebuggerResponse &)
 
static QScriptValue debuggerResponseToScriptValue (QScriptEngine *eng, const QScriptDebuggerResponse &in)
 
static void debuggerScriptValuePropertyFromScriptValue (const QScriptValue &in, QScriptDebuggerValueProperty &out)
 
static QScriptValue debuggerScriptValuePropertyToScriptValue (QScriptEngine *eng, const QScriptDebuggerValueProperty &in)
 
static void scriptDataFromScriptValue (const QScriptValue &in, QScriptScriptData &out)
 
static QScriptValue scriptDataToScriptValue (QScriptEngine *eng, const QScriptScriptData &in)
 
static void scriptMapFromScriptValue (const QScriptValue &, QScriptScriptMap &)
 
static QScriptValue scriptMapToScriptValue (QScriptEngine *eng, const QScriptScriptMap &in)
 

Function Documentation

◆ breakpointDataFromScriptValue()

static void breakpointDataFromScriptValue ( const QScriptValue in,
QScriptBreakpointData out 
)
static

Definition at line 103 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
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...
void setFileName(const QString &fileName)
qint32 toInt32() const
Returns the signed 32-bit integer value of this QScriptValue, using the conversion rules described in...
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
void setLineNumber(int lineNumber)
Sets the breakpoint line number to lineNumber.
void setSingleShot(bool singleShot)
Sets the singleShot state of the breakpoint.
void setIgnoreCount(int count)
Sets the ignore count of the breakpoint.
void setEnabled(bool enabled)
Sets the enabled state of the breakpoint.
__int64 qint64
Definition: qglobal.h:942
void setCondition(const QString &condition)
Sets the condition of the breakpoint.
bool toBoolean() const
Use toBool() instead.
qsreal toNumber() const
Returns the number value of this QScriptValue, as defined in ECMA-262 section 9.3, "ToNumber".
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
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
bool isValid() const
Returns true if this QScriptValue is valid; otherwise returns false.
#define enabled

◆ breakpointDataToScriptValue()

static QScriptValue breakpointDataToScriptValue ( QScriptEngine eng,
const QScriptBreakpointData in 
)
static

Definition at line 90 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
bool isSingleShot() const
Returns true if the breakpoint is single-shot, false otherwise.
int ignoreCount() const
Returns the ignore count of the breakpoint.
QScriptValue newObject()
Creates a QtScript object of class Object.
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.
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
double qsreal
Definition: qscriptvalue.h:52
QString condition() const
Returns the condition of the breakpoint.
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

◆ breakpointMapFromScriptValue()

static void breakpointMapFromScriptValue ( const QScriptValue ,
QScriptBreakpointMap  
)
static

Definition at line 130 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

131 {
132  Q_ASSERT(0);
133 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ breakpointMapToScriptValue()

static QScriptValue breakpointMapToScriptValue ( QScriptEngine eng,
const QScriptBreakpointMap in 
)
static

Definition at line 120 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
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
#define it(className, varName)
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
QScriptValue newObject()
Creates a QtScript object of class Object.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
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 QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ consoleCommandFromScriptValue()

static void consoleCommandFromScriptValue ( const QScriptValue ,
QScriptDebuggerConsoleCommand *&   
)
static

Definition at line 183 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

185 {
186  Q_ASSERT(0);
187 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ consoleCommandGroupDataFromScriptValue()

static void consoleCommandGroupDataFromScriptValue ( const QScriptValue ,
QScriptDebuggerConsoleCommandGroupData  
)
static

Definition at line 198 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

200 {
201  Q_ASSERT(0);
202 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ consoleCommandGroupDataToScriptValue()

static QScriptValue consoleCommandGroupDataToScriptValue ( QScriptEngine eng,
const QScriptDebuggerConsoleCommandGroupData in 
)
static

Definition at line 189 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
QScriptValue newObject()
Creates a QtScript object of class Object.
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.
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
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ consoleCommandGroupMapFromScriptValue()

static void consoleCommandGroupMapFromScriptValue ( const QScriptValue ,
QScriptDebuggerConsoleCommandGroupMap  
)
static

Definition at line 215 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

217 {
218  Q_ASSERT(0);
219 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ consoleCommandGroupMapToScriptValue()

static QScriptValue consoleCommandGroupMapToScriptValue ( QScriptEngine eng,
const QScriptDebuggerConsoleCommandGroupMap in 
)
static

Definition at line 204 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
#define it(className, varName)
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
QScriptValue newObject()
Creates a QtScript object of class Object.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
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 QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ consoleCommandToScriptValue()

static QScriptValue consoleCommandToScriptValue ( QScriptEngine eng,
QScriptDebuggerConsoleCommand *const &  in 
)
static

Definition at line 168 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
virtual QString group() const =0
Returns the group that this console command belongs to.
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
virtual QString name() const =0
Returns the name of this console command.
virtual QStringList seeAlso() const
Returns a list of names of commands that may also be of interest to users of this command...
virtual QString shortDescription() const =0
Returns a short (one line) description of the command.
QScriptValue newObject()
Creates a QtScript object of class Object.
virtual QString longDescription() const =0
Returns a detailed description of how to use the command.
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.
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
QScriptValue undefinedValue()
Returns a QScriptValue of the primitive type Undefined.
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
virtual QStringList aliases() const
Returns a list of aliases for this command.

◆ contextInfoFromScriptValue()

static void contextInfoFromScriptValue ( const QScriptValue ,
QScriptContextInfo  
)
static

Definition at line 232 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

233 {
234  Q_ASSERT(0);
235 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ contextInfoToScriptValue()

static QScriptValue contextInfoToScriptValue ( QScriptEngine eng,
const QScriptContextInfo in 
)
static

Definition at line 221 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
QT_DEPRECATED int columnNumber() const
QString fileName() const
Returns the name of the file where the code being executed was defined, if available; otherwise retur...
int lineNumber() const
Returns the line number corresponding to the statement being executed, or -1 if the line number is no...
QScriptValue newObject()
Creates a QtScript object of class Object.
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.
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
double qsreal
Definition: qscriptvalue.h:52
qint64 scriptId() const
Returns the ID of the script where the code being executed was defined, or -1 if the ID is not availa...
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
QString functionName() const
Returns the name of the called function, or an empty string if the name is not available.

◆ debuggerResponseFromScriptValue()

static void debuggerResponseFromScriptValue ( const QScriptValue ,
QScriptDebuggerResponse  
)
static

Definition at line 85 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

86 {
87  Q_ASSERT(0);
88 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ debuggerResponseToScriptValue()

static QScriptValue debuggerResponseToScriptValue ( QScriptEngine eng,
const QScriptDebuggerResponse in 
)
static

Definition at line 76 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
Error error() const
Returns the error code of this response.
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
QScriptValue newObject()
Creates a QtScript object of class Object.
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.
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
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
QVariant result() const
Returns the result of this response.

◆ debuggerScriptValuePropertyFromScriptValue()

static void debuggerScriptValuePropertyFromScriptValue ( const QScriptValue in,
QScriptDebuggerValueProperty out 
)
static

Definition at line 247 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
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...
qint32 toInt32() const
Returns the signed 32-bit integer value of this QScriptValue, using the conversion rules described in...
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
The QString class provides a Unicode character string.
Definition: qstring.h:83
T qscriptvalue_cast(const QScriptValue &value)
Returns the given value converted to the template type T.
const char * name
The QScriptDebuggerValue class represents a script value.
PropertyFlags
Definition: qmetaobject_p.h:61
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

◆ debuggerScriptValuePropertyToScriptValue()

static QScriptValue debuggerScriptValuePropertyToScriptValue ( QScriptEngine eng,
const QScriptDebuggerValueProperty in 
)
static

Definition at line 237 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
QString name() const
Returns the name of this QScriptDebuggerValueProperty.
QScriptDebuggerValue value() const
Returns the value of this QScriptDebuggerValueProperty.
QScriptValue::PropertyFlags flags() const
Returns the flags of this QScriptDebuggerValueProperty.
QScriptValue newObject()
Creates a QtScript object of class Object.
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.
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
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ scriptDataFromScriptValue()

static void scriptDataFromScriptValue ( const QScriptValue in,
QScriptScriptData out 
)
static

Definition at line 144 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
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...
qint32 toInt32() const
Returns the signed 32-bit integer value of this QScriptValue, using the conversion rules described in...
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QScriptScriptData class holds data associated with a script.
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 QString fileName(const QString &fileUrl)

◆ scriptDataToScriptValue()

static QScriptValue scriptDataToScriptValue ( QScriptEngine eng,
const QScriptScriptData in 
)
static

Definition at line 135 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
QScriptValue newObject()
Creates a QtScript object of class Object.
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.
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
QString contents() const
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
QString fileName() const

◆ scriptMapFromScriptValue()

static void scriptMapFromScriptValue ( const QScriptValue ,
QScriptScriptMap  
)
static

Definition at line 163 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

164 {
165  Q_ASSERT(0);
166 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ scriptMapToScriptValue()

static QScriptValue scriptMapToScriptValue ( QScriptEngine eng,
const QScriptScriptMap in 
)
static

Definition at line 153 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerConsolePrivate::QScriptDebuggerConsolePrivate().

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 }
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
#define it(className, varName)
QScriptValue toScriptValue(const T &value)
Creates a QScriptValue with the given value.
QScriptValue newObject()
Creates a QtScript object of class Object.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
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 QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57