Links a script to a script interpreter derived instance.
More...
#include <ScriptLink.h>
|
| ScriptLink (ScriptInterpreter *compiler, bool owner) |
| Constructor passing a script interpreter.
|
|
virtual | ~ScriptLink () |
| Destructor stopping any running script. Deletes the interpreter when it is set to be the owner.
|
|
void | setOutputStream (std::ostream *os) |
| Sets and enables debugging output stream.
|
|
ScriptInterpreter & | getInterpreter () |
| Gets the reference to the interpreter of this instance.
|
|
const ScriptInterpreter & | getInterpreter () const |
| Gets the const reference to the interpreter of this instance.
|
|
bool | setScript (const std::string &script) |
| Stops and flushes a running script and sets a new script.
|
|
std::string | getScript () const |
| Gets the script text.
|
|
bool | initialize () |
| Initializes the script with a execution of the interpreter sf::ScriptInterpreter::emInit .
|
|
bool | compile () |
| Compiles the set script using the set interpreter.
|
|
void | abort () |
| Stops the script when it is running.
|
|
void | flush () |
| Flushes the interpreter script allowing recompiling the script.
|
|
void | start () |
| Starts a script in the background depending on the background flag.
|
|
void | execute () |
| Executes the script according to the settings.
|
|
bool | run (bool bk_gnd) |
| Compiles, initializes and runs or starts the script in the background.
|
|
bool | process () |
| Executes a background processing script.
|
|
std::string | getFile () const |
| Gets the filepath of the loaded script.
|
|
bool | setFile (const std::string &path) |
| Sets the script filepath and loads the script. When the path is set the file is stored at destruction of the class.
|
|
bool | reloadFile () |
| Reloads the script from the current set file.
|
|
bool | saveFile () |
| Saves the file when the script was set using a file.
|
|
void | setName (const std::string &name) |
| Sets the descriptive name of the script.
|
|
std::string | getName () const |
| Gets the descriptive name of the script.
|
|
bool | isDirty () const |
| Gets dirty flag on the script which means it has changed.
|
|
void | setBackground (bool background=true) |
| Sets the script to be executed in the background.
|
|
bool | isBackground () const |
| Gets the background execution flag.
|
|
Links a script to a script interpreter derived instance.
◆ ScriptLink()
Constructor passing a script interpreter.
- Parameters
-
compiler | Interpreter or derived instance of it. |
owner | Determines if the interpreter is deleted by this class at destruction. |
◆ ~ScriptLink()
virtual sf::ScriptLink::~ScriptLink |
( |
| ) |
|
|
virtual |
Destructor stopping any running script. Deletes the interpreter when it is set to be the owner.
◆ abort()
void sf::ScriptLink::abort |
( |
| ) |
|
Stops the script when it is running.
◆ compile()
bool sf::ScriptLink::compile |
( |
| ) |
|
Compiles the set script using the set interpreter.
◆ execute()
void sf::ScriptLink::execute |
( |
| ) |
|
Executes the script according to the settings.
◆ flush()
void sf::ScriptLink::flush |
( |
| ) |
|
Flushes the interpreter script allowing recompiling the script.
◆ getFile()
std::string sf::ScriptLink::getFile |
( |
| ) |
const |
Gets the filepath of the loaded script.
- Returns
- Length zero means the script is not loaded using a file.
◆ getInterpreter() [1/2]
Gets the reference to the interpreter of this instance.
◆ getInterpreter() [2/2]
Gets the const reference to the interpreter of this instance.
◆ getName()
std::string sf::ScriptLink::getName |
( |
| ) |
const |
Gets the descriptive name of the script.
◆ getScript()
std::string sf::ScriptLink::getScript |
( |
| ) |
const |
◆ initialize()
bool sf::ScriptLink::initialize |
( |
| ) |
|
◆ isBackground()
bool sf::ScriptLink::isBackground |
( |
| ) |
const |
Gets the background execution flag.
- Returns
- True when running in the background is enabled.
◆ isDirty()
bool sf::ScriptLink::isDirty |
( |
| ) |
const |
Gets dirty flag on the script which means it has changed.
- Returns
- True when dirty.
◆ process()
bool sf::ScriptLink::process |
( |
| ) |
|
Executes a background processing script.
- Returns
- True when execute state changed.
◆ reloadFile()
bool sf::ScriptLink::reloadFile |
( |
| ) |
|
Reloads the script from the current set file.
- Returns
- True on successful reading the script.
◆ run()
bool sf::ScriptLink::run |
( |
bool |
bk_gnd | ) |
|
Compiles, initializes and runs or starts the script in the background.
- Parameters
-
- Returns
◆ saveFile()
bool sf::ScriptLink::saveFile |
( |
| ) |
|
Saves the file when the script was set using a file.
- Returns
- True when it was saved successfully.
◆ setBackground()
void sf::ScriptLink::setBackground |
( |
bool |
background = true | ) |
|
Sets the script to be executed in the background.
- Parameters
-
background | Flag determining background execution. |
◆ setFile()
bool sf::ScriptLink::setFile |
( |
const std::string & |
path | ) |
|
Sets the script filepath and loads the script. When the path is set the file is stored at destruction of the class.
- Parameters
-
- Returns
- True on successful reading the script.
◆ setName()
void sf::ScriptLink::setName |
( |
const std::string & |
name | ) |
|
Sets the descriptive name of the script.
◆ setOutputStream()
void sf::ScriptLink::setOutputStream |
( |
std::ostream * |
os | ) |
|
Sets and enables debugging output stream.
◆ setScript()
bool sf::ScriptLink::setScript |
( |
const std::string & |
script | ) |
|
Stops and flushes a running script and sets a new script.
- Parameters
-
- Returns
- True on success.
◆ start()
void sf::ScriptLink::start |
( |
| ) |
|
Starts a script in the background depending on the background flag.
The documentation for this class was generated from the following file: