summaryrefslogtreecommitdiffstats
path: root/doc/html/qaxscript.html
blob: 8219b0a660f9db80f0e9d2c139f784fe16adf6a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/activeqt/container/qaxscript.cpp:593 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QAxScript Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QAxScript Class Reference<br><small>[<a href="qaxcontainer.html">QAxContainer module</a>]</small></h1>

<p>The QAxScript class provides a wrapper around script code.
<a href="#details">More...</a>
<p>This class is part of the <b>Qt ActiveQt Extension</b>.
<p><tt>#include &lt;<a href="qaxscript-h.html">qaxscript.h</a>&gt;</tt>
<p>Inherits <a href="qobject.html">QObject</a>.
<p><a href="qaxscript-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#FunctionFlags-enum"><b>FunctionFlags</b></a> { FunctionNames = 0, FunctionSignatures }</li>
<li class=fn><a href="#QAxScript"><b>QAxScript</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name, QAxScriptManager&nbsp;*&nbsp;manager )</li>
<li class=fn><a href="#~QAxScript"><b>~QAxScript</b></a> ()</li>
<li class=fn>bool <a href="#load"><b>load</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;code, const&nbsp;QString&nbsp;&amp;&nbsp;language = QString::null )</li>
<li class=fn>QStringList <a href="#functions"><b>functions</b></a> ( FunctionFlags&nbsp;flags = FunctionNames ) const</li>
<li class=fn>QString <a href="#scriptCode"><b>scriptCode</b></a> () const</li>
<li class=fn>QString <a href="#scriptName"><b>scriptName</b></a> () const</li>
<li class=fn>QAxScriptEngine * <a href="#scriptEngine"><b>scriptEngine</b></a> () const</li>
<li class=fn>QVariant <a href="#call"><b>call</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;function, const&nbsp;QVariant&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var8 = QVariant ( ) )</li>
<li class=fn>QVariant <a href="#call-2"><b>call</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;function, QValueList&lt;QVariant&gt;&nbsp;&amp;&nbsp;arguments )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#entered"><b>entered</b></a> ()</li>
<li class=fn>void <a href="#finished"><b>finished</b></a> ()</li>
<li class=fn>void <a href="#finished-2"><b>finished</b></a> ( const&nbsp;QVariant&nbsp;&amp;&nbsp;result )</li>
<li class=fn>void <a href="#finished-3"><b>finished</b></a> ( int&nbsp;code, const&nbsp;QString&nbsp;&amp;&nbsp;source, const&nbsp;QString&nbsp;&amp;&nbsp;description, const&nbsp;QString&nbsp;&amp;&nbsp;help )</li>
<li class=fn>void <a href="#stateChanged"><b>stateChanged</b></a> ( int&nbsp;state )</li>
<li class=fn>void <a href="#error"><b>error</b></a> ( int&nbsp;code, const&nbsp;QString&nbsp;&amp;&nbsp;description, int&nbsp;sourcePosition, const&nbsp;QString&nbsp;&amp;&nbsp;sourceText )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> This class is defined in the <b>Qt <a href="activeqt.html#ActiveQt">ActiveQt</a> Extension</b>, which can be found in the <tt>qt/extensions</tt> directory. It is not included in the main Qt API.
<p>

The QAxScript class provides a wrapper around script code.


<p> Every instance of the QAxScript class represents a piece of
scripting code in a particular scripting language. The code is
loaded into the script engine using <a href="#load">load</a>(). Functions declared
in the code can be called using <a href="#call">call</a>(). 
<p> The script provides <a href="#scriptEngine">scriptEngine</a>() provides feedback to the 
application through signals. The most important signal is the 
<a href="#error">error</a>() signal. Direct access to the <a href="qaxscriptengine.html">QAxScriptEngine</a> is provided
through the scriptEngine() function.
<p> <b>Warning:</b> This class is not available with the bcc5.5 and MingW
compilers.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="FunctionFlags-enum"></a>QAxScript::FunctionFlags</h3>

<p> This FunctionFlags enum describes formatting for function introspection.
<ul>
<li><tt>QAxScript::FunctionNames</tt> - Only function names are returned.
<li><tt>QAxScript::FunctionSignatures</tt> - Returns the functions with signatures.
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QAxScript"></a>QAxScript::QAxScript ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name, <a href="qaxscriptmanager.html">QAxScriptManager</a>&nbsp;*&nbsp;manager )
</h3>
Constructs a QAxScript object called <em>name</em> and registers
it with the <a href="qaxscriptmanager.html">QAxScriptManager</a> <em>manager</em>. This is usually done by the
QAxScriptManager class when <a href="qaxscriptmanager.html#load">loading a 
    script</a>.
