[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/activeqt/container/qaxscript.cpp:593 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QAxScript Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <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>
|
---|
| 33 |
|
---|
| 34 | <p>The QAxScript class provides a wrapper around script code.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p>This class is part of the <b>Qt ActiveQt Extension</b>.
|
---|
| 37 | <p><tt>#include <<a href="qaxscript-h.html">qaxscript.h</a>></tt>
|
---|
| 38 | <p>Inherits <a href="qobject.html">QObject</a>.
|
---|
| 39 | <p><a href="qaxscript-members.html">List of all member functions.</a>
|
---|
| 40 | <h2>Public Members</h2>
|
---|
| 41 | <ul>
|
---|
| 42 | <li class=fn>enum <a href="#FunctionFlags-enum"><b>FunctionFlags</b></a> { FunctionNames = 0, FunctionSignatures }</li>
|
---|
| 43 | <li class=fn><a href="#QAxScript"><b>QAxScript</b></a> ( const QString & name, QAxScriptManager * manager )</li>
|
---|
| 44 | <li class=fn><a href="#~QAxScript"><b>~QAxScript</b></a> ()</li>
|
---|
| 45 | <li class=fn>bool <a href="#load"><b>load</b></a> ( const QString & code, const QString & language = QString::null )</li>
|
---|
| 46 | <li class=fn>QStringList <a href="#functions"><b>functions</b></a> ( FunctionFlags flags = FunctionNames ) const</li>
|
---|
| 47 | <li class=fn>QString <a href="#scriptCode"><b>scriptCode</b></a> () const</li>
|
---|
| 48 | <li class=fn>QString <a href="#scriptName"><b>scriptName</b></a> () const</li>
|
---|
| 49 | <li class=fn>QAxScriptEngine * <a href="#scriptEngine"><b>scriptEngine</b></a> () const</li>
|
---|
| 50 | <li class=fn>QVariant <a href="#call"><b>call</b></a> ( const QString & function, const QVariant & var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ), const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 = QVariant ( ) )</li>
|
---|
| 51 | <li class=fn>QVariant <a href="#call-2"><b>call</b></a> ( const QString & function, QValueList<QVariant> & arguments )</li>
|
---|
| 52 | </ul>
|
---|
| 53 | <h2>Signals</h2>
|
---|
| 54 | <ul>
|
---|
| 55 | <li class=fn>void <a href="#entered"><b>entered</b></a> ()</li>
|
---|
| 56 | <li class=fn>void <a href="#finished"><b>finished</b></a> ()</li>
|
---|
| 57 | <li class=fn>void <a href="#finished-2"><b>finished</b></a> ( const QVariant & result )</li>
|
---|
| 58 | <li class=fn>void <a href="#finished-3"><b>finished</b></a> ( int code, const QString & source, const QString & description, const QString & help )</li>
|
---|
| 59 | <li class=fn>void <a href="#stateChanged"><b>stateChanged</b></a> ( int state )</li>
|
---|
| 60 | <li class=fn>void <a href="#error"><b>error</b></a> ( int code, const QString & description, int sourcePosition, const QString & sourceText )</li>
|
---|
| 61 | </ul>
|
---|
| 62 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 63 | <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.
|
---|
| 64 | <p>
|
---|
| 65 |
|
---|
| 66 | The QAxScript class provides a wrapper around script code.
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | <p> Every instance of the QAxScript class represents a piece of
|
---|
| 70 | scripting code in a particular scripting language. The code is
|
---|
| 71 | loaded into the script engine using <a href="#load">load</a>(). Functions declared
|
---|
| 72 | in the code can be called using <a href="#call">call</a>().
|
---|
| 73 | <p> The script provides <a href="#scriptEngine">scriptEngine</a>() provides feedback to the
|
---|
| 74 | application through signals. The most important signal is the
|
---|
| 75 | <a href="#error">error</a>() signal. Direct access to the <a href="qaxscriptengine.html">QAxScriptEngine</a> is provided
|
---|
| 76 | through the scriptEngine() function.
|
---|
| 77 | <p> <b>Warning:</b> This class is not available with the bcc5.5 and MingW
|
---|
| 78 | compilers.
|
---|
| 79 |
|
---|
| 80 | <hr><h2>Member Type Documentation</h2>
|
---|
| 81 | <h3 class=fn><a name="FunctionFlags-enum"></a>QAxScript::FunctionFlags</h3>
|
---|
| 82 |
|
---|
| 83 | <p> This FunctionFlags enum describes formatting for function introspection.
|
---|
| 84 | <ul>
|
---|
| 85 | <li><tt>QAxScript::FunctionNames</tt> - Only function names are returned.
|
---|
| 86 | <li><tt>QAxScript::FunctionSignatures</tt> - Returns the functions with signatures.
|
---|
| 87 | </ul>
|
---|
| 88 | <hr><h2>Member Function Documentation</h2>
|
---|
| 89 | <h3 class=fn><a name="QAxScript"></a>QAxScript::QAxScript ( const <a href="qstring.html">QString</a> & name, <a href="qaxscriptmanager.html">QAxScriptManager</a> * manager )
|
---|
| 90 | </h3>
|
---|
| 91 | Constructs a QAxScript object called <em>name</em> and registers
|
---|
| 92 | it with the <a href="qaxscriptmanager.html">QAxScriptManager</a> <em>manager</em>. This is usually done by the
|
---|
| 93 | QAxScriptManager class when <a href="qaxscriptmanager.html#load">loading a
|
---|
| 94 | script</a>.
|
---|
| 95 | <p> A script should always have a name. A manager is necessary to allow
|
---|
| 96 | the script code to reference objects in the application. The <em>manager</em>
|
---|
| 97 | takes ownership of the object.
|
---|
| 98 |
|
---|
| 99 | <h3 class=fn><a name="~QAxScript"></a>QAxScript::~QAxScript ()
|
---|
| 100 | </h3>
|
---|
| 101 | Destroys the object, releasing all allocated resources.
|
---|
| 102 |
|
---|
| 103 | <h3 class=fn><a href="qvariant.html">QVariant</a> <a name="call"></a>QAxScript::call ( const <a href="qstring.html">QString</a> & function, const <a href="qvariant.html">QVariant</a> & var1 = QVariant ( ), const <a href="qvariant.html">QVariant</a> & var2 = QVariant ( ), const <a href="qvariant.html">QVariant</a> & var3 = QVariant ( ), const <a href="qvariant.html">QVariant</a> & var4 = QVariant ( ), const <a href="qvariant.html">QVariant</a> & var5 = QVariant ( ), const <a href="qvariant.html">QVariant</a> & var6 = QVariant ( ), const <a href="qvariant.html">QVariant</a> & var7 = QVariant ( ), const <a href="qvariant.html">QVariant</a> & var8 = QVariant ( ) )
|
---|
| 104 | </h3>
|
---|
| 105 | Calls <em>function</em>, passing the parameters <em>var1</em>, <em>var1</em>,
|
---|
| 106 | <em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>, <em>var6</em>, <em>var7</em> and <em>var8</em>
|
---|
| 107 | as arguments and returns the value returned by the function, or an
|
---|
| 108 | invalid <a href="qvariant.html">QVariant</a> if the function does not return a value or when
|
---|
| 109 | the function call failed.
|
---|
| 110 | <p> See <a href="qaxscriptmanager.html#call">QAxScriptManager::call</a>() for more information about how to call
|
---|
| 111 | script functions.
|
---|
| 112 |
|
---|
| 113 | <h3 class=fn><a href="qvariant.html">QVariant</a> <a name="call-2"></a>QAxScript::call ( const <a href="qstring.html">QString</a> & function, <a href="qvaluelist.html">QValueList</a><QVariant> & arguments )
|
---|
| 114 | </h3>
|
---|
| 115 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 116 | <p> Calls <em>function</em> passing <em>arguments</em> as parameters, and returns
|
---|
| 117 | the result. Returns when the script's execution has finished.
|
---|
| 118 | <p> See <a href="qaxscriptmanager.html#call">QAxScriptManager::call</a>() for more information about how to call
|
---|
| 119 | script functions.
|
---|
| 120 |
|
---|
| 121 | <h3 class=fn>void <a name="entered"></a>QAxScript::entered ()<tt> [signal]</tt>
|
---|
| 122 | </h3>
|
---|
| 123 | <p> This signal is emitted when a script engine has started executing code.
|
---|
| 124 |
|
---|
| 125 | <h3 class=fn>void <a name="error"></a>QAxScript::error ( int code, const <a href="qstring.html">QString</a> & description, int sourcePosition, const <a href="qstring.html">QString</a> & sourceText )<tt> [signal]</tt>
|
---|
| 126 | </h3>
|
---|
| 127 |
|
---|
| 128 | <p> This signal is emitted when an execution error occured while
|
---|
| 129 | running a script.
|
---|
| 130 | <p> <em>code</em>, <em>description</em>, <em>sourcePosition</em> and <em>sourceText</em>
|
---|
| 131 | contain information about the execution error.
|
---|
| 132 |
|
---|
| 133 | <h3 class=fn>void <a name="finished"></a>QAxScript::finished ()<tt> [signal]</tt>
|
---|
| 134 | </h3>
|
---|
| 135 | <p> This signal is emitted when a script engine has finished executing code.
|
---|
| 136 |
|
---|
| 137 | <h3 class=fn>void <a name="finished-2"></a>QAxScript::finished ( const <a href="qvariant.html">QVariant</a> & result )<tt> [signal]</tt>
|
---|
| 138 | </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 139 | <p> <em>result</em> contains the script's result. This will be an invalid
|
---|
| 140 | <a href="qvariant.html">QVariant</a> if the script has no return value.
|
---|
| 141 |
|
---|
| 142 | <h3 class=fn>void <a name="finished-3"></a>QAxScript::finished ( int code, const <a href="qstring.html">QString</a> & source, const <a href="qstring.html">QString</a> & description, const <a href="qstring.html">QString</a> & help )<tt> [signal]</tt>
|
---|
| 143 | </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 144 | <p> <em>code</em>, <em>source</em>, <em>description</em> and <em>help</em> contain exception information
|
---|
| 145 | when the script terminated.
|
---|
| 146 |
|
---|
| 147 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="functions"></a>QAxScript::functions ( <a href="qaxscript.html#FunctionFlags-enum">FunctionFlags</a> flags = FunctionNames ) const
|
---|
| 148 | </h3>
|
---|
| 149 | Returns a list of all the functions in this script if the respective
|
---|
| 150 | script engine supports introspection; otherwise returns an empty list.
|
---|
| 151 | The functions are either provided with full prototypes or only as
|
---|
| 152 | names, depending on the value of <em>flags</em>.
|
---|
| 153 | <p> <p>See also <a href="qaxscriptengine.html#hasIntrospection">QAxScriptEngine::hasIntrospection</a>().
|
---|
| 154 |
|
---|
| 155 | <h3 class=fn>bool <a name="load"></a>QAxScript::load ( const <a href="qstring.html">QString</a> & code, const <a href="qstring.html">QString</a> & language = QString::null )
|
---|
| 156 | </h3>
|
---|
| 157 | Loads the script source <em>code</em> written in language <em>language</em>
|
---|
| 158 | into the script engine. Returns TRUE if <em>code</em> was successfully
|
---|
| 159 | entered into the script engine; otherwise returns FALSE.
|
---|
| 160 | <p> If <em>language</em> is empty (the default) it will be determined
|
---|
| 161 | heuristically. If <em>code</em> contains the string <tt>End Sub</tt> it will
|
---|
| 162 | be interpreted as VBScript, otherwise as JScript. Additional
|
---|
| 163 | scripting languages can be registered using
|
---|
| 164 | QAxScript::registerEngine().
|
---|
| 165 | <p> This function can only be called once for each QAxScript object,
|
---|
| 166 | which is done automatically when using <a href="qaxscriptmanager.html#load">QAxScriptManager::load</a>().
|
---|
| 167 |
|
---|
| 168 | <h3 class=fn><a href="qstring.html">QString</a> <a name="scriptCode"></a>QAxScript::scriptCode () const
|
---|
| 169 | </h3>
|
---|
| 170 | Returns the script's code, or the null-string if no
|
---|
| 171 | code has been loaded yet.
|
---|
| 172 | <p> <p>See also <a href="#load">load</a>().
|
---|
| 173 |
|
---|
| 174 | <h3 class=fn><a href="qaxscriptengine.html">QAxScriptEngine</a> * <a name="scriptEngine"></a>QAxScript::scriptEngine () const
|
---|
| 175 | </h3>
|
---|
| 176 | Returns a pointer to the script engine.
|
---|
| 177 | <p> You can use the object returned to connect signals to the
|
---|
| 178 | script functions, or to access the script engine directly.
|
---|
| 179 |
|
---|
| 180 | <h3 class=fn><a href="qstring.html">QString</a> <a name="scriptName"></a>QAxScript::scriptName () const
|
---|
| 181 | </h3>
|
---|
| 182 | Returns the name of the script.
|
---|
| 183 |
|
---|
| 184 | <h3 class=fn>void <a name="stateChanged"></a>QAxScript::stateChanged ( int state )<tt> [signal]</tt>
|
---|
| 185 | </h3>
|
---|
| 186 | <p> This signal is emitted when a script engine changes state.
|
---|
| 187 | <em>state</em> can be any value in the QAxScriptEngineState enumeration.
|
---|
| 188 |
|
---|
| 189 | <!-- eof -->
|
---|
| 190 | <hr><p>
|
---|
| 191 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 192 | Copyright © 1995-2007
|
---|
| 193 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 194 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 195 | <td>Copyright © 2007
|
---|
| 196 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 197 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 198 | </table></div></address></body>
|
---|
| 199 | </html>
|
---|