Kross::Api::ScriptContainer Class Reference

#include <scriptcontainer.h>

Inheritance diagram for Kross::Api::ScriptContainer:
Kross::Api::MainModule Kross::Api::Module Kross::Api::Class< Module > Kross::Api::Event< T > Kross::Api::Callable Kross::Api::Object Kross::Api::ScriptAction

Public Types

typedef TDESharedPtr< ScriptContainer > Ptr
 
- Public Types inherited from Kross::Api::MainModule
typedef TDESharedPtr< MainModule > Ptr
 
- Public Types inherited from Kross::Api::Module
typedef TDESharedPtr< Module > Ptr
 
- Public Types inherited from Kross::Api::Class< Module >
typedef TDESharedPtr< Module > Ptr
 
- Public Types inherited from Kross::Api::Callable
typedef TDESharedPtr< Callable > Ptr
 
- Public Types inherited from Kross::Api::Object
typedef TDESharedPtr< Object > Ptr
 

Public Member Functions

virtual ~ScriptContainer ()
 
const TQString getName () const
 
void setName (const TQString &name)
 
TQString getCode () const
 
void setCode (const TQString &code)
 
TQString getInterpreterName () const
 
void setInterpreterName (const TQString &interpretername)
 
TQString getFile () const
 
void setFile (const TQString &scriptfile)
 
TQStringVariantMap & getOptions ()
 
TQVariant getOption (const TQString name, TQVariant defaultvalue=TQVariant(), bool recursive=false)
 
bool setOption (const TQString name, const TQVariant &value)
 
Object::Ptr execute ()
 
const TQStringList getFunctionNames ()
 
TDESharedPtr< Object > callFunction (const TQString &functionname, TDESharedPtr< List > arguments=0)
 
TQStringList getClassNames ()
 
TDESharedPtr< Object > classInstance (const TQString &classname)
 
bool initialize ()
 
void finalize ()
 
- Public Member Functions inherited from Kross::Api::MainModule
 MainModule (const TQString &name)
 
virtual ~MainModule ()
 
virtual const TQString getClassName () const
 
bool hadException ()
 
Exception::Ptr getException ()
 
void setException (Exception::Ptr exception)
 
EventSignal::Ptr addSignal (const TQString &name, TQObject *sender, TQCString signal)
 
EventSlot::Ptr addSlot (const TQString &name, TQObject *receiver, TQCString slot)
 
QtObject::Ptr addTQObject (TQObject *object, const TQString &name=TQString())
 
EventAction::Ptr addTDEAction (TDEAction *action, const TQString &name=TQString())
 
- Public Member Functions inherited from Kross::Api::Module
 Module (const TQString &name)
 
virtual ~Module ()
 
virtual Kross::Api::Object::Ptr get (const TQString &, void *=0)
 
- Public Member Functions inherited from Kross::Api::Class< Module >
 Class (const TQString &name)
 
virtual ~Class ()
 
 operator Module * ()
 
- Public Member Functions inherited from Kross::Api::Event< T >
 Event (const TQString &name)
 
virtual ~Event ()
 
void addFunction (const TQString &name, FunctionPtr function)
 
void addFunction (const TQString &name, Function *function)
 
template<class RETURNOBJ , class ARG1OBJ , class ARG2OBJ , class ARG3OBJ , class ARG4OBJ , class INSTANCE , typename METHOD >
void addFunction4 (const TQString &name, INSTANCE *instance, METHOD method, ARG1OBJ *arg1=0, ARG2OBJ *arg2=0, ARG3OBJ *arg3=0, ARG4OBJ *arg4=0)
 
template<class RETURNOBJ , class ARG1OBJ , class ARG2OBJ , class ARG3OBJ , class INSTANCE , typename METHOD >
void addFunction3 (const TQString &name, INSTANCE *instance, METHOD method, ARG1OBJ *arg1=0, ARG2OBJ *arg2=0, ARG3OBJ *arg3=0)
 
template<class RETURNOBJ , class ARG1OBJ , class ARG2OBJ , class INSTANCE , typename METHOD >
void addFunction2 (const TQString &name, INSTANCE *instance, METHOD method, ARG1OBJ *arg1=0, ARG2OBJ *arg2=0)
 
template<class RETURNOBJ , class ARG1OBJ , class INSTANCE , typename METHOD >
void addFunction1 (const TQString &name, INSTANCE *instance, METHOD method, ARG1OBJ *arg1=0)
 
template<class RETURNOBJ , class INSTANCE , typename METHOD >
void addFunction0 (const TQString &name, INSTANCE *instance, METHOD method)
 
bool isAFunction (const TQString &name) const
 
virtual Object::Ptr call (const TQString &name, List::Ptr arguments)
 
- Public Member Functions inherited from Kross::Api::Callable
 Callable (const TQString &name)
 
