summaryrefslogtreecommitdiff
path: root/cppuhelper/inc/cppuhelper/interfacecontainer.h
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper/inc/cppuhelper/interfacecontainer.h')
-rw-r--r--cppuhelper/inc/cppuhelper/interfacecontainer.h136
1 files changed, 68 insertions, 68 deletions
diff --git a/cppuhelper/inc/cppuhelper/interfacecontainer.h b/cppuhelper/inc/cppuhelper/interfacecontainer.h
index ae3c2adf1457..6242de88b6d8 100644
--- a/cppuhelper/inc/cppuhelper/interfacecontainer.h
+++ b/cppuhelper/inc/cppuhelper/interfacecontainer.h
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -43,7 +43,7 @@
/** */ //for docpp
namespace cppu
-{
+{
namespace detail {
@@ -62,7 +62,7 @@ class OInterfaceContainerHelper;
This is the iterator of a InterfaceContainerHelper. Typically
one constructs an instance on the stack for one firing session.
It is not allowed to assign or copy an instance of this class.
-
+
@see OInterfaceContainerHelper
*/
class OInterfaceIteratorHelper
@@ -71,15 +71,15 @@ public:
/**
Create an iterator over the elements of the container. The iterator
copies the elements of the conatainer. A change to the container
- during the lifetime of an iterator is allowed and does not
+ during the lifetime of an iterator is allowed and does not
affect the iterator-instance. The iterator and the container take cares
themself for concurrent access, no additional guarding is necessary.
-
+
Remark: The copy is on demand. The iterator copy the elements only if the container
change the contents. It is not allowed to destroy the container as long
as an iterator exist.
-
- @param rCont the container of the elements.
+
+ @param rCont the container of the elements.
*/
OInterfaceIteratorHelper( OInterfaceContainerHelper & rCont ) SAL_THROW( () );
@@ -93,34 +93,34 @@ public:
{ return nRemain != 0; }
/** Return the next element of the iterator. Calling this method if
hasMoreElements() has returned sal_False, is an error. Cast the
- returned pointer to the
+ returned pointer to the
*/
- ::com::sun::star::uno::XInterface * SAL_CALL next() SAL_THROW( () );
+ ::com::sun::star::uno::XInterface * SAL_CALL next() SAL_THROW( () );
/** Removes the current element (the last one returned by next())
from the underlying container. Calling this method before
next() has been called or calling it twice with no next()
- inbetween is an error.
+ inbetween is an error.
*/
void SAL_CALL remove() SAL_THROW( () );
-
+
private:
- OInterfaceContainerHelper & rCont;
- sal_Bool bIsList;
+ OInterfaceContainerHelper & rCont;
+ sal_Bool bIsList;
detail::element_alias aData;
- sal_Int32 nRemain;
+ sal_Int32 nRemain;
OInterfaceIteratorHelper( const OInterfaceIteratorHelper & ) SAL_THROW( () );
- OInterfaceIteratorHelper & operator = ( const OInterfaceIteratorHelper & ) SAL_THROW( () );
+ OInterfaceIteratorHelper & operator = ( const OInterfaceIteratorHelper & ) SAL_THROW( () );
};
//===================================================================
/**
A container of interfaces. To access the elements use an iterator.
This implementation is thread save.
-
+
@see OInterfaceIteratorHelper
*/
class OInterfaceContainerHelper
@@ -135,11 +135,11 @@ public:
{ return pMem; }
inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW( () )
{}
-
+
/**
- Create an interface container.
-
- @param rMutex the mutex to protect multi thread access.
+ Create an interface container.
+
+ @param rMutex the mutex to protect multi thread access.
The lifetime must be longer than the lifetime
of this object.
*/
@@ -169,7 +169,7 @@ public:
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).
-
+
@param rxIFace
interface to be added; it is allowed to insert null or
the same interface more than once
@@ -178,7 +178,7 @@ public:
*/
sal_Int32 SAL_CALL addInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace ) SAL_THROW( () );
/** Removes an element from the container. It uses interface equality to remove the interface.
-
+
@param rxIFace
interface to be removed
@return
@@ -197,10 +197,10 @@ public:
/** Executes a functor for each contained listener of specified type, e.g.
<code>forEach<awt::XPaintListener>(...</code>.
-
+
If a com::sun::star::lang::DisposedException occurs which relates to
the called listener, then that listener is removed from the container.
-
+
@tpl ListenerT listener type
@tpl FuncT unary functor type, let your compiler deduce this for you
@param func unary functor object expecting an argument of type
@@ -208,7 +208,7 @@ public:
*/
template <typename ListenerT, typename FuncT>
inline void forEach( FuncT const& func );
-
+
/** Calls a UNO listener method for each contained listener.
The listener method must take a single argument of type EventT,
@@ -216,7 +216,7 @@ public:
If a com::sun::star::lang::DisposedException occurs which relates to
the called listener, then that listener is removed from the container.
-
+
@tpl ListenerT UNO event listener type, let your compiler deduce this for you
@tpl EventT event type, let your compiler deduce this for you
@param NotificationMethod
@@ -232,19 +232,19 @@ public:
*/
template< typename ListenerT, typename EventT >
inline void notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event );
-
+
private:
friend class OInterfaceIteratorHelper;
- /**
+ /**
bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >,
otherwise aData.pAsInterface == of type (XEventListener *)
*/
detail::element_alias aData;
- ::osl::Mutex & rMutex;
+ ::osl::Mutex & rMutex;
/** TRUE -> used by an iterator. */
- sal_Bool bInUse;
+ sal_Bool bInUse;
/** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */
- sal_Bool bIsList;
+ sal_Bool bIsList;
OInterfaceContainerHelper( const OInterfaceContainerHelper & ) SAL_THROW( () );
OInterfaceContainerHelper & operator = ( const OInterfaceContainerHelper & ) SAL_THROW( () );
@@ -305,7 +305,7 @@ inline void OInterfaceContainerHelper::notifyEach( void ( SAL_CALL ListenerT::*N
//===================================================================
/**
A helper class to store interface references of different types.
-
+
@see OInterfaceIteratorHelper
@see OInterfaceContainerHelper
*/
@@ -322,11 +322,11 @@ public:
{ return pMem; }
inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW( () )
{}
-
+
/**
Create a container of interface containers.
-
- @param rMutex the mutex to protect multi thread access.
+
+ @param rMutex the mutex to protect multi thread access.
The lifetime must be longer than the lifetime
of this object.
*/
@@ -348,17 +348,17 @@ public:
was not created, null was returned.
*/
inline OInterfaceContainerHelper * SAL_CALL getContainer( const key & ) const SAL_THROW( () );
-
+
/** 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).
-
+
@param rKey
the id of the container
@param r
@@ -367,14 +367,14 @@ public:
@return
the new count of elements in the container
*/
- inline sal_Int32 SAL_CALL addInterface(
+ inline sal_Int32 SAL_CALL addInterface(
const key & rKey,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r )
SAL_THROW( () );
-
+
/** Removes an element from the container with the specified key.
It uses interface equality to remove the interface.
-
+
@param rKey
the id of the container
@param rxIFace
@@ -382,17 +382,17 @@ public:
@return
the new count of elements in the container
*/
- inline sal_Int32 SAL_CALL removeInterface(
+ inline sal_Int32 SAL_CALL removeInterface(
const key & rKey,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace )
SAL_THROW( () );
-
+
/**
Call disposing on all references in the container, that
support XEventListener. Then clears the container.
@param rEvt the event object which is passed during disposing() call
*/
- inline void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW( () );
+ inline void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW( () );
/**
Remove all elements of all containers. Does not delete the container.
*/
@@ -402,7 +402,7 @@ public:
private:
typedef ::std::vector< std::pair < key , void* > > InterfaceMap;
InterfaceMap *m_pMap;
- ::osl::Mutex & rMutex;
+ ::osl::Mutex & rMutex;
inline typename InterfaceMap::iterator find(const key &rKey) const
{
@@ -418,7 +418,7 @@ private:
}
return iter;
}
-
+
inline OMultiTypeInterfaceContainerHelperVar( const OMultiTypeInterfaceContainerHelperVar & ) SAL_THROW( () );
inline OMultiTypeInterfaceContainerHelperVar & operator = ( const OMultiTypeInterfaceContainerHelperVar & ) SAL_THROW( () );
};
@@ -426,26 +426,26 @@ private:
-/**
+/**
This struct contains the standard variables of a broadcaster. Helper
classes only know a reference to this struct instead of references
to the four members. The access to the members must be guarded with
rMutex.
-
+
The additional template parameter keyType has been added, because gcc
can't compile addListener( const container::keyType &key ).
*/
-template < class container , class keyType >
+template < class container , class keyType >
struct OBroadcastHelperVar
{
/** The shared mutex. */
- ::osl::Mutex & rMutex;
+ ::osl::Mutex & rMutex;
/** ListenerContainer class is thread save. */
- container aLC;
+ container aLC;
/** Dispose call ready. */
- sal_Bool bDisposed;
+ sal_Bool bDisposed;
/** In dispose call. */
- sal_Bool bInDispose;
+ sal_Bool bInDispose;
/**
Initialize the structur. bDispose and bInDispose are set to false.
@@ -527,11 +527,11 @@ public:
{ return pMem; }
inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW( () )
{}
-
+
/**
Create a container of interface containers.
-
- @param rMutex the mutex to protect multi thread access.
+
+ @param rMutex the mutex to protect multi thread access.
The lifetime must be longer than the lifetime
of this object.
*/
@@ -552,17 +552,17 @@ public:
was not created, null was returned.
*/
OInterfaceContainerHelper * SAL_CALL getContainer( const ::com::sun::star::uno::Type & rKey ) const SAL_THROW( () );
-
+
/** 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).
-
+
@param rKey
the id of the container
@param r
@@ -571,14 +571,14 @@ public:
@return
the new count of elements in the container
*/
- sal_Int32 SAL_CALL addInterface(
+ sal_Int32 SAL_CALL addInterface(
const ::com::sun::star::uno::Type & rKey,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r )
SAL_THROW( () );
-
+
/** Removes an element from the container with the specified key.
It uses interface equality to remove the interface.
-
+
@param rKey
the id of the container
@param rxIFace
@@ -586,25 +586,25 @@ public:
@return
the new count of elements in the container
*/
- sal_Int32 SAL_CALL removeInterface(
+ sal_Int32 SAL_CALL removeInterface(
const ::com::sun::star::uno::Type & rKey,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace )
SAL_THROW( () );
-
+
/**
Call disposing on all object in the container that
support XEventListener. Than clear the container.
*/
- void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW( () );
+ void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW( () );
/**
Remove all elements of all containers. Does not delete the container.
*/
void SAL_CALL clear() SAL_THROW( () );
-
+
typedef ::com::sun::star::uno::Type keyType;
private:
void *m_pMap;
- ::osl::Mutex & rMutex;
+ ::osl::Mutex & rMutex;
inline OMultiTypeInterfaceContainerHelper( const OMultiTypeInterfaceContainerHelper & ) SAL_THROW( () );
inline OMultiTypeInterfaceContainerHelper & operator = ( const OMultiTypeInterfaceContainerHelper & ) SAL_THROW( () );
@@ -612,7 +612,7 @@ private:
typedef OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper , OMultiTypeInterfaceContainerHelper::keyType > OBroadcastHelper;
-}
+}
#endif