Qt 4.8
qt-4.8.6
src
script
api
qscriptable.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 "
qscriptable.h
"
25
#include "
qscriptable_p.h
"
26
#include "
qscriptengine.h
"
27
28
QT_BEGIN_NAMESPACE
29
87
QScriptable::QScriptable
()
88
: d_ptr(new
QScriptablePrivate
())
89
{
90
d_ptr
->
q_ptr
=
this
;
91
}
92
96
QScriptable::~QScriptable
()
97
{
98
}
99
105
QScriptEngine
*
QScriptable::engine
()
const
106
{
107
Q_D
(
const
QScriptable
);
108
return
d
->engine;
109
}
110
116
QScriptContext
*
QScriptable::context
()
const
117
{
118
if
(
QScriptEngine
*e =
engine
())
119
return
e->currentContext();
120
121
return
0;
122
}
123
130
QScriptValue
QScriptable::thisObject
()
const
131
{
132
if
(
QScriptContext
*
c
=
context
())
133
return
c
->thisObject();
134
135
return
QScriptValue
();
136
}
137
145
int
QScriptable::argumentCount
()
const
146
{
147
if
(
QScriptContext
*
c
=
context
())
148
return
c
->argumentCount();
149
150
return
-1;
151
}
152
159
QScriptValue
QScriptable::argument
(
int
index
)
const
160
{
161
if
(
QScriptContext
*
c
=
context
())
162
return
c
->argument(index);
163
164
return
QScriptValue
();
165
}
166
167
QT_END_NAMESPACE
QScriptable::QScriptable
QScriptable()
Definition:
qscriptable.cpp:87
d
double d
Definition:
qnumeric_p.h:62
QScriptContext
The QScriptContext class represents a Qt Script function invocation.
Definition:
qscriptcontext.h:39
QScriptablePrivate::q_ptr
QScriptable * q_ptr
Definition:
qscriptable_p.h:56
c
unsigned char c[8]
Definition:
qnumeric_p.h:62
QT_END_NAMESPACE
#define QT_END_NAMESPACE
This macro expands to.
Definition:
qglobal.h:90
QScriptable::engine
QScriptEngine * engine() const
Returns a pointer to the QScriptEngine associated with the current Qt function call, or 0 if the Qt function was not invoked from script code.
Definition:
qscriptable.cpp:105
QScriptable::~QScriptable
~QScriptable()
Definition:
qscriptable.cpp:96
QScriptable::thisObject
QScriptValue thisObject() const
Returns the `this' object associated with the current Qt function call, or an invalid QScriptValue if...
Definition:
qscriptable.cpp:130
Q_D
#define Q_D(Class)
Definition:
qglobal.h:2482
QScriptable::d_ptr
QScopedPointer< QScriptablePrivate > d_ptr
Definition:
qscriptable.h:58
QScriptable
The QScriptable class provides access to the Qt Script environment from Qt C++ member functions...
Definition:
qscriptable.h:45
QScriptEngine
The QScriptEngine class provides an environment for evaluating Qt Script code.
Definition:
qscriptengine.h:104
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition:
qglobal.h:89
qscriptengine.h
QScriptable::argument
QScriptValue argument(int index) const
Returns the function argument at the given index, or an invalid QScriptValue if the Qt function was n...
Definition:
qscriptable.cpp:159
QScriptable::argumentCount
int argumentCount() const
Returns the number of arguments passed to the function in this invocation, or -1 if the Qt function w...
Definition:
qscriptable.cpp:145
QScriptable::context
QScriptContext * context() const
Returns a pointer to the QScriptContext associated with the current Qt function call, or 0 if the Qt function was not invoked from script code.
Definition:
qscriptable.cpp:116
qscriptable.h
index
quint16 index
Definition:
qfontsubset.cpp:116
QScriptablePrivate
Definition:
qscriptable_p.h:43
QScriptValue
The QScriptValue class acts as a container for the Qt Script data types.
Definition:
qscriptvalue.h:57
qscriptable_p.h
Qt 4.8 Source Code Browser