virtual ~Callable ()
 
const TQString getName () const
 
bool hasChild (const TQString &name) const
 
Object::Ptr getChild (const TQString &name) const
 
TQMap< TQString, Object::Ptr > getChildren () const
 
bool addChild (const TQString &name, Object *object)
 
bool addChild (Callable *object)
 
void removeChild (const TQString &name)
 
void removeAllChildren ()
 
- Public Member Functions inherited from Kross::Api::Object
 Object ()
 
virtual ~Object ()
 
virtual const TQString toString ()
 
virtual Object::Ptr call (const TQString &name, TDESharedPtr< List > arguments)
 
virtual TQStringList getCalls ()
 

Protected Member Functions

 ScriptContainer (const TQString &name=TQString())
 

Friends

class Manager
 

Additional Inherited Members

- Static Public Member Functions inherited from Kross::Api::Class< Module >
static Object::Ptr toObject (TYPE t)
 
- Static Public Member Functions inherited from Kross::Api::Object
template<class T >
static T * fromObject (Object::Ptr object)
 
template<typename TYPE >
static Object::Ptr toObject (TYPE t)
 

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.

Member Typedef Documentation

◆ Ptr

Shared pointer to implement reference-counting.

Definition at line 75 of file scriptcontainer.h.

Constructor & Destructor Documentation

◆ ScriptContainer()

ScriptContainer::ScriptContainer ( const TQString &  name = TQString())
explicitprotected

Constructor.

The constructor is protected cause only with the ScriptManager it's possible to access ScriptContainer instances.

Parameters
nameThe 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::~ScriptContainer ( )
virtual

Destructor.

Definition at line 96 of file scriptcontainer.cpp.

Member Function Documentation

◆ callFunction()

Object::Ptr ScriptContainer::callFunction ( const TQString &  functionname,
TDESharedPtr< List >  arguments = 0 
)

Call a function in the script container.

Parameters
functionnameThe name of the function to call.
argumentsOptional list of arguments passed to the function.
Returns
Object instance representing the functioncall returnvalue.

Definition at line 195 of file scriptcontainer.cpp.

◆ classInstance()

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

Create and return a new class instance.

Definition at line 224 of file scriptcontainer.cpp.

◆ execute()

Object::Ptr ScriptContainer::execute ( )

Execute the script container.

Definition at line 172 of file scriptcontainer.cpp.

◆ finalize()

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.

Definition at line 287 of file scriptcontainer.cpp.

◆ getClassNames()

TQStringList ScriptContainer::getClassNames ( )

Return a list of classes.

Definition at line 219 of file scriptcontainer.cpp.

◆ getCode()

TQString ScriptContainer::getCode ( ) const

Return the scriptcode this ScriptContainer holds.

Definition at line 114 of file scriptcontainer.cpp.

◆ getFile()

TQString ScriptContainer::getFile ( ) const
Returns
the filename which will be executed on execute.

Definition at line 136 of file scriptcontainer.cpp.

◆ getFunctionNames()

const TQStringList ScriptContainer::getFunctionNames ( )

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

Definition at line 190 of file scriptcontainer.cpp.

◆ getInterpreterName()

TQString ScriptContainer::getInterpreterName ( ) const
Returns
the name of the interpreter used on execute.

Definition at line 125 of file scriptcontainer.cpp.

◆ getName()

const TQString ScriptContainer::getName ( ) const
Returns
the unique name this ScriptContainer is reachable as.

Definition at line 104 of file scriptcontainer.cpp.

◆ getOption()

TQVariant ScriptContainer::getOption ( const TQString  name,
TQVariant  defaultvalue = TQVariant(),
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.

◆ getOptions()

TQStringVariantMap & 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.

◆ initialize()

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.

◆ setCode()

void ScriptContainer::setCode ( const TQString &  code)

Set the scriptcode this ScriptContainer holds.

Definition at line 119 of file scriptcontainer.cpp.

◆ setFile()

void ScriptContainer::setFile ( const TQString &  scriptfile)

Set the filename which will be executed on execute.

The scriptfile needs to be a valid local file or TQString() 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.

◆ setInterpreterName()

void ScriptContainer::setInterpreterName ( const TQString &  interpretername)

Set the name of the interpreter used on execute.

Definition at line 130 of file scriptcontainer.cpp.

◆ setName()

void ScriptContainer::setName ( const TQString &  name)

Set the name this ScriptContainer is reachable as.

Definition at line 109 of file scriptcontainer.cpp.

◆ setOption()

bool ScriptContainer::setOption ( const TQString  name,
const TQVariant &  value 
)

Set the Interpreter::Option value.

Definition at line 160 of file scriptcontainer.cpp.

Friends And Related Symbol Documentation

◆ Manager

friend class Manager
friend

Definition at line 55 of file scriptcontainer.h.


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