LUAScriptHook Class Reference

#include <LUAScriptHook.h>

List of all members.

Public Member Functions

 LUAScriptHook (LUAScriptFactory *factory, const std::string &hooksName, const std::string &directoryName)
 ~LUAScriptHook ()
void addHookProvider (const std::string &hookName)
void callHook (const std::string &hookName)
void callHook (const std::string &hookName, const Param &param1)
void callHook (const std::string &hookName, const Param &param1, const Param &param2)
void callHook (const std::string &hookName, const Param &param1, const Param &param2, const Param &param3)
void clearHooks ()
bool loadHooks ()
void listHooks ()

Protected Member Functions

bool loadHook (const std::string &directoryName, const std::string &fileName)
void reloadHooks ()
void callHookInternal (const std::string &hookName, const std::vector< Param > &params)

Protected Attributes

std::string directoryName_
std::string hooksName_
LUAScriptFactoryfactory_
std::map
< std::string,
std::vector
< HookEntry > > 
hookNames_

Classes

struct  HookEntry
class  Param


Detailed Description

Definition at line 29 of file LUAScriptHook.h.


Constructor & Destructor Documentation

LUAScriptHook::LUAScriptHook ( LUAScriptFactory factory,
const std::string hooksName,
const std::string directoryName 
)

Definition at line 29 of file LUAScriptHook.cpp.

References clearHooks(), ConsoleUtil::formParams(), hooksName_, listHooks(), and reloadHooks().

LUAScriptHook::~LUAScriptHook (  ) 

Definition at line 57 of file LUAScriptHook.cpp.


Member Function Documentation

void LUAScriptHook::addHookProvider ( const std::string hookName  ) 

Definition at line 61 of file LUAScriptHook.cpp.

References hookNames_.

Referenced by ServerChannelManager::ChannelEntry::ChannelEntry(), ServerNewGameState::ServerNewGameState(), ServerNextRoundState::ServerNextRoundState(), ServerPlayingState::ServerPlayingState(), and ServerShotFinishedState::ServerShotFinishedState().

void LUAScriptHook::callHook ( const std::string hookName  ) 

Definition at line 68 of file LUAScriptHook.cpp.

References callHookInternal().

Referenced by ServerChannelManager::actualSend(), ServerPlayingState::enterState(), ServerNextRoundState::enterState(), ServerNewGameState::enterState(), and ServerShotFinishedState::scoreWinners().

void LUAScriptHook::callHook ( const std::string hookName,
const Param param1 
)

Definition at line 74 of file LUAScriptHook.cpp.

References callHookInternal().

void LUAScriptHook::callHook ( const std::string hookName,
const Param param1,
const Param param2 
)

Definition at line 81 of file LUAScriptHook.cpp.

References callHookInternal().

void LUAScriptHook::callHook ( const std::string hookName,
const Param param1,
const Param param2,
const Param param3 
)

Definition at line 90 of file LUAScriptHook.cpp.

References callHookInternal().

void LUAScriptHook::clearHooks (  ) 

Definition at line 150 of file LUAScriptHook.cpp.

References hookNames_, and LUAScriptHook::HookEntry::script.

Referenced by loadHooks(), and LUAScriptHook().

bool LUAScriptHook::loadHooks (  ) 

Definition at line 169 of file LUAScriptHook.cpp.

References clearHooks(), directoryName_, FileList::getFiles(), and loadHook().

Referenced by reloadHooks().

void LUAScriptHook::listHooks (  ) 

Definition at line 138 of file LUAScriptHook.cpp.

References S3D::formatStringBuffer(), hookNames_, and Logger::log().

Referenced by LUAScriptHook().

bool LUAScriptHook::loadHook ( const std::string directoryName,
const std::string fileName 
) [protected]

Definition at line 187 of file LUAScriptHook.cpp.

References LUAScriptFactory::createScript(), S3D::dialogMessage(), error(), factory_, file, S3D::formatStringBuffer(), LUAScript::functionExists(), XMLNode::getChildren(), XMLNode::getNamedChild(), XMLFile::getParserError(), XMLFile::getRootNode(), hookNames_, LUAScript::loadFromFile(), and XMLFile::readFile().

Referenced by loadHooks().

void LUAScriptHook::reloadHooks (  )  [inline, protected]

Definition at line 86 of file LUAScriptHook.h.

References loadHooks().

Referenced by LUAScriptHook().

void LUAScriptHook::callHookInternal ( const std::string hookName,
const std::vector< Param > &  params 
) [protected]

Definition at line 100 of file LUAScriptHook.cpp.

References LUAScript::addBoolParameter(), LUAScript::addNumberParameter(), LUAScript::addStringParameter(), LUAScriptHook::Param::eBoolean, LUAScript::endFunction(), LUAScriptHook::Param::eNumber, hookNames_, and LUAScript::startFunction().

Referenced by callHook().


Member Data Documentation

std::string LUAScriptHook::directoryName_ [protected]

Definition at line 82 of file LUAScriptHook.h.

Referenced by loadHooks().

std::string LUAScriptHook::hooksName_ [protected]

Definition at line 82 of file LUAScriptHook.h.

Referenced by LUAScriptHook().

LUAScriptFactory* LUAScriptHook::factory_ [protected]

Definition at line 83 of file LUAScriptHook.h.

Referenced by loadHook().

std::map<std::string, std::vector<HookEntry> > LUAScriptHook::hookNames_ [protected]

Definition at line 84 of file LUAScriptHook.h.

Referenced by addHookProvider(), callHookInternal(), clearHooks(), listHooks(), and loadHook().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:04 2009 for Scorched3D by  doxygen 1.5.3