LibreOffice Module comphelper (master)  1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
comphelper::OSimpleListenerContainer< LISTENER, EVENT > Class Template Referencefinal

helper class for simple notification of the form LISTENER::METHOD( EVENT ) More...

#include <listenernotification.hxx>

Inheritance diagram for comphelper::OSimpleListenerContainer< LISTENER, EVENT >:
[legend]
Collaboration diagram for comphelper::OSimpleListenerContainer< LISTENER, EVENT >:
[legend]

Public Types

typedef LISTENER ListenerClass
 
typedef EVENT EventClass
 

Public Member Functions

typedef void (SAL_CALL LISTENER::*NotificationMethod)(const EventClass &)
 
 OSimpleListenerContainer (::osl::Mutex &_rMutex)
 
void addListener (const css::uno::Reference< ListenerClass > &_rxListener)
 
void removeListener (const css::uno::Reference< ListenerClass > &_rxListener)
 
void notify (const EventClass &_rEvent, NotificationMethod _pNotify)
 typed notification More...
 

Private Member Functions

virtual bool implNotify (const css::uno::Reference< css::lang::XEventListener > &_rxListener, const css::lang::EventObject &_rEvent) override
 call a single listener More...
 

Private Attributes

NotificationMethod m_pNotificationMethod
 

Additional Inherited Members

- Protected Member Functions inherited from comphelper::OListenerContainer
 OListenerContainer (::osl::Mutex &_rMutex)
 
virtual ~OListenerContainer ()
 
void impl_addListener (const css::uno::Reference< css::lang::XEventListener > &_rxListener)
 
void impl_removeListener (const css::uno::Reference< css::lang::XEventListener > &_rxListener)
 
bool impl_notify (const css::lang::EventObject &_rEvent)
 notifies all listeners of the given event, using THB's notification pattern More...
 
void disposing (const css::lang::EventObject &_rEventSource)
 sends a XEventObject::disposing notification to all listeners, and clears the listener container More...
 
void clear ()
 clears the container without calling <member scope="css::lang">XEventListener::disposing</member> at the listeners More...
 
bool empty () const
 determines whether the listener container is currently empty More...
 
::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2createIterator ()
 creates an iterator for looping through all registered listeners More...
 

Detailed Description

template<class LISTENER, class EVENT>
class comphelper::OSimpleListenerContainer< LISTENER, EVENT >

helper class for simple notification of the form LISTENER::METHOD( EVENT )

This class is not threadsafe!

Parameters
LISTENERthe listener class to call, e.g. css::lang::XEventListener
EVENTthe event type to notify, e.g. css::lang::EventObject

Definition at line 156 of file listenernotification.hxx.

Member Typedef Documentation

template<class LISTENER, class EVENT>
typedef EVENT comphelper::OSimpleListenerContainer< LISTENER, EVENT >::EventClass

Definition at line 160 of file listenernotification.hxx.

template<class LISTENER, class EVENT>
typedef LISTENER comphelper::OSimpleListenerContainer< LISTENER, EVENT >::ListenerClass

Definition at line 159 of file listenernotification.hxx.

Constructor & Destructor Documentation

template<class LISTENER, class EVENT>
comphelper::OSimpleListenerContainer< LISTENER, EVENT >::OSimpleListenerContainer ( ::osl::Mutex &  _rMutex)
inline

Definition at line 167 of file listenernotification.hxx.

Member Function Documentation

template<class LISTENER, class EVENT>
void comphelper::OSimpleListenerContainer< LISTENER, EVENT >::addListener ( const css::uno::Reference< ListenerClass > &  _rxListener)
inline

Definition at line 173 of file listenernotification.hxx.

template<class LISTENER, class EVENT>
virtual bool comphelper::OSimpleListenerContainer< LISTENER, EVENT >::implNotify ( const css::uno::Reference< css::lang::XEventListener > &  _rxListener,
const css::lang::EventObject &  _rEvent 
)
inlineoverrideprivatevirtual

call a single listener

Exceptions
css::uno::Exceptionif the listener throws an exception during notification. Please don't catch any listener exceptions in your implementation of this method, simply let them pass to the caller.
Parameters
_rxListenerspecifies the listener to call. Is guaranteed to not be <NULL>
_rEventthe event to broadcast. This is the same as passed to <member>notify</member>, so if your base class knows the type passed into <member>notify</member>, it can safely assume that <arg>_rEvent</arg> is also of this type.
Returns
<TRUE> if the remaining listeners should be called, <FALSE> if the notification loop should be cancelled
See also
notify

Implements comphelper::OListenerContainer.

Definition at line 193 of file listenernotification.hxx.

template<class LISTENER , class EVENT >
void comphelper::OSimpleListenerContainer< LISTENER, EVENT >::notify ( const EventClass _rEvent,
NotificationMethod  _pNotify 
)
inline

typed notification

Definition at line 207 of file listenernotification.hxx.

References comphelper::OListenerContainer::impl_notify().

template<class LISTENER, class EVENT>
void comphelper::OSimpleListenerContainer< LISTENER, EVENT >::removeListener ( const css::uno::Reference< ListenerClass > &  _rxListener)
inline

Definition at line 178 of file listenernotification.hxx.

template<class LISTENER, class EVENT>
typedef comphelper::OSimpleListenerContainer< LISTENER, EVENT >::void ( SAL_CALL LISTENER::*  NotificationMethod) const

Member Data Documentation

template<class LISTENER, class EVENT>
NotificationMethod comphelper::OSimpleListenerContainer< LISTENER, EVENT >::m_pNotificationMethod
private

The documentation for this class was generated from the following file: