RScriptHandler
Class in Core Module
Header: #include <src/core/RScriptHandler.h>
Description
Section titled “Description”Abstract base class for all script handlers.
Scriptable: This class is available in script environments.
Public Functions
Section titled “Public Functions”RScriptHandler() |
|
| virtual | ~RScriptHandler() |
| virtual void | abort()=0 = 0 |
| virtual void | autostart(const QString &autostartFile=RDEFAULT_QSTRING, const QStringList &arguments=RDEFAULT_QSTRINGLIST)Looks up and initializes the autostart script(s) available for this script handler. |
| virtual void | createActionApplicationLevel(const QString &scriptFile, RGuiAction *guiAction)=0 = 0 |
| void | createActionApplicationLevelT(const QString &scriptFile, RGuiAction *guiAction)Creates a new application level action by instantiating class T. |
| virtual void | createActionDocumentLevel(const QString &scriptFile, RGuiAction *guiAction, RDocumentInterface *documentInterface=NULL)=0 = 0Creates a script based action for this script handler. |
| void | createActionDocumentLevelT(const QString &scriptFile, RGuiAction *guiAction, RDocumentInterface *documentInterface)Creates a new document level action by instantiating class T and attaching the action to the document interface of the currently active document. |
| virtual RFileImporterAdapter * | createFileImporter(const QString &className, RDocument &document)=0 = 0Creates a file importer from the given class name and for the given document. |
| virtual void | doScript(const QString &scriptFile, const QStringList &arguments=RDEFAULT_QSTRINGLIST)=0 = 0Runs the given script file. |
| virtual QVariant | eval(const QString &script, const QString &fileName=RDEFAULT_QSTRING)=0 = 0Evaluates the given script code. |
| virtual QVariant | evalGlobal(const QString &script, const QString &fileName=RDEFAULT_QSTRING)=0 = 0Evaluates the given script code in a global context. |
| virtual QList< QString > | getSupportedFileExtensions()=0 = 0 |
| virtual bool | hasUncaughtExceptions()=0 = 0 |
| virtual void | init(bool main=false) |
| virtual bool | isRunning()=0 = 0 |
Static Public Functions
Section titled “Static Public Functions”| static void | triggerActionApplicationLevel(const QString &scriptFile, RGuiAction *guiAction=NULL)Runs the given script file as application level action. |
Static Protected Attributes
Section titled “Static Protected Attributes”| static QString | autostartScriptName |
Member Documentation
Section titled “Member Documentation”RScriptHandler
Section titled “RScriptHandler”RScriptHandler::RScriptHandler()inline
~RScriptHandler
Section titled “~RScriptHandler”virtual RScriptHandler::~RScriptHandler()virtual inline
virtual void RScriptHandler::abort()=0 = 0pure virtual
autostart
Section titled “autostart”virtual void RScriptHandler::autostart(const QString &autostartFile=RDEFAULT_QSTRING, const QStringList &arguments=RDEFAULT_QSTRINGLIST)virtual
Looks up and initializes the autostart script(s) available for this script handler.
This method calls initScript for all files with a supported file extension (see getSupportedFileExtensions).
createActionApplicationLevel
Section titled “createActionApplicationLevel”virtual void RScriptHandler::createActionApplicationLevel(const QString &scriptFile, RGuiAction *guiAction)=0 = 0pure virtual
createActionApplicationLevelT
Section titled “createActionApplicationLevelT”template <class T>void RScriptHandler::createActionApplicationLevelT(const QString &scriptFile, RGuiAction *guiAction)inline
Creates a new application level action by instantiating class T.
Application level actions typically do not effect any documents. Application level actions cannot be attached to a document interface or anywhere else, so the action is instantiated, beginEvent is called and then the action is terminated immediately (finishEvent is called).
Non-Scriptable: This function is not available in script environments.
createActionDocumentLevel
Section titled “createActionDocumentLevel”virtual void RScriptHandler::createActionDocumentLevel(const QString &scriptFile, RGuiAction *guiAction, RDocumentInterface *documentInterface=NULL)=0 = 0pure virtual
Creates a script based action for this script handler.
createActionDocumentLevelT
Section titled “createActionDocumentLevelT”template <class T>void RScriptHandler::createActionDocumentLevelT(const QString &scriptFile, RGuiAction *guiAction, RDocumentInterface *documentInterface)inline
Creates a new document level action by instantiating class T and attaching the action to the document interface of the currently active document.
Document level actions typically effect only the current document. Document level actions stay active until they are explicitly finished.
Non-Scriptable: This function is not available in script environments.
createFileImporter
Section titled “createFileImporter”virtual RFileImporterAdapter * RScriptHandler::createFileImporter(const QString &className, RDocument &document)=0 = 0pure virtual
Creates a file importer from the given class name and for the given document.
doScript
Section titled “doScript”virtual void RScriptHandler::doScript(const QString &scriptFile, const QStringList &arguments=RDEFAULT_QSTRINGLIST)=0 = 0pure virtual
Runs the given script file.
virtual QVariant RScriptHandler::eval(const QString &script, const QString &fileName=RDEFAULT_QSTRING)=0 = 0pure virtual
Evaluates the given script code.
evalGlobal
Section titled “evalGlobal”virtual QVariant RScriptHandler::evalGlobal(const QString &script, const QString &fileName=RDEFAULT_QSTRING)=0 = 0pure virtual
Evaluates the given script code in a global context.
getSupportedFileExtensions
Section titled “getSupportedFileExtensions”virtual QList< QString > RScriptHandler::getSupportedFileExtensions()=0 = 0pure virtual
Returns: The file extensions of script files that are supported by this script handler.
hasUncaughtExceptions
Section titled “hasUncaughtExceptions”virtual bool RScriptHandler::hasUncaughtExceptions()=0 = 0pure virtual
virtual void RScriptHandler::init(bool main=false)virtual
isRunning
Section titled “isRunning”virtual bool RScriptHandler::isRunning()=0 = 0pure virtual
Returns: true if the script handle currently is running a script, false otherwise.
triggerActionApplicationLevel
Section titled “triggerActionApplicationLevel”static void RScriptHandler::triggerActionApplicationLevel(const QString &scriptFile, RGuiAction *guiAction=NULL)static
Runs the given script file as application level action.
autostartScriptName
Section titled “autostartScriptName”static QString RScriptHandler::autostartScriptName = "autostart"static protected
All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.