A container of interfaces. More...
#include <interfacecontainer.h>
Classes | |
| class | NotifySingleListener |
Public Member Functions | |
| OInterfaceContainerHelper (::osl::Mutex &rMutex) throw () | |
| Create an interface container. | |
| ~OInterfaceContainerHelper () throw () | |
| Release all interfaces. | |
| sal_Int32 | getLength () const throw () |
| Return the number of Elements in the container. | |
| ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > > | getElements () const throw () |
| Return all interfaces added to this container. | |
| sal_Int32 | addInterface (const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > &rxIFace) throw () |
| Inserts an element into the container. | |
| sal_Int32 | removeInterface (const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > &rxIFace) throw () |
| Removes an element from the container. | |
| void | disposeAndClear (const ::com::sun::star::lang::EventObject &rEvt) throw () |
| Call disposing on all object in the container that support XEventListener. | |
| void | clear () throw () |
| Clears the container without calling disposing(). | |
| template<typename ListenerT , typename FuncT > | |
| void | forEach (FuncT const &func) |
| Executes a functor for each contained listener of specified type, e.g. | |
| template<typename ListenerT , typename EventT > | |
| void | notifyEach (void(ListenerT::*NotificationMethod)(const EventT &), const EventT &Event) |
| Calls a UNO listener method for each contained listener. | |
Static Public Member Functions | |
| static void * | operator new (size_t nSize) throw () |
| static void | operator delete (void *pMem) throw () |
| static void * | operator new (size_t, void *pMem) throw () |
| static void | operator delete (void *, void *) throw () |
Friends | |
| class | OInterfaceIteratorHelper |
A container of interfaces.
To access the elements use an iterator. This implementation is thread save.
| cppu::OInterfaceContainerHelper::OInterfaceContainerHelper | ( | ::osl::Mutex & | rMutex | ) | throw () |
Create an interface container.
| rMutex | the mutex to protect multi thread access. The lifetime must be longer than the lifetime of this object. |
| cppu::OInterfaceContainerHelper::~OInterfaceContainerHelper | ( | ) | throw () |
Release all interfaces.
All iterators must be destroyed before the container is destructed.
| sal_Int32 cppu::OInterfaceContainerHelper::addInterface | ( | const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & | rxIFace | ) | throw () |
Inserts an element into the container.
The position is not specified, thus it is not specified in which order events are fired.
| rxIFace | interface to be added; it is allowed to insert null or the same interface more than once |
| void cppu::OInterfaceContainerHelper::clear | ( | ) | throw () |
Clears the container without calling disposing().
| void cppu::OInterfaceContainerHelper::disposeAndClear | ( | const ::com::sun::star::lang::EventObject & | rEvt | ) | throw () |
Call disposing on all object in the container that support XEventListener.
Than clear the container.
| void cppu::OInterfaceContainerHelper::forEach | ( | FuncT const & | func | ) | [inline] |
Executes a functor for each contained listener of specified type, e.g.
forEach<awt::XPaintListener>(....
If a com::sun::star::lang::DisposedException occurs which relates to the called listener, then that listener is removed from the container.
| ListenerT | listener type | |
| FuncT | unary functor type, let your compiler deduce this for you |
| func | unary functor object expecting an argument of type com::sun::star::uno::Reference<ListenerT> |
| ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > cppu::OInterfaceContainerHelper::getElements | ( | ) | const throw () |
Return all interfaces added to this container.
| sal_Int32 cppu::OInterfaceContainerHelper::getLength | ( | ) | const throw () |
Return the number of Elements in the container.
Only useful if you have acquired the mutex.
| void cppu::OInterfaceContainerHelper::notifyEach | ( | void(ListenerT::*)(const EventT &) | NotificationMethod, | |
| const EventT & | Event | |||
| ) | [inline] |
Calls a UNO listener method for each contained listener.
The listener method must take a single argument of type EventT, and return void.
If a com::sun::star::lang::DisposedException occurs which relates to the called listener, then that listener is removed from the container.
| ListenerT | UNO event listener type, let your compiler deduce this for you | |
| EventT | event type, let your compiler deduce this for you |
| NotificationMethod | Pointer to a method of a ListenerT interface. | |
| Event | Event to notify to all contained listeners |
Example:
awt::PaintEvent aEvent( static_cast< cppu::OWeakObject* >( this ), ... );
listeners.notifyEach( &XPaintListener::windowPaint, aEvent );
| static void cppu::OInterfaceContainerHelper::operator delete | ( | void * | , | |
| void * | ||||
| ) | throw () [inline, static] |
| static void cppu::OInterfaceContainerHelper::operator delete | ( | void * | pMem | ) | throw () [inline, static] |
| static void* cppu::OInterfaceContainerHelper::operator new | ( | size_t | , | |
| void * | pMem | |||
| ) | throw () [inline, static] |
| static void* cppu::OInterfaceContainerHelper::operator new | ( | size_t | nSize | ) | throw () [inline, static] |
| sal_Int32 cppu::OInterfaceContainerHelper::removeInterface | ( | const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & | rxIFace | ) | throw () |
Removes an element from the container.
It uses interface equality to remove the interface.
| rxIFace | interface to be removed |
friend class OInterfaceIteratorHelper [friend] |
1.6.1