19 #ifndef INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX
20 #define INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX
28 template<
class key ,
class hashImpl ,
class equalImpl >
32 m_pMap =
new InterfaceMap;
36 template<
class key ,
class hashImpl ,
class equalImpl >
39 typename InterfaceMap::iterator iter = m_pMap->begin();
40 typename InterfaceMap::iterator end = m_pMap->end();
52 template<
class key ,
class hashImpl ,
class equalImpl >
56 typename InterfaceMap::size_type nSize = m_pMap->size();
60 key * pArray = aInterfaceTypes.
getArray();
62 typename InterfaceMap::iterator iter = m_pMap->begin();
63 typename InterfaceMap::iterator end = m_pMap->end();
69 if( static_cast<OInterfaceContainerHelper*>((*iter).second)->getLength() )
71 pArray[i++] = (*iter).first;
78 return aInterfaceTypes;
80 return ::com::sun::star::uno::Sequence<key>();
84 template<
class key ,
class hashImpl ,
class equalImpl >
86 const key & rKey )
const
90 typename InterfaceMap::iterator iter = find( rKey );
91 if( iter != m_pMap->end() )
92 return static_cast<OInterfaceContainerHelper*>( (*iter).second );
97 template<
class key ,
class hashImpl ,
class equalImpl >
100 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rListener )
103 typename InterfaceMap::iterator iter = find( rKey );
104 if( iter == m_pMap->end() )
107 m_pMap->push_back(std::pair<key, void*>(rKey, pLC));
115 template<
class key ,
class hashImpl ,
class equalImpl >
118 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rListener )
123 typename InterfaceMap::iterator iter = find( rKey );
125 if( iter != m_pMap->end() )
126 return static_cast<OInterfaceContainerHelper*>((*iter).second)->removeInterface( rListener );
133 template<
class key ,
class hashImpl ,
class equalImpl >
135 const ::com::sun::star::lang::EventObject & rEvt )
137 typename InterfaceMap::size_type nSize = 0;
141 nSize = m_pMap->size();
145 ppListenerContainers =
new ppp[nSize];
147 typename InterfaceMap::iterator iter = m_pMap->begin();
148 typename InterfaceMap::iterator end = m_pMap->end();
150 typename InterfaceMap::size_type i = 0;
160 for(
typename InterfaceMap::size_type i = 0; i < nSize; i++ )
162 if( ppListenerContainers[i] )
166 delete [] ppListenerContainers;
170 template<
class key ,
class hashImpl ,
class equalImpl >
174 typename InterfaceMap::iterator iter = m_pMap->begin();
175 typename InterfaceMap::iterator end = m_pMap->end();
A helper class for mutex objects and interfaces.
Definition: mutex.hxx:108
OMultiTypeInterfaceContainerHelperVar(::osl::Mutex &rMutex)
Create a container of interface containers.
Definition: interfacecontainer.hxx:29
void disposeAndClear(const ::com::sun::star::lang::EventObject &rEvt)
Call disposing on all object in the container that support XEventListener.
~OMultiTypeInterfaceContainerHelperVar()
Deletes all containers.
Definition: interfacecontainer.hxx:37
sal_Int32 addInterface(const key &rKey, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > &r)
Inserts an element into the container with the specified key.
Definition: interfacecontainer.hxx:98
OInterfaceContainerHelper * getContainer(const key &) const
Return the container created under this key.
Definition: interfacecontainer.hxx:85
inline::com::sun::star::uno::Sequence< key > getContainedTypes() const
Return all id's under which at least one interface is added.
Definition: interfacecontainer.hxx:53
sal_Int32 addInterface(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > &rxIFace)
Inserts an element into the container.
A mutual exclusion synchronization object.
Definition: mutex.hxx:30
void clear()
Remove all elements of all containers.
Definition: interfacecontainer.hxx:171
E * getArray()
Gets a pointer to elements array for reading and writing.
Definition: Sequence.hxx:146
sal_Int32 removeInterface(const key &rKey, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > &rxIFace)
Removes an element from the container with the specified key.
Definition: interfacecontainer.hxx:116
void disposeAndClear(const ::com::sun::star::lang::EventObject &rEvt)
Call disposing on all references in the container, that support XEventListener.
Definition: interfacecontainer.hxx:134
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:38
A container of interfaces.
Definition: interfacecontainer.h:126