Qt 4.8
qscriptclass.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 QtScript module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL-ONLY$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser
11 ** General Public License version 2.1 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.LGPL included in the
13 ** packaging of this file. Please review the following information to
14 ** ensure the GNU Lesser General Public License version 2.1 requirements
15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** If you have questions regarding the use of this file, please contact
18 ** us via http://www.qt-project.org/.
19 **
20 ** $QT_END_LICENSE$
21 **
22 ****************************************************************************/
23 
24 #include "qscriptclass.h"
25 #include "qscriptstring.h"
26 
124 
126 {
128 public:
130  virtual ~QScriptClassPrivate() {}
131 
133 
135 };
136 
143  : d_ptr(new QScriptClassPrivate)
144 {
145  d_ptr->q_ptr = this;
146  d_ptr->engine = engine;
147 }
148 
153  : d_ptr(&dd)
154 {
155  d_ptr->q_ptr = this;
156  d_ptr->engine = engine;
157 }
158 
167 {
168 }
169 
174 {
175  Q_D(const QScriptClass);
176  return d->engine;
177 }
178 
195 {
196  return QScriptValue();
197 }
198 
208 {
209  return QString();
210 }
211 
241 QScriptClass::QueryFlags QScriptClass::queryProperty(
242  const QScriptValue &object, const QScriptString &name,
243  QueryFlags flags, uint *id)
244 {
245  Q_UNUSED(object);
246  Q_UNUSED(name);
247  Q_UNUSED(flags);
248  Q_UNUSED(id);
249  return 0;
250 }
251 
264  const QScriptString &name, uint id)
265 {
266  Q_UNUSED(object);
267  Q_UNUSED(name);
268  Q_UNUSED(id);
269  return QScriptValue();
270 }
271 
284  const QScriptValue &object, const QScriptString &name, uint id)
285 {
286  Q_UNUSED(object);
287  Q_UNUSED(name);
288  Q_UNUSED(id);
289  return 0;
290 }
291 
306  uint id, const QScriptValue &value)
307 {
308  Q_UNUSED(object);
309  Q_UNUSED(name);
310  Q_UNUSED(id);
311  Q_UNUSED(value);
312 }
313 
331 {
332  Q_UNUSED(object);
333  return 0;
334 }
335 
347 {
348  Q_UNUSED(extension);
349  return false;
350 }
351 
382 {
383  Q_UNUSED(extension);
384  Q_UNUSED(argument);
385  return QVariant();
386 }
387 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
Extension
This enum specifies the possible extensions to a QScriptClass.
Definition: qscriptclass.h:52
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QScriptClass class provides an interface for defining custom behavior of (a class of) Qt Script o...
Definition: qscriptclass.h:43
virtual ~QScriptClassPrivate()
The QString class provides a Unicode character string.
Definition: qstring.h:83
virtual QScriptValue prototype() const
Returns the object to be used as the prototype of new instances of this class (created with QScriptEn...
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptString class acts as a handle to "interned" strings in a QScriptEngine.
Definition: qscriptstring.h:38
virtual bool supportsExtension(Extension extension) const
Returns true if the QScriptClass supports the given extension; otherwise, false is returned...
The QScriptEngine class provides an environment for evaluating Qt Script code.
QScriptEngine * engine() const
Returns the engine that this QScriptClass is associated with.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual QVariant extension(Extension extension, const QVariant &argument=QVariant())
This virtual function can be reimplemented in a QScriptClass subclass to provide support for extensio...
The QScriptClassPropertyIterator class provides an iterator interface for custom Qt Script objects...
unsigned int uint
Definition: qglobal.h:996
virtual QueryFlags queryProperty(const QScriptValue &object, const QScriptString &name, QueryFlags flags, uint *id)
Queries this script class for how access to the property with the given name of the given object shou...
virtual QScriptValue property(const QScriptValue &object, const QScriptString &name, uint id)
Returns the value of the property with the given name of the given object.
virtual ~QScriptClass()
Destroys the QScriptClass object.
virtual void setProperty(QScriptValue &object, const QScriptString &name, uint id, const QScriptValue &value)
Sets the property with the given name of the given object to the given value.
QScriptClass * q_ptr
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
virtual QString name() const
Returns the name of the script class.
PropertyFlags
Definition: qmetaobject_p.h:61
QScriptEngine * engine
QScriptClass(QScriptEngine *engine)
Constructs a QScriptClass object to be used in the given engine.
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
virtual QScriptValue::PropertyFlags propertyFlags(const QScriptValue &object, const QScriptString &name, uint id)
Returns the flags of the property with the given name of the given object.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
virtual QScriptClassPropertyIterator * newIterator(const QScriptValue &object)
Returns an iterator for traversing custom properties of the given object.
QScopedPointer< QScriptClassPrivate > d_ptr
Definition: qscriptclass.h:87