LibreOffice Module comphelper (master)  1
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
comphelper::OMultiTypeInterfaceContainerHelper2 Class Reference

This is a copy of cppu::OMultiTypeInterfaceContainerHelper2 in include/cppuhelper/interfacecontainer.h, except that it uses comphelper::OInterfaceContainerHelper2, which is more efficient. More...

#include <multicontainer2.hxx>

Public Types

typedef css::uno::Type keyType
 

Public Member Functions

 OMultiTypeInterfaceContainerHelper2 (::osl::Mutex &rMutex)
 Create a container of interface containers. More...
 
 ~OMultiTypeInterfaceContainerHelper2 ()
 Delete all containers. More...
 
std::vector< css::uno::Type > getContainedTypes () const
 Return all id's under which at least one interface is added. More...
 
OInterfaceContainerHelper2getContainer (const css::uno::Type &rKey) const
 Return the container created under this key. More...
 
sal_Int32 addInterface (const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &r)
 Inserts an element into the container with the specified key. More...
 
sal_Int32 removeInterface (const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &rxIFace)
 Removes an element from the container with the specified key. More...
 
void disposeAndClear (const css::lang::EventObject &rEvt)
 Call disposing on all object in the container that support XEventListener. More...
 
void clear ()
 Remove all elements of all containers. More...
 

Private Types

typedef std::vector< std::pair< css::uno::Type, std::unique_ptr< OInterfaceContainerHelper2 > > > t_type2ptr
 

Private Member Functions

t_type2ptr::iterator findType (const css::uno::Type &rKey)
 
t_type2ptr::const_iterator findType (const css::uno::Type &rKey) const
 
 OMultiTypeInterfaceContainerHelper2 (const OMultiTypeInterfaceContainerHelper2 &)=delete
 
OMultiTypeInterfaceContainerHelper2operator= (const OMultiTypeInterfaceContainerHelper2 &)=delete
 

Private Attributes

t_type2ptr m_aMap
 
::osl::Mutex & rMutex
 

Detailed Description

This is a copy of cppu::OMultiTypeInterfaceContainerHelper2 in include/cppuhelper/interfacecontainer.h, except that it uses comphelper::OInterfaceContainerHelper2, which is more efficient.

Definition at line 48 of file multicontainer2.hxx.

Member Typedef Documentation

Definition at line 120 of file multicontainer2.hxx.

typedef std::vector<std::pair<css::uno::Type, std::unique_ptr<OInterfaceContainerHelper2> > > comphelper::OMultiTypeInterfaceContainerHelper2::t_type2ptr
private

Definition at line 124 of file multicontainer2.hxx.

Constructor & Destructor Documentation

comphelper::OMultiTypeInterfaceContainerHelper2::OMultiTypeInterfaceContainerHelper2 ( ::osl::Mutex &  rMutex)

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.
comphelper::OMultiTypeInterfaceContainerHelper2::~OMultiTypeInterfaceContainerHelper2 ( )

Delete all containers.

Definition at line 311 of file interfacecontainer2.cxx.

comphelper::OMultiTypeInterfaceContainerHelper2::OMultiTypeInterfaceContainerHelper2 ( const OMultiTypeInterfaceContainerHelper2 )
privatedelete

Member Function Documentation

sal_Int32 comphelper::OMultiTypeInterfaceContainerHelper2::addInterface ( const css::uno::Type &  rKey,
const css::uno::Reference< css::uno::XInterface > &  r 
)

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 352 of file interfacecontainer2.cxx.

References comphelper::OInterfaceContainerHelper2::addInterface(), findType(), m_aMap, and rMutex.

void comphelper::OMultiTypeInterfaceContainerHelper2::clear ( )

Remove all elements of all containers.

Does not delete the container.

Definition at line 409 of file interfacecontainer2.cxx.

References m_aMap, and rMutex.

void comphelper::OMultiTypeInterfaceContainerHelper2::disposeAndClear ( const css::lang::EventObject &  rEvt)

Call disposing on all object in the container that support XEventListener.

Then clear the container.

Definition at line 381 of file interfacecontainer2.cxx.

References i, m_aMap, and rMutex.

t_type2ptr::iterator comphelper::OMultiTypeInterfaceContainerHelper2::findType ( const css::uno::Type &  rKey)
private
t_type2ptr::const_iterator comphelper::OMultiTypeInterfaceContainerHelper2::findType ( const css::uno::Type &  rKey) const
private
std::vector< css::uno::Type > comphelper::OMultiTypeInterfaceContainerHelper2::getContainedTypes ( ) const

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

Definition at line 315 of file interfacecontainer2.cxx.

References m_aMap, and rMutex.

OInterfaceContainerHelper2 * comphelper::OMultiTypeInterfaceContainerHelper2::getContainer ( const css::uno::Type &  rKey) const

Return the container created under this key.

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

Definition at line 342 of file interfacecontainer2.cxx.

References findType(), m_aMap, and rMutex.

OMultiTypeInterfaceContainerHelper2& comphelper::OMultiTypeInterfaceContainerHelper2::operator= ( const OMultiTypeInterfaceContainerHelper2 )
privatedelete
sal_Int32 comphelper::OMultiTypeInterfaceContainerHelper2::removeInterface ( const css::uno::Type &  rKey,
const css::uno::Reference< css::uno::XInterface > &  rxIFace 
)

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 366 of file interfacecontainer2.cxx.

References findType(), m_aMap, and rMutex.

Member Data Documentation

t_type2ptr comphelper::OMultiTypeInterfaceContainerHelper2::m_aMap
private
::osl::Mutex& comphelper::OMultiTypeInterfaceContainerHelper2::rMutex
private

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