Kross::Api::Script Class Referenceabstract

#include <script.h>

Inheritance diagram for Kross::Api::Script:
Kross::Python::PythonScript Kross::Ruby::RubyScript

Public Member Functions

 Script (Interpreter *const interpreter, ScriptContainer *const scriptcontainer)
 
virtual ~Script ()
 
bool hadException ()
 
Exception::Ptr getException ()
 
void setException (Exception::Ptr e)
 
void clearException ()
 
virtual Kross::Api::Object::Ptr execute ()=0
 
virtual const TQStringList & getFunctionNames ()=0
 
virtual Kross::Api::Object::Ptr callFunction (const TQString &name, Kross::Api::List::Ptr args)=0
 
virtual const TQStringList & getClassNames ()=0
 
virtual Kross::Api::Object::Ptr classInstance (const TQString &name)=0
 

Protected Attributes

Interpreter *const m_interpreter
 
ScriptContainer *const m_scriptcontainer
 

Detailed Description

Base class for interpreter dependend functionality each script provides.

Each ScriptContainer holds a pointer to a class that implements the Script functionality for the defined Interpreter .

Definition at line 45 of file script.h.

Constructor & Destructor Documentation

◆ Script()

Script::Script ( Interpreter *const  interpreter,
ScriptContainer *const  scriptcontainer 
)

Constructor.

Parameters
interpreterThe Interpreter instance that uses this Script instance.
scriptcontainerThe ScriptContainer instance this script is associated with.

Definition at line 29 of file script.cpp.

◆ ~Script()

Script::~Script ( )
virtual

Destructor.

Definition at line 36 of file script.cpp.

Member Function Documentation

◆ callFunction()

virtual Kross::Api::Object::Ptr Kross::Api::Script::callFunction ( const TQString &  name,
Kross::Api::List::Ptr  args 
)
pure virtual

Call a function.

Exceptions
Exceptionon error.
Parameters
nameThe name of the function to execute.
argsOptional arguments passed to the function.
Returns
The result of the called function. Could be NULL.

Implemented in Kross::Python::PythonScript, and Kross::Ruby::RubyScript.

◆ classInstance()

virtual Kross::Api::Object::Ptr Kross::Api::Script::classInstance ( const TQString &  name)
pure virtual

Create and return a new class instance.

Exceptions
Exceptionon error.
Parameters
nameThe name of the class to create a instance of.
Returns
The new classinstance.

Implemented in Kross::Python::PythonScript, and Kross::Ruby::RubyScript.

◆ clearException()

void Script::clearException ( )

Clear previous exceptions.

If called hadException() will return false again.

Definition at line 55 of file script.cpp.

◆ execute()

virtual Kross::Api::Object::Ptr Kross::Api::Script::execute ( )
pure virtual

Execute the script.

Exceptions
Exceptionon error.
Returns
The execution result. Could be NULL too.

Implemented in Kross::Python::PythonScript, and Kross::Ruby::RubyScript.

◆ getClassNames()

virtual const TQStringList & Kross::Api::Script::getClassNames ( )
pure virtual
Returns
a list of classnames.

Implemented in Kross::Python::PythonScript, and Kross::Ruby::RubyScript.

◆ getException()

Exception::Ptr Script::getException ( )
Returns
the Exception the script throwed.

Definition at line 45 of file script.cpp.

◆ getFunctionNames()

virtual const TQStringList & Kross::Api::Script::getFunctionNames ( )
pure virtual
Returns
a list of callable functionnames this script spends.

Implemented in Kross::Python::PythonScript, and Kross::Ruby::RubyScript.

◆ hadException()

bool Script::hadException ( )
Returns
true if the script throwed an exception else false.

Definition at line 40 of file script.cpp.

◆ setException()

void Script::setException ( Exception::Ptr  e)

Set a new exception this script throwed.

Parameters
eThe Exception .

Definition at line 50 of file script.cpp.

Member Data Documentation

◆ m_interpreter

Interpreter* const Kross::Api::Script::m_interpreter
protected

The Interpreter used to create this Script instance.

Definition at line 128 of file script.h.

◆ m_scriptcontainer

ScriptContainer* const Kross::Api::Script::m_scriptcontainer
protected

The ScriptContainer associated with this Script.

Definition at line 130 of file script.h.


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