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

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

#include <multiinterfacecontainer2.hxx>

Inheritance diagram for comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >:
[legend]

Public Types

typedef key keyType
 

Public Member Functions

 OMultiTypeInterfaceContainerHelperVar2 (::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
 
OInterfaceContainerHelper2getContainer (const key &rKey) const
 Return the container created under this key. More...
 
sal_Int32 addInterface (const key &rKey, const css::uno::Reference< css::uno::XInterface > &rListener)
 Inserts an element into the container with the specified key. More...
 
sal_Int32 removeInterface (const key &rKey, const css::uno::Reference< css::uno::XInterface > &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< OInterfaceContainerHelper2 > > > InterfaceMap
 

Private Member Functions

InterfaceMap::const_iterator find (const key &rKey) const
 
 OMultiTypeInterfaceContainerHelperVar2 (const OMultiTypeInterfaceContainerHelperVar2 &)=delete
 
OMultiTypeInterfaceContainerHelperVar2operator= (const OMultiTypeInterfaceContainerHelperVar2 &)=delete
 

Private Attributes

InterfaceMap m_aMap
 
::osl::Mutex & rMutex
 

Detailed Description

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
class comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, 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::InterfaceContainer2.

See also
OInterfaceIteratorHelper2
OInterfaceContainerHelper2

Definition at line 51 of file multiinterfacecontainer2.hxx.

Member Typedef Documentation

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
typedef ::std::vector<std::pair<key, std::unique_ptr<OInterfaceContainerHelper2> > > comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::InterfaceMap
private

Definition at line 219 of file multiinterfacecontainer2.hxx.

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
typedef key comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::keyType

Definition at line 216 of file multiinterfacecontainer2.hxx.

Constructor & Destructor Documentation

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::OMultiTypeInterfaceContainerHelperVar2 ( ::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 61 of file multiinterfacecontainer2.hxx.

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::OMultiTypeInterfaceContainerHelperVar2 ( const OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl > &  )
privatedelete

Member Function Documentation

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
sal_Int32 comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::addInterface ( const key &  rKey,
const css::uno::Reference< css::uno::XInterface > &  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:

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 126 of file multiinterfacecontainer2.hxx.

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

Remove all elements of all containers.

Does not delete the container.

Definition at line 208 of file multiinterfacecontainer2.hxx.

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
void comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, 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 171 of file multiinterfacecontainer2.hxx.

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
InterfaceMap::const_iterator comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::find ( const key &  rKey) const
inlineprivate
template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
std::vector<key> comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::getContainedTypes ( ) const
inline

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

Definition at line 69 of file multiinterfacecontainer2.hxx.

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
OInterfaceContainerHelper2* comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, 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 98 of file multiinterfacecontainer2.hxx.

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
bool comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::hasContainedTypes ( ) const
inline

Definition at line 82 of file multiinterfacecontainer2.hxx.

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
OMultiTypeInterfaceContainerHelperVar2& comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::operator= ( const OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl > &  )
privatedelete
template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
sal_Int32 comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::removeInterface ( const key &  rKey,
const css::uno::Reference< css::uno::XInterface > &  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 151 of file multiinterfacecontainer2.hxx.

Member Data Documentation

template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
InterfaceMap comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::m_aMap
private
template<class key, class hashImpl = void, class equalImpl = std::equal_to<key>>
::osl::Mutex& comphelper::OMultiTypeInterfaceContainerHelperVar2< key, hashImpl, equalImpl >::rMutex
private

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