LibreOffice Module comphelper (master) 1
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl > Class Template Reference

A helper class to store interface references of different types. More...

#include <multiinterfacecontainer3.hxx>

Inheritance diagram for comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >:
[legend]

Public Types

typedef key keyType
 

Public Member Functions

 OMultiTypeInterfaceContainerHelperVar3 (::osl::Mutex &rMutex_)
 Create a container of interface containers. More...
 
std::vector< key > getContainedTypes () const
 Return all id's under which at least one interface is added. More...
 
bool hasContainedTypes () const
 
OInterfaceContainerHelper3< listener > * getContainer (const key &rKey) const
 Return the container created under this key. More...
 
sal_Int32 addInterface (const key &rKey, const css::uno::Reference< listener > &rListener)
 Inserts an element into the container with the specified key. More...
 
sal_Int32 removeInterface (const key &rKey, const css::uno::Reference< listener > &rListener)
 Removes an element from the container with the specified key. More...
 
void disposeAndClear (const css::lang::EventObject &rEvt)
 Call disposing on all references in the container, that support XEventListener. More...
 
void clear ()
 Remove all elements of all containers. More...
 

Private Types

typedef ::std::vector< std::pair< key, std::unique_ptr< OInterfaceContainerHelper3< listener > > > > InterfaceMap
 

Private Member Functions

InterfaceMap::const_iterator find (const key &rKey) const
 
 OMultiTypeInterfaceContainerHelperVar3 (const OMultiTypeInterfaceContainerHelperVar3 &)=delete
 
OMultiTypeInterfaceContainerHelperVar3operator= (const OMultiTypeInterfaceContainerHelperVar3 &)=delete
 

Private Attributes

InterfaceMap m_aMap
 
::osl::Mutex & rMutex
 

Detailed Description

template<class listener, class key, class equalImpl = std::equal_to<key>>
class comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >

A helper class to store interface references of different types.

This is a copy of the similar class at include/cppuhelper/interfacecontainer.h, but now uses the improved comphelper::InterfaceContainer3.

See also
OInterfaceIteratorHelper3
OInterfaceContainerHelper3

Definition at line 44 of file multiinterfacecontainer3.hxx.

Member Typedef Documentation

◆ InterfaceMap

template<class listener , class key , class equalImpl = std::equal_to<key>>
typedef ::std::vector<std::pair<key, std::unique_ptr<OInterfaceContainerHelper3<listener> > > > comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::InterfaceMap
private

Definition at line 191 of file multiinterfacecontainer3.hxx.

◆ keyType

template<class listener , class key , class equalImpl = std::equal_to<key>>
typedef key comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::keyType

Definition at line 187 of file multiinterfacecontainer3.hxx.

Constructor & Destructor Documentation

◆ OMultiTypeInterfaceContainerHelperVar3() [1/2]

template<class listener , class key , class equalImpl = std::equal_to<key>>
comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::OMultiTypeInterfaceContainerHelperVar3 ( ::osl::Mutex &  rMutex_)
inline

Create a container of interface containers.

Parameters
rMutexthe mutex to protect multi thread access. The lifetime must be longer than the lifetime of this object.

Definition at line 54 of file multiinterfacecontainer3.hxx.

◆ OMultiTypeInterfaceContainerHelperVar3() [2/2]

template<class listener , class key , class equalImpl = std::equal_to<key>>
comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::OMultiTypeInterfaceContainerHelperVar3 ( const OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl > &  )
privatedelete

Member Function Documentation

◆ addInterface()

template<class listener , class key , class equalImpl = std::equal_to<key>>
sal_Int32 comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::addInterface ( const key &  rKey,
const css::uno::Reference< listener > &  rListener 
)
inline

Inserts an element into the container with the specified key.

The position is not specified, thus it is not specified in which order events are fired.

Attention: \n
If you add the same interface more than once, then it will be added to the elements list more than once and thus if you want to remove that interface from the list, you have to call removeInterface() the same number of times. In the latter case, you will also get events fired more than once (if the interface is a listener interface).
Parameters
rKeythe id of the container
rinterface to be added; it is allowed, to insert null or the same interface more than once
Returns
the new count of elements in the container

Definition at line 119 of file multiinterfacecontainer3.hxx.

References comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::find(), comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::m_aMap, and comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::rMutex.

◆ clear()

template<class listener , class key , class equalImpl = std::equal_to<key>>
void comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::clear ( )
inline

◆ disposeAndClear()

template<class listener , class key , class equalImpl = std::equal_to<key>>
void comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::disposeAndClear ( const css::lang::EventObject &  rEvt)
inline

Call disposing on all references in the container, that support XEventListener.

Then clears the container.

Parameters
rEvtthe event object which is passed during disposing() call

Definition at line 163 of file multiinterfacecontainer3.hxx.

References comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::m_aMap, and comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::rMutex.

◆ find()

template<class listener , class key , class equalImpl = std::equal_to<key>>
InterfaceMap::const_iterator comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::find ( const key &  rKey) const
inlineprivate

◆ getContainedTypes()

template<class listener , class key , class equalImpl = std::equal_to<key>>
std::vector< key > comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::getContainedTypes ( ) const
inline

◆ getContainer()

template<class listener , class key , class equalImpl = std::equal_to<key>>
OInterfaceContainerHelper3< listener > * comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::getContainer ( const key &  rKey) const
inline

Return the container created under this key.

The InterfaceContainerHelper exists until the whole MultiTypeContainer is destroyed.

Returns
the container created under this key. If the container was not created, null was returned.

Definition at line 91 of file multiinterfacecontainer3.hxx.

References comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::find(), comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::m_aMap, and comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::rMutex.

◆ hasContainedTypes()

template<class listener , class key , class equalImpl = std::equal_to<key>>
bool comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::hasContainedTypes ( ) const
inline

◆ operator=()

template<class listener , class key , class equalImpl = std::equal_to<key>>
OMultiTypeInterfaceContainerHelperVar3 & comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::operator= ( const OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl > &  )
privatedelete

◆ removeInterface()

template<class listener , class key , class equalImpl = std::equal_to<key>>
sal_Int32 comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::removeInterface ( const key &  rKey,
const css::uno::Reference< listener > &  rListener 
)
inline

Removes an element from the container with the specified key.

It uses interface equality to remove the interface.

Parameters
rKeythe id of the container
rxIFaceinterface to be removed
Returns
the new count of elements in the container

Definition at line 143 of file multiinterfacecontainer3.hxx.

References comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::find(), comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::m_aMap, and comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::rMutex.

Member Data Documentation

◆ m_aMap

template<class listener , class key , class equalImpl = std::equal_to<key>>
InterfaceMap comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::m_aMap
private

◆ rMutex

template<class listener , class key , class equalImpl = std::equal_to<key>>
::osl::Mutex& comphelper::OMultiTypeInterfaceContainerHelperVar3< listener, key, equalImpl >::rMutex
private

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