<p> A script should always have a name. A manager is necessary to allow
the script code to reference objects in the application. The <em>manager</em>
takes ownership of the object.

<h3 class=fn><a name="~QAxScript"></a>QAxScript::~QAxScript ()
</h3>
Destroys the object, releasing all allocated resources.

<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="call"></a>QAxScript::call ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;function, const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var8 = QVariant ( ) )
</h3>
Calls <em>function</em>, passing the parameters <em>var1</em>, <em>var1</em>, 
<em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>, <em>var6</em>, <em>var7</em> and <em>var8</em>
as arguments and returns the value returned by the function, or an 
invalid <a href="qvariant.html">QVariant</a> if the function does not return a value or when 
the function call failed.
<p> See <a href="qaxscriptmanager.html#call">QAxScriptManager::call</a>() for more information about how to call
script functions.

<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="call-2"></a>QAxScript::call ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;function, <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt;&nbsp;&amp;&nbsp;arguments )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Calls <em>function</em> passing <em>arguments</em> as parameters, and returns
the result. Returns when the script's execution has finished.
<p> See <a href="qaxscriptmanager.html#call">QAxScriptManager::call</a>() for more information about how to call
script functions.

<h3 class=fn>void <a name="entered"></a>QAxScript::entered ()<tt> [signal]</tt>
</h3> 
<p> This signal is emitted when a script engine has started executing code.

<h3 class=fn>void <a name="error"></a>QAxScript::error ( int&nbsp;code, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;description, int&nbsp;sourcePosition, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;sourceText )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when an execution error occured while
running a script.
<p> <em>code</em>, <em>description</em>, <em>sourcePosition</em> and <em>sourceText</em>
contain information about the execution error.

<h3 class=fn>void <a name="finished"></a>QAxScript::finished ()<tt> [signal]</tt>
</h3> 
<p> This signal is emitted when a script engine has finished executing code.

<h3 class=fn>void <a name="finished-2"></a>QAxScript::finished ( const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;result )<tt> [signal]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>result</em> contains the script's result. This will be an invalid
<a href="qvariant.html">QVariant</a> if the script has no return value.

<h3 class=fn>void <a name="finished-3"></a>QAxScript::finished ( int&nbsp;code, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;source, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;description, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;help )<tt> [signal]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>code</em>, <em>source</em>, <em>description</em> and <em>help</em> contain exception information
when the script terminated.

<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="functions"></a>QAxScript::functions ( <a href="qaxscript.html#FunctionFlags-enum">FunctionFlags</a>&nbsp;flags = FunctionNames ) const
</h3>
Returns a list of all the functions in this script if the respective
script engine supports introspection; otherwise returns an empty list.
The functions are either provided with full prototypes or only as 
names, depending on the value of <em>flags</em>.
<p> <p>See also <a href="qaxscriptengine.html#hasIntrospection">QAxScriptEngine::hasIntrospection</a>().

<h3 class=fn>bool <a name="load"></a>QAxScript::load ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;code, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;language = QString::null )
</h3>
Loads the script source <em>code</em> written in language <em>language</em>
into the script engine. Returns TRUE if <em>code</em> was successfully
entered into the script engine; otherwise returns FALSE.
<p> If <em>language</em> is empty (the default) it will be determined 
heuristically. If <em>code</em> contains the string <tt>End Sub</tt> it will 
be interpreted as VBScript, otherwise as JScript. Additional 
scripting languages can be registered using 
QAxScript::registerEngine().
<p> This function can only be called once for each QAxScript object,
which is done automatically when using <a href="qaxscriptmanager.html#load">QAxScriptManager::load</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="scriptCode"></a>QAxScript::scriptCode () const
</h3> 
Returns the script's code, or the null-string if no
code has been loaded yet.
<p> <p>See also <a href="#load">load</a>().

<h3 class=fn><a href="qaxscriptengine.html">QAxScriptEngine</a>&nbsp;* <a name="scriptEngine"></a>QAxScript::scriptEngine () const
</h3> 
Returns a pointer to the script engine.
<p> You can use the object returned to connect signals to the 
script functions, or to access the script engine directly.

<h3 class=fn><a href="qstring.html">QString</a> <a name="scriptName"></a>QAxScript::scriptName () const
</h3> 
Returns the name of the script.

<h3 class=fn>void <a name="stateChanged"></a>QAxScript::stateChanged ( int&nbsp;state )<tt> [signal]</tt>
</h3> 
<p> This signal is emitted when a script engine changes state.
<em>state</em> can be any value in the QAxScriptEngineState enumeration.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>