19 #ifndef INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX 20 #define INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX 32 template<
class key ,
class hashImpl ,
class equalImpl >
36 m_pMap =
new InterfaceMap;
40 template<
class key ,
class hashImpl ,
class equalImpl >
43 typename InterfaceMap::iterator iter = m_pMap->begin();
44 typename InterfaceMap::iterator end = m_pMap->end();
48 delete static_cast<OInterfaceContainerHelper*>((*iter).second);
56 template<
class key ,
class hashImpl ,
class equalImpl >
60 typename InterfaceMap::size_type nSize = m_pMap->size();
63 css::uno::Sequence< key > aInterfaceTypes( nSize );
64 key * pArray = aInterfaceTypes.getArray();
66 typename InterfaceMap::iterator iter = m_pMap->begin();
67 typename InterfaceMap::iterator end = m_pMap->end();
73 if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() )
75 pArray[i++] = (*iter).first;
80 aInterfaceTypes = css::uno::Sequence<key>( pArray, i );
82 return aInterfaceTypes;
84 return css::uno::Sequence<key>();
88 template<
class key ,
class hashImpl ,
class equalImpl >
90 const key & rKey )
const 94 typename InterfaceMap::iterator iter = find( rKey );
95 if( iter != m_pMap->end() )
96 return static_cast<OInterfaceContainerHelper*>( (*iter).second );
101 template<
class key ,
class hashImpl ,
class equalImpl >
104 const css::uno::Reference< css::uno::XInterface > & rListener )
107 typename InterfaceMap::iterator iter = find( rKey );
108 if( iter == m_pMap->end() )
111 m_pMap->push_back(std::pair<key, void*>(rKey, pLC));
115 return static_cast<OInterfaceContainerHelper*>((*iter).second)->addInterface( rListener );
119 template<
class key ,
class hashImpl ,
class equalImpl >
122 const css::uno::Reference< css::uno::XInterface > & rListener )
127 typename InterfaceMap::iterator iter = find( rKey );
129 if( iter != m_pMap->end() )
130 return static_cast<OInterfaceContainerHelper*>((*iter).second)->removeInterface( rListener );
137 template<
class key ,
class hashImpl ,
class equalImpl >
139 const css::lang::EventObject & rEvt )
141 typename InterfaceMap::size_type nSize = 0;
145 nSize = m_pMap->size();
149 ppListenerContainers =
new ppp[nSize];
151 typename InterfaceMap::iterator iter = m_pMap->begin();
152 typename InterfaceMap::iterator end = m_pMap->end();
154 typename InterfaceMap::size_type i = 0;
157 ppListenerContainers[i++] = static_cast<OInterfaceContainerHelper*>((*iter).second);
164 for(
typename InterfaceMap::size_type i = 0; i < nSize; i++ )
166 if( ppListenerContainers[i] )
170 delete [] ppListenerContainers;
174 template<
class key ,
class hashImpl ,
class equalImpl >
178 typename InterfaceMap::iterator iter = m_pMap->begin();
179 typename InterfaceMap::iterator end = m_pMap->end();
183 static_cast<OInterfaceContainerHelper*>((*iter).second)->clear();
A container of interfaces.
Definition: interfacecontainer.h:128
sal_Int32 removeInterface(const key &rKey, const css::uno::Reference< css::uno::XInterface > &rxIFace)
Removes an element from the container with the specified key.
Definition: interfacecontainer.hxx:120
Object lifetime scoped mutex object or interface lock.
Definition: mutex.hxx:114
void clear()
Remove all elements of all containers.
Definition: interfacecontainer.hxx:175
void disposeAndClear(const css::lang::EventObject &rEvt)
Call disposing on all references in the container, that support XEventListener.
Definition: interfacecontainer.hxx:138
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
Inserts an element into the container.
A mutual exclusion synchronization object.
Definition: mutex.hxx:31
OMultiTypeInterfaceContainerHelperVar(::osl::Mutex &rMutex)
Create a container of interface containers.
Definition: interfacecontainer.hxx:33
Definition: Enterable.hxx:26
~OMultiTypeInterfaceContainerHelperVar()
Deletes all containers.
Definition: interfacecontainer.hxx:41
void disposeAndClear(const css::lang::EventObject &rEvt)
Call disposing on all object in the container that support XEventListener.
css::uno::Sequence< key > getContainedTypes() const
Return all id's under which at least one interface is added.
Definition: interfacecontainer.hxx:57
sal_Int32 addInterface(const key &rKey, const css::uno::Reference< css::uno::XInterface > &r)
Inserts an element into the container with the specified key.
Definition: interfacecontainer.hxx:102
OInterfaceContainerHelper * getContainer(const key &) const
Return the container created under this key.
Definition: interfacecontainer.hxx:89