15 #ifndef GAME_EVENTS_MANAGER_IMPL_HPP
16 #define GAME_EVENTS_MANAGER_IMPL_HPP
20 #include <boost/noncopyable.hpp>
21 #include <boost/scoped_ptr.hpp>
22 #include <boost/shared_ptr.hpp>
23 #include <boost/unordered_map.hpp>
24 #include <boost/weak_ptr.hpp>
30 typedef boost::unordered_map<std::string, handler_list>
map_t;
31 typedef boost::unordered_map<std::string, boost::weak_ptr<event_handler> >
id_map_t;
68 iterator
begin() {
return active_.begin(); }
69 const_iterator
begin()
const {
return active_.begin(); }
71 iterator
end() {
return active_.end(); }
72 const_iterator
end()
const {
return active_.end(); }
75 size_type
size()
const {
return active_.size(); }
handler_vec::const_iterator const_iterator
handler_vec::iterator iterator
static std::string standardize_name(const std::string &name)
Utility to standardize the event names used in by_name_.
handler_ptr & operator[](size_type index)
Access to active event handlers by index.
boost::unordered_map< std::string, boost::weak_ptr< event_handler > > id_map_t
id_map_t id_map_
Active event handlers with variables in their event names.
void add_event_handler(const config &cfg, manager &man, bool is_menu_item=false)
Adds an event handler.
handler_vec::size_type size_type
handler_list dynamic_
Active event handlers with fixed event names, organized by event name.
boost::unordered_map< std::string, handler_list > map_t
size_type size() const
The number of active event handlers.
map_t by_name_
Active event handlers. Will not have elements removed unless the t_event_handlers is clear()ed...
This is a wrapper for a list of weak pointers to handlers.
std::vector< handler_ptr > handler_vec
Storage of event handlers.
void remove_event_handler(std::string const &id)
Removes an event handler, identified by its ID.
const_iterator begin() const
const_iterator end() const
void log_handlers()
Allows quick locating of handlers by id.
The game event manager loads the scenario configuration object, and ensures that events are handled a...
GLuint const GLchar * name
Define the handlers for the game's events mechanism.
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string