Carousel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Pages
Public Member Functions | List of all members
IScriptEngineFactory Class Referenceabstract

This interface describes an abstract factory for the QScriptEngine. More...

#include <IScriptEngineFactory.h>

Inherited by ScriptingService.

Public Member Functions

 IScriptEngineFactory ()
 
virtual QScriptEnginecreateEngine (IOutputHandler *output=nullptr, QObject *parent=nullptr)=0
 

Detailed Description

This interface describes an abstract factory for the QScriptEngine.

Because ScriptUnit should create a new QScriptEngine each time it executes a script (to run it from white board, with clean context), it is needed some kind of the QScriptEngine factory, because just instantiate a new instance of the QScriptEngine is not enough - an engine should be already configured and populated with new functions or types from other components.

Also, during configuration, an IOutputHandler is set in such way, that all output, obtained during execution by the QScriptEngine will be redirected to this handler.

By default, the ScriptingService class implements this interface.

See Also
ScriptUnit, ScriptingService

Constructor & Destructor Documentation

IScriptEngineFactory::IScriptEngineFactory ( )
inline

Initializes a new instance of the IScriptEngineFactory class.

Member Function Documentation

virtual QScriptEngine* IScriptEngineFactory::createEngine ( IOutputHandler output = nullptr,
QObject parent = nullptr 
)
pure virtual

Creates a new instance of the QScriptEngine class and populated with new functions or types from other components.

Also, during configuration, an output is set in such way, that all output, obtained during execution by the QScriptEngine will be redirected to this handler.

A parent could be used as a parent for created engine.

Note, that it does not takes ownership for created engine;

Implemented in ScriptingService.