lib
Kross::Api::ScriptContainer Class Reference
#include <scriptcontainer.h>
Inheritance diagram for Kross::Api::ScriptContainer:

Detailed Description
The ScriptContainer class is something like a single standalone scriptfile.Once you've such a ScriptContainer instance you're able to perform actions with it like to execute scripting code. The Manager takes care of handling the ScriptContainer instances application width.
The class ScriptAction provides a higher level class to work with a ScriptContainer instances.
Definition at line 50 of file scriptcontainer.h.
Public Types | |
typedef KSharedPtr< ScriptContainer > | Ptr |
Public Member Functions | |
virtual | ~ScriptContainer () |
const QString | getName () const |
void | setName (const QString &name) |
QString | getCode () const |
void | setCode (const QString &code) |
QString | getInterpreterName () const |
void | setInterpreterName (const QString &interpretername) |
QString | getFile () const |
void | setFile (const QString &scriptfile) |
QMap< QString, QVariant > & | getOptions () |
QVariant | getOption (const QString name, QVariant defaultvalue=QVariant(), bool recursive=false) |
bool | setOption (const QString name, const QVariant &value) |
Object::Ptr | execute () |
const QStringList | getFunctionNames () |
KSharedPtr< Object > | callFunction (const QString &functionname, KSharedPtr< List > arguments=0) |
QStringList | getClassNames () |
KSharedPtr< Object > | classInstance (const QString &classname) |
bool | initialize () |
void | finalize () |
Protected Member Functions | |
ScriptContainer (const QString &name=QString::null) | |
Friends | |
class | Manager |
Member Typedef Documentation
typedef KSharedPtr<ScriptContainer> Kross::Api::ScriptContainer::Ptr |
Shared pointer to implement reference-counting.
Reimplemented from Kross::Api::MainModule.
Reimplemented in Kross::Api::ScriptAction.
Definition at line 75 of file scriptcontainer.h.
Constructor & Destructor Documentation
ScriptContainer::ScriptContainer | ( | const QString & | name = QString::null |
) | [explicit, protected] |
Constructor.
The constructor is protected cause only with the ScriptManager it's possible to access ScriptContainer instances.
- Parameters:
-
name The unique name this ScriptContainer has. It's used e.g. at the Manager to identify the ScriptContainer.
Definition at line 86 of file scriptcontainer.cpp.
ScriptContainer::~ScriptContainer | ( | ) | [virtual] |
Member Function Documentation
const QString ScriptContainer::getName | ( | ) | const |
- Returns:
- the unique name this ScriptContainer is reachable as.
Reimplemented from Kross::Api::Callable.
Definition at line 104 of file scriptcontainer.cpp.
void ScriptContainer::setName | ( | const QString & | name | ) |
Set the name this ScriptContainer is reachable as.
Definition at line 109 of file scriptcontainer.cpp.
QString ScriptContainer::getCode | ( | ) | const |
Return the scriptcode this ScriptContainer holds.
Definition at line 114 of file scriptcontainer.cpp.
void ScriptContainer::setCode | ( | const QString & | code | ) |
QString ScriptContainer::getInterpreterName | ( | ) | const |
- Returns:
- the name of the interpreter used on execute.
Definition at line 125 of file scriptcontainer.cpp.
void ScriptContainer::setInterpreterName | ( | const QString & | interpretername | ) |
Set the name of the interpreter used on execute.
Reimplemented in Kross::Api::ScriptAction.
Definition at line 130 of file scriptcontainer.cpp.
QString ScriptContainer::getFile | ( | ) | const |
- Returns:
- the filename which will be executed on execute.
Definition at line 136 of file scriptcontainer.cpp.
void ScriptContainer::setFile | ( | const QString & | scriptfile | ) |
Set the filename which will be executed on execute.
The scriptfile
needs to be a valid local file or QString::null if you don't like to use a file rather then the with setCode() defined scripting code.
Definition at line 141 of file scriptcontainer.cpp.
QMap< QString, QVariant > & ScriptContainer::getOptions | ( | ) |
- Returns:
- a map of options this ScriptContainer defines.
The options are returned call-by-ref, so you are able to manipulate them.
Definition at line 147 of file scriptcontainer.cpp.
QVariant ScriptContainer::getOption | ( | const QString | name, | |
QVariant | defaultvalue = QVariant() , |
|||
bool | recursive = false | |||
) |
- Returns:
- the value of the option defined with
name
.
If there doesn't exists an option with such a name, the defaultvalue
is returned. If recursive
is true then first the ScriptContainer options are seeked for the matching name
and if not found the Manager options are seeked for the name
and if not found either the defaultvalue
is returned.
Definition at line 152 of file scriptcontainer.cpp.
bool ScriptContainer::setOption | ( | const QString | name, | |
const QVariant & | value | |||
) |
Object::Ptr ScriptContainer::execute | ( | ) |
const QStringList ScriptContainer::getFunctionNames | ( | ) |
Return a list of functionnames the with setCode defined scriptcode spends.
Definition at line 190 of file scriptcontainer.cpp.
KSharedPtr<Object> Kross::Api::ScriptContainer::callFunction | ( | const QString & | functionname, | |
KSharedPtr< List > | arguments = 0 | |||
) |
Call a function in the script container.
- Parameters:
-
functionname The name of the function to call. arguments Optional list of arguments passed to the function.
- Returns:
- Object instance representing the functioncall returnvalue.
QStringList ScriptContainer::getClassNames | ( | ) |
Object::Ptr ScriptContainer::classInstance | ( | const QString & | classname | ) |
bool ScriptContainer::initialize | ( | ) |
Initialize the Script instance.
Normaly it's not needed to call this function direct cause if will be internaly called if needed (e.g. on execute ).
Definition at line 242 of file scriptcontainer.cpp.
void ScriptContainer::finalize | ( | ) |
Finalize the Script instance and free's any cached or still running executions.
Normaly it's not needed to call this function direct cause the ScriptContainer will take care of calling it if needed.
Reimplemented in Kross::Api::ScriptAction.
Definition at line 287 of file scriptcontainer.cpp.
The documentation for this class was generated from the following files: