#include <ScriptManager.hpp>
Public Member Functions | |
ScriptManager (Core::Logger *pLogger) | |
Constructor. | |
~ScriptManager () | |
Destructor. | |
bool | initialize () |
Initialize script manager. | |
void | terminate () |
Terminate script manager. | |
const bool | hasLogger () const |
Indicate if a logger is used for all script-related stuff. | |
Core::Logger * | getLogger () |
Get the logger used for all script-related stuff. | |
HSQUIRRELVM | getSquirrelVM () |
Get the Squirrel virtual machine. | |
bool | load (const std::string &filename) |
Load a script from a file. | |
bool | unload (const std::string &filename) |
Unload a script. | |
bool | execute (const std::string &filename) |
Execute a previously loaded script. | |
Static Private Member Functions | |
static void | squirrelCompilerError (HSQUIRRELVM squirrel_vm, const char *description, const char *source, int line, int column) |
Squirrel compiler error handler. | |
static int | squirrelError (HSQUIRRELVM squirrel_vm) |
Squirrel error handler. | |
static void | squirrelPrint (HSQUIRRELVM squirrel_vm, const char *format,...) |
Squirrel print handler. | |
Private Attributes | |
const unsigned int | m_squirrel_stack_size |
Squirrel stack size. | |
Core::Logger * | m_pLogger |
Pointer to the logger to be used. | |
HSQUIRRELVM | m_squirrelVM |
Squirrel virtual machine. | |
std::map < std::string, HSQOBJECT > | m_mapScripts |
Scripts. | |
Friends | |
class | ScriptExposer |
It is the object responsible for managing all the scripts. Use it to (un)load scripts and then executing them.
syBR::Game::ScriptManager::ScriptManager | ( | Core::Logger * | pLogger | ) |
Constructor.
pLogger | Pointer to the instance of the logger to use |
syBR::Game::ScriptManager::~ScriptManager | ( | ) |
Destructor.
bool syBR::Game::ScriptManager::initialize | ( | ) |
Initialize script manager.
void syBR::Game::ScriptManager::terminate | ( | ) |
Terminate script manager.
const bool syBR::Game::ScriptManager::hasLogger | ( | ) | const |
Indicate if a logger is used for all script-related stuff.
Core::Logger * syBR::Game::ScriptManager::getLogger | ( | ) |
Get the logger used for all script-related stuff.
HSQUIRRELVM syBR::Game::ScriptManager::getSquirrelVM | ( | ) |
Get the Squirrel virtual machine.
bool syBR::Game::ScriptManager::load | ( | const std::string & | filename | ) |
Load a script from a file.
filename | Name of the script file to be loaded |
bool syBR::Game::ScriptManager::unload | ( | const std::string & | filename | ) |
Unload a script.
filename | Name of the script file to be unloaded |
bool syBR::Game::ScriptManager::execute | ( | const std::string & | filename | ) |
Execute a previously loaded script.
filename | Name of the script file to be executed |
void syBR::Game::ScriptManager::squirrelCompilerError | ( | HSQUIRRELVM | squirrel_vm, | |
const char * | description, | |||
const char * | source, | |||
int | line, | |||
int | column | |||
) | [static, private] |
Squirrel compiler error handler.
squirrel_vm | Squirrel virtual machine | |
description | Description of the error | |
source | Compiler source (filename, buffer name...) | |
line | Line of the error | |
column | Column of the error |
int syBR::Game::ScriptManager::squirrelError | ( | HSQUIRRELVM | squirrel_vm | ) | [static, private] |
Squirrel error handler.
squirrel_vm | Squirrel virtual machine |
void syBR::Game::ScriptManager::squirrelPrint | ( | HSQUIRRELVM | squirrel_vm, | |
const char * | format, | |||
... | ||||
) | [static, private] |
Squirrel print handler.
squirrel_vm | Squirrel virtual machine | |
format | Format of the string to display followed by its arguments |
friend class ScriptExposer [friend] |
const unsigned int syBR::Game::ScriptManager::m_squirrel_stack_size [private] |
Squirrel stack size.
Core::Logger* syBR::Game::ScriptManager::m_pLogger [private] |
Pointer to the logger to be used.
HSQUIRRELVM syBR::Game::ScriptManager::m_squirrelVM [private] |
Squirrel virtual machine.
std::map<std::string, HSQOBJECT> syBR::Game::ScriptManager::m_mapScripts [private] |
Scripts.
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:34 2008