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

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

#include <multiinterfacecontainer4.hxx>

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

Public Types

typedef key keyType
 

Public Member Functions

 OMultiTypeInterfaceContainerHelperVar4 ()
 
std::vector< key > getContainedTypes (std::unique_lock< std::mutex > &rGuard) const
 Return all id's under which at least one interface is added. More...
 
bool hasContainedTypes () const
 
OInterfaceContainerHelper4< listener > * getContainer (const key &rKey) const
 Return the container created under this key. More...
 
sal_Int32 addInterface (::std::unique_lock<::std::mutex > &rGuard, const key &rKey, const css::uno::Reference< listener > &rListener)
 Inserts an element into the container with the specified key. More...
 
sal_Int32 removeInterface (::std::unique_lock<::std::mutex > &rGuard, const key &rKey, const css::uno::Reference< listener > &rListener)
 Removes an element from the container with the specified key. More...
 
void disposeAndClear (std::unique_lock< std::mutex > &rGuard, 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< OInterfaceContainerHelper4< listener > > > > InterfaceMap
 

Private Member Functions

InterfaceMap::const_iterator find (const key &rKey) const
 
 OMultiTypeInterfaceContainerHelperVar4 (const OMultiTypeInterfaceContainerHelperVar4 &)=delete
 
OMultiTypeInterfaceContainerHelperVar4operator= (const OMultiTypeInterfaceContainerHelperVar4 &)=delete
 

Private Attributes

InterfaceMap m_aMap
 

Detailed Description

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

A helper class to store interface references of different types.

This is a copy of the code at include/comphelper/multiinterfacecontainer3.hxx, except that it (a) uses std::mutex instead of osl::Mutex and (b) does not store a reference to the mutex, but relies on the calling class to take a lock around using it.

See also
OInterfaceIteratorHelper3
OInterfaceContainerHelper3

Definition at line 39 of file multiinterfacecontainer4.hxx.

Member Typedef Documentation

◆ InterfaceMap

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

Definition at line 170 of file multiinterfacecontainer4.hxx.

◆ keyType

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

Definition at line 166 of file multiinterfacecontainer4.hxx.

Constructor & Destructor Documentation

◆ OMultiTypeInterfaceContainerHelperVar4() [1/2]

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

Definition at line 42 of file multiinterfacecontainer4.hxx.

◆ OMultiTypeInterfaceContainerHelperVar4() [2/2]

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

Member Function Documentation

◆ addInterface()

template<class key , class listener , class equalImpl = std::equal_to<key>>
sal_Int32 comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::addInterface ( ::std::unique_lock<::std::mutex > &  rGuard,
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 94 of file multiinterfacecontainer4.hxx.

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

◆ clear()

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

Remove all elements of all containers.

Does not delete the container.

Definition at line 161 of file multiinterfacecontainer4.hxx.

References comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::m_aMap.

◆ disposeAndClear()

template<class key , class listener , class equalImpl = std::equal_to<key>>
void comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::disposeAndClear ( std::unique_lock< std::mutex > &  rGuard,
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 132 of file multiinterfacecontainer4.hxx.

References comphelper::OInterfaceIteratorHelper4< ListenerT >::hasMoreElements(), comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::m_aMap, and comphelper::OInterfaceIteratorHelper4< ListenerT >::next().

◆ find()

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

◆ getContainedTypes()

template<class key , class listener , class equalImpl = std::equal_to<key>>
std::vector< key > comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::getContainedTypes ( std::unique_lock< std::mutex > &  rGuard) const
inline

Return all id's under which at least one interface is added.

Definition at line 46 of file multiinterfacecontainer4.hxx.

References comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::m_aMap.

◆ getContainer()

template<class key , class listener , class equalImpl = std::equal_to<key>>
OInterfaceContainerHelper4< listener > * comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, 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 71 of file multiinterfacecontainer4.hxx.

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

◆ hasContainedTypes()

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

◆ operator=()

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

◆ removeInterface()

template<class key , class listener , class equalImpl = std::equal_to<key>>
sal_Int32 comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::removeInterface ( ::std::unique_lock<::std::mutex > &  rGuard,
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 116 of file multiinterfacecontainer4.hxx.

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

Member Data Documentation

◆ m_aMap

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

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