![]() |
LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
|
Interface for script loaders. More...
#include "iscriptloader.h"
Public Member Functions | |
virtual | ~IScriptLoaderInstance () |
virtual QObject * | GetQObject ()=0 |
Returns this loader instance as a QObject. More... | |
virtual void | AddGlobalPrefix ()=0 |
Adds a global load prefix. More... | |
virtual void | AddLocalPrefix (QString prefix=QString())=0 |
Adds a local load prefix. More... | |
virtual QStringList | EnumerateScripts () const =0 |
Lists all available scripts. More... | |
virtual QVariantMap | GetScriptInfo (const QString &script)=0 |
Returns the metadata of the given script. More... | |
virtual IScript_ptr | LoadScript (const QString &script)=0 |
Loads the given script. More... | |
Interface for script loaders.
Script loaders are those objects that are directly responsible for loading scripts and exposing them as IScript. Scripts are loaded via the LoadScript() method.
The list of all available scripts with the current set of prefixes could also be obtained via the
The scripts are identified by their name. Script loader must properly append the corresponding extension while checking for the existence of the corresponding script.
The scripts are loaded from the path which is built as concatenation of prefix path (adjusted via AddGlobalPrefix() and AddLocalPrefix() methods), relative path (which is passed to the IScriptLoader::CreateScriptLoaderInstance() method as parameter) and interpreter name. The following interpreter names are defined (and the corresponding extensions):
Several local prefixes could be added by the consecutive calls to AddGlobalPrefix() and AddLocalPrefix() respectively. The script loader must check the prefixes in the reversed order of their addition, so if you want the local scripts to have higher precedence than global ones, you should call AddLocalPrefix() after calling AddGlobalPrefix().
Definition at line 113 of file iscriptloader.h.
|
inlinevirtual |
Definition at line 116 of file iscriptloader.h.
|
pure virtual |
Adds a global load prefix.
This is /usr/[local/]share/leechcraft/scripts
on Unix-like OSes and APP_PATH%/share/scripts
on Windows.
|
pure virtual |
Adds a local load prefix.
This is ~/.leechcraft/data/scripts/ + prefix.
|
pure virtual |
Lists all available scripts.
This function lists the names of all available scripts, ready to be passed to LoadScript(), from the locations available with the current set of prefixes.
|
pure virtual |
Returns this loader instance as a QObject.
|
pure virtual |
Returns the metadata of the given script.
|
pure virtual |
Loads the given script.
This method loads the script identified by the script, and returns an object used to communicate with the script, or a null pointer if the given script could not be loaded.
Please refer to this class' documentation for more information regarding script paths.
[in] | script | The script base name. |