23 #ifndef INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX 24 #define INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX 36 template<
class key ,
class hashImpl ,
class equalImpl >
40 m_pMap =
new InterfaceMap;
44 template<
class key ,
class hashImpl ,
class equalImpl >
47 typename InterfaceMap::iterator iter = m_pMap->begin();
48 typename InterfaceMap::iterator end = m_pMap->end();
53 (*iter).second = NULL;
60 template<
class key ,
class hashImpl ,
class equalImpl >
64 typename InterfaceMap::size_type nSize = m_pMap->size();
67 css::uno::Sequence< key > aInterfaceTypes( nSize );
68 key * pArray = aInterfaceTypes.getArray();
70 typename InterfaceMap::iterator iter = m_pMap->begin();
71 typename InterfaceMap::iterator end = m_pMap->end();
77 if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() )
79 pArray[i++] = (*iter).first;
84 aInterfaceTypes = css::uno::Sequence<key>( pArray, i );
86 return aInterfaceTypes;
88 return css::uno::Sequence<key>();
92 template<
class key ,
class hashImpl ,
class equalImpl >
94 const key & rKey )
const 98 typename InterfaceMap::iterator iter = find( rKey );
99 if( iter != m_pMap->end() )
100 return static_cast<OInterfaceContainerHelper*>( (*iter).second );
105 template<
class key ,
class hashImpl ,
class equalImpl >
108 const css::uno::Reference< css::uno::XInterface > & rListener )
111 typename InterfaceMap::iterator iter = find( rKey );
112 if( iter == m_pMap->end() )
115 m_pMap->push_back(std::pair<key, void*>(rKey, pLC));
123 template<
class key ,
class hashImpl ,
class equalImpl >
126 const css::uno::Reference< css::uno::XInterface > & rListener )
131 typename InterfaceMap::iterator iter = find( rKey );
133 if( iter != m_pMap->end() )
134 return static_cast<OInterfaceContainerHelper*>((*iter).second)->removeInterface( rListener );
141 template<
class key ,
class hashImpl ,
class equalImpl >
143 const css::lang::EventObject & rEvt )
145 typename InterfaceMap::size_type nSize = 0;
149 nSize = m_pMap->size();
153 ppListenerContainers =
new ppp[nSize];
155 typename InterfaceMap::iterator iter = m_pMap->begin();
156 typename InterfaceMap::iterator end = m_pMap->end();
158 typename InterfaceMap::size_type i = 0;
168 for(
typename InterfaceMap::size_type i = 0; i < nSize; i++ )
170 if( ppListenerContainers[i] )
174 delete [] ppListenerContainers;
178 template<
class key ,
class hashImpl ,
class equalImpl >
182 typename InterfaceMap::iterator iter = m_pMap->begin();
183 typename InterfaceMap::iterator end = m_pMap->end();
OMultiTypeInterfaceContainerHelperVar(::osl::Mutex &rMutex)
Create a container of interface containers.
Definition: interfacecontainer.hxx:37
Object lifetime scoped mutex object or interface lock.
Definition: mutex.hxx:123
A container of interfaces.
Definition: interfacecontainer.h:131
A mutual exclusion synchronization object.
Definition: mutex.hxx:35
void disposeAndClear(const css::lang::EventObject &rEvt)
Call disposing on all references in the container, that support XEventListener.
Definition: interfacecontainer.hxx:142
Definition: Enterable.hxx:30
~OMultiTypeInterfaceContainerHelperVar()
Deletes all containers.
Definition: interfacecontainer.hxx:45
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
Inserts an element into the container.
void clear()
Remove all elements of all containers.
Definition: interfacecontainer.hxx:179
void disposeAndClear(const css::lang::EventObject &rEvt)
Call disposing on all object in the container that support XEventListener.
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:124
OInterfaceContainerHelper * getContainer(const key &) const
Return the container created under this key.
Definition: interfacecontainer.hxx:93
css::uno::Sequence< key > getContainedTypes() const
Return all id's under which at least one interface is added.
Definition: interfacecontainer.hxx:61
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:106