Kross::Api::Script Class Reference

#include <script.h>

Inheritance diagram for Kross::Api::Script:

Inheritance graph
[legend]
Collaboration diagram for Kross::Api::Script:

Collaboration graph
[legend]
List of all members.

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.

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 QStringListgetFunctionNames ()=0
virtual Kross::Api::Object::Ptr callFunction (const QString &name, Kross::Api::List::Ptr args)=0
virtual const QStringListgetClassNames ()=0
virtual Kross::Api::Object::Ptr classInstance (const QString &name)=0

Protected Attributes

Interpreter *const m_interpreter
 The Interpreter used to create this Script instance.
ScriptContainer *const m_scriptcontainer
 The ScriptContainer associated with this Script.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
interpreter The Interpreter instance that uses this Script instance.
scriptcontainer The ScriptContainer instance this script is associated with.

Definition at line 29 of file script.cpp.

00030     : m_interpreter(interpreter)
00031     , m_scriptcontainer(scriptcontainer)
00032     , m_exception(0)
00033 {
00034 }

Script::~Script  )  [virtual]
 

Destructor.

Definition at line 36 of file script.cpp.

00037 {
00038 }


Member Function Documentation

virtual Kross::Api::Object::Ptr Kross::Api::Script::callFunction const QString name,
Kross::Api::List::Ptr  args
[pure virtual]
 

Call a function.

Exceptions:
Exception on error.
Parameters:
name The name of the function to execute.
args Optional arguments passed to the function.
Returns:
The result of the called function. Could be NULL.

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

virtual Kross::Api::Object::Ptr Kross::Api::Script::classInstance const QString name  )  [pure virtual]
 

Create and return a new class instance.

Exceptions:
Exception on error.
Parameters:
name The name of the class to create a instance of.
Returns:
The new classinstance.

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

Referenced by Kross::Api::ScriptContainer::classInstance().

void Script::clearException  ) 
 

Clear previous exceptions. If called hadException() will return false again.

Definition at line 55 of file script.cpp.

00056 {
00057     m_exception = 0;
00058 }

virtual Kross::Api::Object::Ptr Kross::Api::Script::execute  )  [pure virtual]
 

Execute the script.

Exceptions:
Exception on error.
Returns:
The execution result. Could be NULL too.

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

Referenced by Kross::Api::ScriptContainer::execute().

virtual const QStringList& Kross::Api::Script::getClassNames  )  [pure virtual]
 

Returns:
a list of classnames.

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

Referenced by Kross::Api::ScriptContainer::getClassNames().

Exception::Ptr Script::getException  ) 
 

Returns:
the Exception the script throwed.

Definition at line 45 of file script.cpp.

Referenced by Kross::Api::ScriptContainer::classInstance(), and Kross::Api::ScriptContainer::execute().

00046 {
00047     return m_exception;
00048 }

virtual const QStringList& Kross::Api::Script::getFunctionNames  )  [pure virtual]
 

Returns:
a list of callable functionnames this script spends.

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

Referenced by Kross::Api::ScriptContainer::getFunctionNames().

bool Script::hadException  ) 
 

Returns:
true if the script throwed an exception else false.

Definition at line 40 of file script.cpp.

Referenced by Kross::Python::PythonScript::callFunction(), Kross::Api::ScriptContainer::classInstance(), Kross::Python::PythonScript::classInstance(), and Kross::Api::ScriptContainer::execute().

00041 {
00042     return m_exception != 0;
00043 }

void Script::setException Exception::Ptr  e  ) 
 

Set a new exception this script throwed.

Parameters:
e The Exception .

Definition at line 50 of file script.cpp.

Referenced by Kross::Python::PythonScript::callFunction(), Kross::Python::PythonScript::classInstance(), and Kross::Ruby::RubyScript::execute().

00051 {
00052     m_exception = e;
00053 }


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 18:00:46 2006 for Kross by  doxygen 1.4.6