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 42 of file multicontainer2.hxx.

Member Typedef Documentation

◆ keyType

Definition at line 114 of file multicontainer2.hxx.

◆ t_type2ptr

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

Definition at line 118 of file multicontainer2.hxx.

Constructor & Destructor Documentation

◆ OMultiTypeInterfaceContainerHelper2() [1/2]

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.

◆ ~OMultiTypeInterfaceContainerHelper2()

comphelper::OMultiTypeInterfaceContainerHelper2::~OMultiTypeInterfaceContainerHelper2 ( )

Delete all containers.

Definition at line 312 of file interfacecontainer2.cxx.

◆ OMultiTypeInterfaceContainerHelper2() [2/2]

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

Member Function Documentation

◆ addInterface()

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: \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 353 of file interfacecontainer2.cxx.

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

◆ clear()

void comphelper::OMultiTypeInterfaceContainerHelper2::clear ( )

Remove all elements of all containers.

Does not delete the container.

Definition at line 410 of file interfacecontainer2.cxx.

References m_aMap, and rMutex.

◆ disposeAndClear()

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

References i, m_aMap, and rMutex.

◆ findType() [1/2]

t_type2ptr::iterator comphelper::OMultiTypeInterfaceContainerHelper2::findType ( const css::uno::Type &  rKey)
private

◆ findType() [2/2]

t_type2ptr::const_iterator comphelper::OMultiTypeInterfaceContainerHelper2::findType ( const css::uno::Type &  rKey) const
private

◆ getContainedTypes()

std::vector< css::uno::Type > comphelper::OMultiTypeInterfaceContainerHelper2::getContainedTypes ( ) const

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

Definition at line 316 of file interfacecontainer2.cxx.

References m_aMap, and rMutex.

◆ getContainer()

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

References findType(), m_aMap, and rMutex.

◆ operator=()

OMultiTypeInterfaceContainerHelper2 & comphelper::OMultiTypeInterfaceContainerHelper2::operator= ( const OMultiTypeInterfaceContainerHelper2 )
privatedelete

◆ removeInterface()

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

References findType(), m_aMap, and rMutex.

Member Data Documentation

◆ m_aMap

t_type2ptr comphelper::OMultiTypeInterfaceContainerHelper2::m_aMap
private

◆ rMutex

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

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