You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/qaxscript.3qt

170 lines
8.5 KiB

'\" t
.TH QAxScript 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QAxScript \- Wrapper around script code
.SH SYNOPSIS
This class is part of the \fBQt ActiveQt Extension\fR.
.PP
\fC#include <qaxscript.h>\fR
.PP
Inherits QObject.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBFunctionFlags\fR { FunctionNames = 0, FunctionSignatures }"
.br
.ti -1c
.BI "\fBQAxScript\fR ( const QString & name, QAxScriptManager * manager )"
.br
.ti -1c
.BI "\fB~QAxScript\fR ()"
.br
.ti -1c
.BI "bool \fBload\fR ( const QString & code, const QString & language = QString::null )"
.br
.ti -1c
.BI "QStringList \fBfunctions\fR ( FunctionFlags flags = FunctionNames ) const"
.br
.ti -1c
.BI "QString \fBscriptCode\fR () const"
.br
.ti -1c
.BI "QString \fBscriptName\fR () const"
.br
.ti -1c
.BI "QAxScriptEngine * \fBscriptEngine\fR () const"
.br
.ti -1c
.BI "QVariant \fBcall\fR ( 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 ( ) )"
.br
.ti -1c
.BI "QVariant \fBcall\fR ( const QString & function, QValueList<QVariant> & arguments )"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBentered\fR ()"
.br
.ti -1c
.BI "void \fBfinished\fR ()"
.br
.ti -1c
.BI "void \fBfinished\fR ( const QVariant & result )"
.br
.ti -1c
.BI "void \fBfinished\fR ( int code, const QString & source, const QString & description, const QString & help )"
.br
.ti -1c
.BI "void \fBstateChanged\fR ( int state )"
.br
.ti -1c
.BI "void \fBerror\fR ( int code, const QString & description, int sourcePosition, const QString & sourceText )"
.br
.in -1c
.SH DESCRIPTION
This class is defined in the \fBQt ActiveQt Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main Qt API.
.PP
The QAxScript class provides a wrapper around script code.
.PP
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 load(). Functions declared in the code can be called using call().
.PP
The script provides scriptEngine() provides feedback to the application through signals. The most important signal is the error() signal. Direct access to the QAxScriptEngine is provided through the scriptEngine() function.
.PP
\fBWarning:\fR This class is not available with the bcc5.5 and MingW compilers.
.SS "Member Type Documentation"
.SH "QAxScript::FunctionFlags"
This FunctionFlags enum describes formatting for function introspection.
.TP
\fCQAxScript::FunctionNames\fR - Only function names are returned.
.TP
\fCQAxScript::FunctionSignatures\fR - Returns the functions with signatures.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QAxScript::QAxScript ( const QString & name, QAxScriptManager * manager )"
Constructs a QAxScript object called \fIname\fR and registers it with the QAxScriptManager \fImanager\fR. This is usually done by the QAxScriptManager class when loading a script.
.PP
A script should always have a name. A manager is necessary to allow the script code to reference objects in the application. The \fImanager\fR takes ownership of the object.
.SH "QAxScript::~QAxScript ()"
Destroys the object, releasing all allocated resources.
.SH "QVariant QAxScript::call ( 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 ( ) )"
Calls \fIfunction\fR, passing the parameters \fIvar1\fR, \fIvar1\fR, \fIvar2\fR, \fIvar3\fR, \fIvar4\fR, \fIvar5\fR, \fIvar6\fR, \fIvar7\fR and \fIvar8\fR as arguments and returns the value returned by the function, or an invalid QVariant if the function does not return a value or when the function call failed.
.PP
See QAxScriptManager::call() for more information about how to call script functions.
.SH "QVariant QAxScript::call ( const QString & function, QValueList<QVariant> & arguments )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Calls \fIfunction\fR passing \fIarguments\fR as parameters, and returns the result. Returns when the script's execution has finished.
.PP
See QAxScriptManager::call() for more information about how to call script functions.
.SH "void QAxScript::entered ()\fC [signal]\fR"
This signal is emitted when a script engine has started executing code.
.SH "void QAxScript::error ( int code, const QString & description, int sourcePosition, const QString & sourceText )\fC [signal]\fR"
This signal is emitted when an execution error occured while running a script.
.PP
\fIcode\fR, \fIdescription\fR, \fIsourcePosition\fR and \fIsourceText\fR contain information about the execution error.
.SH "void QAxScript::finished ()\fC [signal]\fR"
This signal is emitted when a script engine has finished executing code.
.SH "void QAxScript::finished ( const QVariant & result )\fC [signal]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fIresult\fR contains the script's result. This will be an invalid QVariant if the script has no return value.
.SH "void QAxScript::finished ( int code, const QString & source, const QString & description, const QString & help )\fC [signal]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fIcode\fR, \fIsource\fR, \fIdescription\fR and \fIhelp\fR contain exception information when the script terminated.
.SH "QStringList QAxScript::functions ( FunctionFlags flags = FunctionNames ) const"
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 \fIflags\fR.
.PP
See also QAxScriptEngine::hasIntrospection().
.SH "bool QAxScript::load ( const QString & code, const QString & language = QString::null )"
Loads the script source \fIcode\fR written in language \fIlanguage\fR into the script engine. Returns TRUE if \fIcode\fR was successfully entered into the script engine; otherwise returns FALSE.
.PP
If \fIlanguage\fR is empty (the default) it will be determined heuristically. If \fIcode\fR contains the string \fCEnd Sub\fR it will be interpreted as VBScript, otherwise as JScript. Additional scripting languages can be registered using QAxScript::registerEngine().
.PP
This function can only be called once for each QAxScript object, which is done automatically when using QAxScriptManager::load().
.SH "QString QAxScript::scriptCode () const"
Returns the script's code, or the null-string if no code has been loaded yet.
.PP
See also load().
.SH "QAxScriptEngine * QAxScript::scriptEngine () const"
Returns a pointer to the script engine.
.PP
You can use the object returned to connect signals to the script functions, or to access the script engine directly.
.SH "QString QAxScript::scriptName () const"
Returns the name of the script.
.SH "void QAxScript::stateChanged ( int state )\fC [signal]\fR"
This signal is emitted when a script engine changes state.
\fIstate\fR can be any value in the QAxScriptEngineState enumeration.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qaxscript.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qaxscript.3qt) and the Qt
version (3.3.8).