HoverRace
2.0
|
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... | |
Handlers & | operator= (const Handlers &)=default |
Handlers & | operator= (Handlers &&)=default |
Protected Member Functions | |
void | Call (int numParams) const |
Call all registered event handlers. More... | |
Private Attributes | |
RegistryRef | ref |
Core * | scripting |
int | seq |
Tracks event handlers registered in scripts.
HoverRace::Script::Handlers::Handlers | ( | Core & | scripting | ) |
Constructor.
scripting | The scripting core. |
|
default |
|
default |
|
inlinevirtual |
void HoverRace::Script::Handlers::AddHandler | ( | const luabind::object & | fn | ) |
Add an unnamed event handler.
fn | The 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.
name | The name to use. |
fn | The function to register. May be nil to remove the handler. |
|
protected |
Call all registered event handlers.
numParams | The 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.
|
private |
|
private |
|
private |