HoverRace  2.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
HoverRace::Script::Handlers Class Reference

Tracks event handlers registered in scripts. More...

#include <Handlers.h>

Public Member Functions

 Handlers (Core &scripting)
 Constructor. More...
 
 Handlers (const Handlers &)=default
 
 Handlers (Handlers &&)=default
 
virtual ~Handlers ()
 
void AddHandler (const luabind::object &fn)
 Add an unnamed event handler. More...
 
void AddHandler (const std::string &name, const luabind::object &fn)
 Add a named event handler. More...
 
void CallHandlers () const
 Call all registered event handlers without any parameters. More...
 
void CallHandlers (const luabind::object &p1) const
 Call all registered event handlers with a single parameter. More...
 
void CallHandlers (const luabind::object &p1, const luabind::object &p2) const
 Call all registered event handlers with two parameters. More...
 
Handlersoperator= (const Handlers &)=default
 
Handlersoperator= (Handlers &&)=default
 

Protected Member Functions

void Call (int numParams) const
 Call all registered event handlers. More...
 

Private Attributes

RegistryRef ref
 
Corescripting
 
int seq
 

Detailed Description

Tracks event handlers registered in scripts.

Author
Michael Imamura

Constructor & Destructor Documentation

HoverRace::Script::Handlers::Handlers ( Core scripting)

Constructor.

Parameters
scriptingThe scripting core.
HoverRace::Script::Handlers::Handlers ( const Handlers )
default
HoverRace::Script::Handlers::Handlers ( Handlers &&  )
default
virtual HoverRace::Script::Handlers::~Handlers ( )
inlinevirtual

Member Function Documentation

void HoverRace::Script::Handlers::AddHandler ( const luabind::object &  fn)

Add an unnamed event handler.

Parameters
fnThe function to register (may be nil to do nothing).
void HoverRace::Script::Handlers::AddHandler ( const std::string &  name,
const luabind::object &  fn 
)

Add a named event handler.

This will replace any previously-registered handler with the same name.

Parameters
nameThe name to use.
fnThe function to register. May be nil to remove the handler.
void HoverRace::Script::Handlers::Call ( int  numParams) const
protected

Call all registered event handlers.

Parameters
numParamsThe number of parameters on the stack.
void HoverRace::Script::Handlers::CallHandlers ( ) const

Call all registered event handlers without any parameters.

void HoverRace::Script::Handlers::CallHandlers ( const luabind::object &  p1) const

Call all registered event handlers with a single parameter.

void HoverRace::Script::Handlers::CallHandlers ( const luabind::object &  p1,
const luabind::object &  p2 
) const

Call all registered event handlers with two parameters.

Handlers& HoverRace::Script::Handlers::operator= ( const Handlers )
default
Handlers& HoverRace::Script::Handlers::operator= ( Handlers &&  )
default

Member Data Documentation

RegistryRef HoverRace::Script::Handlers::ref
private
Core* HoverRace::Script::Handlers::scripting
private
int HoverRace::Script::Handlers::seq
private

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