#include <manager_impl.hpp>
Public Types | |
typedef handler_vec::iterator | iterator |
typedef handler_vec::const_iterator | const_iterator |
typedef handler_vec::size_type | size_type |
Public Member Functions | |
t_event_handlers () | |
const handler_list & | get () const |
Read-only access to the handlers with varying event names. More... | |
const handler_list & | get (const std::string &name) const |
Read-only access to the handlers with fixed event names, by event name. More... | |
void | add_event_handler (const config &cfg, manager &man, bool is_menu_item=false) |
Adds an event handler. More... | |
void | remove_event_handler (std::string const &id) |
Removes an event handler, identified by its ID. More... | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
size_type | size () const |
The number of active event handlers. More... | |
handler_ptr & | operator[] (size_type index) |
Access to active event handlers by index. More... | |
Private Types | |
typedef boost::unordered_map < std::string, handler_list > | map_t |
typedef boost::unordered_map < std::string, boost::weak_ptr < event_handler > > | id_map_t |
Private Member Functions | |
void | log_handlers () |
Allows quick locating of handlers by id. More... | |
Static Private Member Functions | |
static std::string | standardize_name (const std::string &name) |
Utility to standardize the event names used in by_name_. More... | |
Private Attributes | |
handler_vec | active_ |
map_t | by_name_ |
Active event handlers. Will not have elements removed unless the t_event_handlers is clear()ed. More... | |
handler_list | dynamic_ |
Active event handlers with fixed event names, organized by event name. More... | |
id_map_t | id_map_ |
Active event handlers with variables in their event names. More... | |
Definition at line 29 of file manager_impl.hpp.
typedef handler_vec::const_iterator game_events::t_event_handlers::const_iterator |
Definition at line 35 of file manager_impl.hpp.
|
private |
Definition at line 31 of file manager_impl.hpp.
typedef handler_vec::iterator game_events::t_event_handlers::iterator |
Definition at line 34 of file manager_impl.hpp.
|
private |
Definition at line 30 of file manager_impl.hpp.
typedef handler_vec::size_type game_events::t_event_handlers::size_type |
Definition at line 49 of file manager_impl.hpp.
|
inline |
Definition at line 51 of file manager_impl.hpp.
void game_events::t_event_handlers::add_event_handler | ( | const config & | cfg, |
manager & | man, | ||
bool | is_menu_item = false |
||
) |
Adds an event handler.
An event with a nonempty ID will not be added if an event with that ID already exists.
Definition at line 108 of file manager_impl.cpp.
References active_, by_name_, DBG_EH, dynamic_, id_map_, log_handlers(), utils::might_contain_variables(), game_events::handler_list::push_back(), utils::split(), and standardize_name().
|
inline |
Definition at line 68 of file manager_impl.hpp.
|
inline |
Definition at line 69 of file manager_impl.hpp.
|
inline |
Definition at line 71 of file manager_impl.hpp.
|
inline |
Definition at line 72 of file manager_impl.hpp.
|
inline |
Read-only access to the handlers with varying event names.
Definition at line 59 of file manager_impl.hpp.
References dynamic_.
const handler_list & game_events::t_event_handlers::get | ( | const std::string & | name | ) | const |
Read-only access to the handlers with fixed event names, by event name.
Definition at line 93 of file manager_impl.cpp.
References by_name_, and standardize_name().
|
private |
Allows quick locating of handlers by id.
Definition at line 46 of file manager_impl.cpp.
References active_, DBG_EH, and lg::debug().
Referenced by add_event_handler(), and remove_event_handler().
|
inline |
Access to active event handlers by index.
Definition at line 77 of file manager_impl.hpp.
void game_events::t_event_handlers::remove_event_handler | ( | std::string const & | id | ) |
Removes an event handler, identified by its ID.
Events with empty IDs cannot be removed.
Definition at line 148 of file manager_impl.cpp.
References DBG_EH, gui2::event::handler, id_map_, and log_handlers().
|
inline |
The number of active event handlers.
Definition at line 75 of file manager_impl.hpp.
|
staticprivate |
Utility to standardize the event names used in by_name_.
This means stripping leading and trailing spaces, and converting internal spaces to underscores.
Definition at line 66 of file manager_impl.cpp.
Referenced by add_event_handler(), and get().
|
private |
Definition at line 38 of file manager_impl.hpp.
Referenced by add_event_handler(), and log_handlers().
|
private |
Active event handlers. Will not have elements removed unless the t_event_handlers is clear()ed.
Definition at line 39 of file manager_impl.hpp.
Referenced by add_event_handler(), and get().
|
private |
Active event handlers with fixed event names, organized by event name.
Definition at line 40 of file manager_impl.hpp.
Referenced by add_event_handler(), and get().
|
private |
Active event handlers with variables in their event names.
Definition at line 41 of file manager_impl.hpp.
Referenced by add_event_handler(), and remove_event_handler().