ScriptLoader Class Reference
[Kernel Module]

#include <scriptloader.h>

Inheritance diagram for ScriptLoader:

Root Object TreeNode< Root > Referenced Counted Serialized List< Root > ListNode< Root > LuaScriptLoader

List of all members.


Detailed Description

The script loader object is the communication point between a Root object's Dispatch() method and a specific scripting language. More specifically, the script server's main task is to translate Cmd objects into script statements and back, and to communicate with receiver Root objects by sending Cmd objects to them (which is done by invoking Dispatch() on the receiver with the Cmd object as the argument).

Script loaders are created and managed by ScriptServer. There can be more than one script loader at the same time.

Public Member Functions

 ScriptLoader (const char *id)
virtual ~ScriptLoader ()
void Exit ()
virtual bool RunCode (const char *code, string &result)
virtual bool RunFunction (const char *func_name, string &result)
bool RunScript (const string &file_path, string &result)
void SetFailOnError (bool b)
bool IsFailOnError ()

Static Public Member Functions

static void SetCurrentTarget (Object *obj)
static ObjectGetCurrentTarget ()

Static Protected Attributes

static Objectcurrent_target = NULL
 Curent object for sending commands.

Private Attributes

bool fail_on_error
 Whether loader aborts the application when some error occures.


Constructor & Destructor Documentation

ScriptLoader::ScriptLoader ( const char *  id  ) 

Constructor.

ScriptLoader::~ScriptLoader (  )  [virtual]

Destructor.


Member Function Documentation

void ScriptLoader::Exit (  ) 

Exits interractive mode.

bool ScriptLoader::RunCode ( const char *  code,
string &  result 
) [virtual]

Runs a script statement.

param code The statement to execute. param result Will be filled with the result.

Returns:
True if successful.

Reimplemented in LuaScriptLoader.

bool ScriptLoader::RunFunction ( const char *  func_name,
string &  result 
) [virtual]

Runs a script function with the specified name without any args.

param func_name The function to invoke. param result Will be filled with the result.

Returns:
True if successful.

Reimplemented in LuaScriptLoader.

bool ScriptLoader::RunScript ( const string &  file_path,
string &  result 
)

Runs a script file.

param file_path The script file name with path. param result Will be filled with the result.

Returns:
True if successful.

void ScriptLoader::SetFailOnError ( bool  fail  )  [inline]

Abort application on error?

Parameters:
fail New abort status.

bool ScriptLoader::IsFailOnError (  )  [inline]

Returns abort program status.

Returns:
Abort status.

void ScriptLoader::SetCurrentTarget ( Object obj  )  [inline, static]

Sets an unnamed object that will receive commands instead of the current working directory.

Object * ScriptLoader::GetCurrentTarget (  )  [inline, static]

Returns the currently set target object.

Returns:
Pointer to unnamed target object.


Member Data Documentation

bool ScriptLoader::fail_on_error [private]

Whether loader aborts the application when some error occures.

Object * ScriptLoader::current_target = NULL [static, protected]

Curent object for sending commands.


The documentation for this class was generated from the following files:
Generated on Sat Oct 20 14:47:35 2007 for Dark Oberon by  doxygen 1.5.3