00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_EVENT_LISTENER_H_
00028 #define CEYLAN_EVENT_LISTENER_H_
00029
00030
00031 #include "CeylanEvent.h"
00032 #include "CeylanTextDisplayable.h"
00033
00034
00035 #include <string>
00036 #include <list>
00037
00038
00039
00040 namespace Ceylan
00041 {
00042
00043
00044
00045 class Event ;
00046
00047
00048
00049 class EventSource ;
00050
00051
00052
00066 class CEYLAN_DLL EventListener : public TextDisplayable
00067 {
00068
00069
00070 public:
00071
00072
00073
00075 EventListener() ;
00076
00077
00078
00084 explicit EventListener( EventSource & source ) ;
00085
00086
00087
00093 virtual ~EventListener() throw() ;
00094
00095
00096
00107 virtual void subscribeTo( EventSource & source ) ;
00108
00109
00110
00125 virtual void unsubscribeFrom( EventSource & source ) ;
00126
00127
00128
00134 virtual void unsubscribeFromAllSources() ;
00135
00136
00137
00173 virtual void forgetSource( EventSource & source ) ;
00174
00175
00176
00188 virtual void beNotifiedOf( const Event & newEvent ) = 0 ;
00189
00190
00191
00200 std::list<EventSource *> getSources() const ;
00201
00202
00203
00211 virtual const std::string toString(
00212 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00213
00214
00215
00216
00217 protected:
00218
00219
00220
00221
00222
00223
00224
00225
00226 #pragma warning( push )
00227 #pragma warning( disable : 4251 )
00228
00233 std::list<EventSource *> _sources ;
00234
00235 #pragma warning( pop )
00236
00237
00238
00239 private:
00240
00241
00250 EventListener( const EventListener & source ) ;
00251
00252
00261 EventListener & operator = ( const EventListener & source ) ;
00262
00263
00264 } ;
00265
00266 }
00267
00268
00269
00270 #endif // CEYLAN_EVENT_LISTENER_H_
00271