NAMEQAxScriptManager - Bridge between application objects and script code
SYNOPSISThis class is part of the Qt ActiveQt Extension. #include <qaxscript.h> Inherits QObject. Public Members QAxScriptManager ( QObject * parent = 0, const char * name = 0 ) ~QAxScriptManager () void addObject ( QAxBase * object ) void addObject ( QObject * object ) QStringList functions ( QAxScript::FunctionFlags flags = QAxScript::FunctionNames ) const QStringList scriptNames () const QAxScript * script ( const QString & name ) const QAxScript * load ( const QString & code, const QString & name, const QString & language ) QAxScript * load ( const QString & file, const QString & name ) QVariant 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 ( ) ) QVariant call ( const QString & function, QValueList<QVariant> & arguments ) Signals void error ( QAxScript * script, int code, const QString & description, int sourcePosition, const QString & sourceText ) Static Public Members bool registerEngine ( const QString & name, const QString & extension, const QString & code = QString ( ) ) QString scriptFileFilter ()
DESCRIPTIONThis class is defined in the Qt ActiveQt Extension, which can be found in the qt/extensions directory. It is not included in the main Qt API. The QAxScriptManager class provides a bridge between application objects and script code. The QAxScriptManager acts as a bridge between the COM objects embedded in the Qt application through QAxObject or QAxWidget, and the scripting languages available through the Windows Script technologies, usually JScript and VBScript. Create one QAxScriptManager for each separate document in your application, and add the COM objects the scripts need to access using addObject(). Then load() the script sources and invoke the functions using call(). Warning: This class is not available with the bcc5.5 and MingW compilers.
MEMBER FUNCTION DOCUMENTATION
QAXSCRIPTMANAGER::QAXSCRIPTMANAGER ( QOBJECT * PARENT = 0, CONST CHAR * NAME =0 ) Creates a QAxScriptManager object. parent and name are passed on to the QObject constructor. It is usual to create one QAxScriptManager for each document in an application.
QAXSCRIPTMANAGER::~QAXSCRIPTMANAGER ()Destroys the objects, releasing all allocated resources.
VOID QAXSCRIPTMANAGER::ADDOBJECT ( QAXBASE * OBJECT )Adds object to the manager. Scripts handled by this manager can access the object in the code using the object's name property. You must add all the necessary objects before loading any scripts.
VOID QAXSCRIPTMANAGER::ADDOBJECT ( QOBJECT * OBJECT )This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Adds a generic COM wrapper for object to the manager. object must be exposed as a COM object using the functionality provided by the QAxServer module.. Applications using this function you must link against the qaxserver library.
QVARIANT QAXSCRIPTMANAGER::CALL ( CONST QSTRING & FUNCTION,QValueList<QVariant> & arguments ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Calls function passing arguments as parameters, and returns the result. Returns when the script's execution has finished.
VOID QAXSCRIPTMANAGER::ERROR ( QAXSCRIPT * SCRIPT, INT CODE, CONST QSTRING &description, int sourcePosition, const QString & sourceText ) [signal] This signal is emitted when an execution error occured while running script. code, description, sourcePosition and sourceText contain information about the execution error.
QSTRINGLIST QAXSCRIPTMANAGER::FUNCTIONS ( QAXSCRIPT::FUNCTIONFLAGS FLAGS =QAxScript::FunctionNames ) const Returns a list with all the functions that are available. Functions provided by script engines that don't support introspection are not included in the list. The functions are either provided with full prototypes or only as names, depending on the value of flags.
QAXSCRIPT * QAXSCRIPTMANAGER::LOAD ( CONST QSTRING & CODE, CONST QSTRING &name, const QString & language ) Loads the script source code using the script engine for language. The script can later be referred to using its name which should not be empty. The function returns a pointer to the script for the given code if the code was loaded successfully; otherwise it returns 0. If language is empty it will be determined heuristically. If code contains the string "End Sub" it will be interpreted as VBScript, otherwise as JScript. Additional script engines can be registered using registerEngine(). You must add all the objects necessary (using addObject()) before loading any scripts. If code declares a function that is already available (no matter in which language) the first function is overloaded and can no longer be called via call(); but it will still be available by calling its script directly. See also addObject(), scriptNames(), and functions().
QAXSCRIPT * QAXSCRIPTMANAGER::LOAD ( CONST QSTRING & FILE, CONST QSTRING &name ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Loads the source code from the file. The script can later be referred to using its name which should not be empty. The function returns a pointer to the script engine for the code in file if file was loaded successfully; otherwise it returns 0. The script engine used is determined from the file's extension. By default ".js" files are interpreted as JScript files, and ".vbs" and ".dsm" files are interpreted as VBScript. Additional script engines can be registered using registerEngine().
BOOL QAXSCRIPTMANAGER::REGISTERENGINE ( CONST QSTRING & NAME, CONST QSTRING &extension, const QString & code = QString ( ) ) [static] Registers the script engine called name and returns TRUE if the engine was found; otherwise does nothing and returns FALSE. The script engine will be used when loading files with the given extension, or when loading source code that contains the string code.
QAXSCRIPT * QAXSCRIPTMANAGER::SCRIPT ( CONST QSTRING & NAME ) CONSTReturns the script called name. You can use the returned pointer to call functions directly through QAxScript::call(), to access the script engine directly, or to delete and thus unload the script.
QSTRING QAXSCRIPTMANAGER::SCRIPTFILEFILTER () [STATIC]Returns a file filter listing all the supported script languages. This filter string is convenient for use with QFileDialog.
QSTRINGLIST QAXSCRIPTMANAGER::SCRIPTNAMES () CONSTReturns a list with the names of all the scripts.
SEE ALSO//doc.trolltech.com/qaxscriptmanager.html //www.trolltech.com/faq/tech.html
COPYRIGHTCopyright 1992-2007 Trolltech ASA, //www.trolltech.com. See the license file included in the distribution for a complete license statement.
AUTHORGenerated automatically from the source code.
BUGSIf you find a bug in Qt, please report it as described in //doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. 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. If you find errors in this manual page, please report them to qt- firstname.lastname@example.org. Please include the name of the manual page (qaxscriptmanager.3qt) and the Qt version (3.3.8). QAXSCRIPTMANAGER(3)