lib

Kross::Api::ScriptContainer Class Reference

#include <scriptcontainer.h>

Inheritance diagram for Kross::Api::ScriptContainer:

Kross::Api::MainModule Kross::Api::Module Kross::Api::Class< T > Kross::Api::Event< T > Kross::Api::Callable Kross::Api::Object Kross::Api::ScriptAction List of all members.

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 51 of file scriptcontainer.h.


Public Types

typedef KSharedPtr< ScriptContainerPtr

Public Member Functions

virtual ~ScriptContainer ()
const QString & getName () const
void setName (const QString &name)
const QString & getCode () const
void setCode (const QString &code)
const QString & getInterpreterName () const
void setInterpreterName (const QString &interpretername)
const QString & getFile () const
void setFile (const QString &scriptfile)
QMap< QString, QVariant > & getOptions ()
const 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< ObjectcallFunction (const QString &functionname, KSharedPtr< List > arguments=0)
const QStringList getClassNames ()
KSharedPtr< ObjectclassInstance (const QString &classname)
bool initialize ()
void finalize ()

Protected Member Functions

 ScriptContainer (const QString &name=QString::null)

Friends

class Manager

Member Typedef Documentation

Shared pointer to implement reference-counting.

Reimplemented from Kross::Api::MainModule.

Reimplemented in Kross::Api::ScriptAction.

Definition at line 76 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]

Destructor.

Definition at line 96 of file scriptcontainer.cpp.


Member Function Documentation

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.

Object::Ptr ScriptContainer::classInstance ( const QString &  classname  ) 

Create and return a new class instance.

Definition at line 224 of file scriptcontainer.cpp.

Object::Ptr ScriptContainer::execute (  ) 

Execute the script container.

Definition at line 172 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.

const QStringList ScriptContainer::getClassNames (  ) 

Return a list of classes.

Definition at line 219 of file scriptcontainer.cpp.

const QString & ScriptContainer::getCode (  )  const

Return the scriptcode this ScriptContainer holds.

Definition at line 114 of file scriptcontainer.cpp.

const QString & ScriptContainer::getFile (  )  const

Returns:
the filename which will be executed on execute.

Definition at line 136 of file scriptcontainer.cpp.

const QStringList ScriptContainer::getFunctionNames (  ) 

Return a list of functionnames the with setCode defined scriptcode spends.

Definition at line 190 of file scriptcontainer.cpp.

const QString & ScriptContainer::getInterpreterName (  )  const

Returns:
the name of the interpreter used on execute.

Definition at line 125 of file scriptcontainer.cpp.

const QString & ScriptContainer::getName (  )  const

Returns:
the unique name this ScriptContainer is reachable as.

Reimplemented from Kross::Api::Object.

Definition at line 104 of file scriptcontainer.cpp.

const 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.

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.

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::setCode ( const QString &  code  ) 

Set the scriptcode this ScriptContainer holds.

Definition at line 119 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.

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.

void ScriptContainer::setName ( const QString &  name  ) 

Set the name this ScriptContainer is reachable as.

Definition at line 109 of file scriptcontainer.cpp.

bool ScriptContainer::setOption ( const QString  name,
const QVariant &  value 
)

Set the Interpreter::Option value.

Definition at line 160 of file scriptcontainer.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys