BPS C++ API  2.24.4
BpsScriptEngine Class Reference

The BPS scripting engine. More...

#include <bpsscriptengine.h>

+ Inheritance diagram for BpsScriptEngine:

Signals

void writelnDebug (const QString &aLine)
 This signal is emitted whenever a line shall be written to the debugger output. More...
 
void writelnStderr (const QString &aLine)
 This signal is emitted whenever a line shall be written to the standard error output (stderr). More...
 
void writelnStdout (const QString &aLine)
 This signal is emitted whenever a line shall be written to the standard output (stdout). More...
 

Public Member Functions

QString adjustFileName (const QString &aFilename) const
 Adjusts filename and checks for existance. More...
 
 BpsScriptEngine (QObject *aParent=nullptr)
 Standard constructor for the BpsScriptEngine objects. More...
 
BpsScriptEnginedebug (const QString &aLine)
 Prints a line to debug output. More...
 
QScriptValue eval (const QString &aCode, const QString &aFilename, quint32 aLinenumber=1)
 Evaluates script code, using aFilename as file name and aLinenumber as starting line number. More...
 
QScriptValue eval (const QString &aFilename, quint32 aLinenumber=1)
 Evaluates a script stored in a file. More...
 
BpsScriptEngineperror (const QString &aLine)
 Prints a line to stderr. More...
 
BpsScriptEngineprint (const QString &aLine)
 Prints a line to stdout. More...
 

Detailed Description

The BPS scripting engine.

It is derived from QScriptEnging and implements the BPS extensions.

Constructor & Destructor Documentation

◆ BpsScriptEngine()

BpsScriptEngine::BpsScriptEngine ( QObject aParent = nullptr)

Standard constructor for the BpsScriptEngine objects.

Parameters
aParentPointer to parent object.

Member Function Documentation

◆ adjustFileName()

QString BpsScriptEngine::adjustFileName ( const QString aFilename) const

Adjusts filename and checks for existance.

If the filename is provided without extension, .js will be appended. The file will also be searched in the plugins directory defined in HKLM/IBK Software AG/BPS2/plugins in case it is not found in first place.

Parameters
aFilenameThe file name to adjust.
Returns
The adjusted absolute file name

◆ debug()

BpsScriptEngine& BpsScriptEngine::debug ( const QString aLine)

Prints a line to debug output.

Parameters
aLineThe line to print.
Returns
Reference of current object.

◆ eval() [1/2]

QScriptValue BpsScriptEngine::eval ( const QString aCode,
const QString aFilename,
quint32  aLinenumber = 1 
)

Evaluates script code, using aFilename as file name and aLinenumber as starting line number.

The script code will be evaluated in the current context. The evaluation can cause an exception in the engine; in this case the script exception will be converted and thrown as a BpsException.

Parameters
aCodeThe script code to evaluate.
aFilenameThe file name reported in case of exceptions.
aLinenumberThe first line number to assume for the code fragment.
Returns
The value returned from the script code.

◆ eval() [2/2]

QScriptValue BpsScriptEngine::eval ( const QString aFilename,
quint32  aLinenumber = 1 
)

Evaluates a script stored in a file.

If the filename is provided without extension, .js will be appended. The script code will be evaluated in the current context. The evaluation can cause an exception in the engine; in this case the script exception will be converted and thrown as a BpsException.

Parameters
aFilenameThe name of the file with the script code.
aLinenumberThe first line number to assume for the file.
Returns
The value returned from the script code.

◆ perror()

BpsScriptEngine& BpsScriptEngine::perror ( const QString aLine)

Prints a line to stderr.

Parameters
aLineThe line to print.
Returns
Reference of current object.

◆ print()

BpsScriptEngine& BpsScriptEngine::print ( const QString aLine)

Prints a line to stdout.

Parameters
aLineThe line to print.
Returns
Reference of current object.

◆ writelnDebug

void BpsScriptEngine::writelnDebug ( const QString aLine)
signal

This signal is emitted whenever a line shall be written to the debugger output.

Connect this signal to a slot implementing that output.

Parameters
aLineThe line that shall be written.

◆ writelnStderr

void BpsScriptEngine::writelnStderr ( const QString aLine)
signal

This signal is emitted whenever a line shall be written to the standard error output (stderr).

Connect this signal to a slot implementing that output.

Parameters
aLineThe line that shall be written.

◆ writelnStdout

void BpsScriptEngine::writelnStdout ( const QString aLine)
signal

This signal is emitted whenever a line shall be written to the standard output (stdout).

Connect this signal to a slot implementing that output.

Parameters
aLineThe line that shall be written.

The documentation for this class was generated from the following file: