22 #include <unordered_map> 31 using map_t = std::unordered_map<std::string, handler_list>;
32 using id_map_t = std::unordered_map<std::string, weak_handler_ptr>;
104 return active_.size();
handler_list & get_dynamic()
Access to the handlers with varying event names.
static std::string standardize_name(const std::string &name)
Utility to standardize the event names used in by_name_.
std::unordered_map< std::string, handler_list > map_t
void clean_up_expired_handlers(const std::string &event_name)
Removes all expired event handlers and any weak_ptrs to them.
id_map_t id_map_
Allows quick locating of handlers by id.
Definitions for the interface to Wesnoth Markup Language (WML).
const handler_queue_t & get_active() const
Read-only access to the active event handlers.
std::deque< handler_ptr > handler_queue_t
handler_queue_t & get_active()
std::size_t size() const
The number of active event handlers.
void remove_event_handler(const std::string &id)
Removes an event handler, identified by its ID.
handler_list dynamic_
Active event handlers with variables in their event names.
handler_queue_t active_
Active event handlers.
std::unordered_map< std::string, weak_handler_ptr > id_map_t
void add_event_handler(const config &cfg, bool is_menu_item=false)
Adds an event handler.
map_t by_name_
Active event handlers with fixed event names, organized by event name.
std::list< weak_handler_ptr > handler_list
std::shared_ptr< event_handler > handler_ptr
const handler_ptr get_event_handler_by_id(const std::string &id)
Gets an event handler, identified by its ID.
A config object defines a single node in a WML file, with access to child nodes.