14 #include "eventdispatcher.h"
15 #include "eventhandler.h"
30 typedef ContextHandlerMap::iterator Ei;
31 std::pair<Ei, Ei> g = m_contextHandlers.equal_range( context );
34 while( it != g.second )
37 (*it2).second->handleEvent( event );
39 m_contextHandlers.erase( it2 );
45 TypeHandlerMap::iterator it = m_typeHandlers.begin();
46 for( ; it != m_typeHandlers.end(); ++it )
49 (*it).second->handleEvent( event );
55 if( !eh || context.empty() )
58 m_contextHandlers.insert( std::make_pair( context, eh ) );
63 ContextHandlerMap::iterator it = m_contextHandlers.begin();
64 ContextHandlerMap::iterator it2;
65 while( it != m_contextHandlers.end() )
68 if( (*it2).second == eh )
69 m_contextHandlers.erase( it2 );
virtual ~EventDispatcher()
void removeEventHandler(EventHandler *eh)
void registerEventHandler(EventHandler *eh, const std::string &context)
void dispatch(const Event &event, const std::string &context, bool remove)
An base class for event handlers.
EventType eventType() const
The namespace for the gloox library.