diff options
Diffstat (limited to 'slideshow/source/inc/listenercontainerimpl.hxx')
-rw-r--r-- | slideshow/source/inc/listenercontainerimpl.hxx | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/slideshow/source/inc/listenercontainerimpl.hxx b/slideshow/source/inc/listenercontainerimpl.hxx index 6a8b3f756e1d..cecffec7b647 100644 --- a/slideshow/source/inc/listenercontainerimpl.hxx +++ b/slideshow/source/inc/listenercontainerimpl.hxx @@ -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 @@ -41,29 +41,29 @@ struct EmptyBase struct EmptyGuard{ explicit EmptyGuard(EmptyBase) {} }; struct EmptyClearableGuard { - explicit EmptyClearableGuard(EmptyBase) {} - void clear() {} - void reset() {} + explicit EmptyClearableGuard(EmptyBase) {} + void clear() {} + void reset() {} }; typedef EmptyGuard Guard; typedef EmptyClearableGuard ClearableGuard; }; - + class MutexBase { public: - struct Guard : public osl::MutexGuard - { - explicit Guard(MutexBase const& rBase) : - osl::MutexGuard(rBase.maMutex) - {} + struct Guard : public osl::MutexGuard + { + explicit Guard(MutexBase const& rBase) : + osl::MutexGuard(rBase.maMutex) + {} }; struct ClearableGuard : public osl::ClearableMutexGuard - { - explicit ClearableGuard(MutexBase const& rBase) : - osl::ClearableMutexGuard(rBase.maMutex) - {} + { + explicit ClearableGuard(MutexBase const& rBase) : + osl::ClearableMutexGuard(rBase.maMutex) + {} }; mutable osl::Mutex maMutex; @@ -73,7 +73,7 @@ public: template< typename result_type, typename ListenerTargetT > struct FunctionApply { - template<typename FuncT> static bool apply( + template<typename FuncT> static bool apply( FuncT func, ListenerTargetT const& rArg ) { @@ -83,7 +83,7 @@ template< typename result_type, typename ListenerTargetT > struct FunctionApply template<typename ListenerTargetT> struct FunctionApply<void,ListenerTargetT> { - template<typename FuncT> static bool apply( + template<typename FuncT> static bool apply( FuncT func, ListenerTargetT const& rArg ) { @@ -97,7 +97,7 @@ template<typename ListenerTargetT> struct FunctionApply<void,ListenerTargetT> template< typename ListenerT > struct ListenerOperations { /// Notify a single one of the listeners - template< typename ContainerT, + template< typename ContainerT, typename FuncT > static bool notifySingleListener( ContainerT& rContainer, FuncT func ) @@ -106,13 +106,13 @@ template< typename ListenerT > struct ListenerOperations // true: a handler in this queue processed the event // false: no handler in this queue finally processed the event - return (std::find_if( rContainer.begin(), + return (std::find_if( rContainer.begin(), aEnd, func ) != aEnd); } /// Notify all listeners - template< typename ContainerT, + template< typename ContainerT, typename FuncT > static bool notifyAllListeners( ContainerT& rContainer, FuncT func ) @@ -129,7 +129,7 @@ template< typename ListenerT > struct ListenerOperations { bRet = true; } - + ++aCurr; } @@ -147,10 +147,10 @@ template< typename ListenerT > struct ListenerOperations // specializations for weak_ptr // ---------------------------- -template< typename ListenerTargetT > +template< typename ListenerTargetT > struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > { - template< typename ContainerT, + template< typename ContainerT, typename FuncT > static bool notifySingleListener( ContainerT& rContainer, FuncT func ) @@ -160,17 +160,17 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > while( aCurr != aEnd ) { boost::shared_ptr<ListenerTargetT> pListener( aCurr->lock() ); - + if( pListener && func(pListener) ) return true; - + ++aCurr; } return false; } - template< typename ContainerT, + template< typename ContainerT, typename FuncT > static bool notifyAllListeners( ContainerT& rContainer, FuncT func ) @@ -181,14 +181,14 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > while( aCurr != aEnd ) { boost::shared_ptr<ListenerTargetT> pListener( aCurr->lock() ); - - if( pListener.get() && + + if( pListener.get() && FunctionApply< typename FuncT::result_type, boost::shared_ptr<ListenerTargetT> >::apply(func,pListener) ) { bRet = true; } - + ++aCurr; } @@ -204,7 +204,7 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > ContainerT aAliveListeners; aAliveListeners.reserve(rContainer.size()); - + typename ContainerT::const_iterator aCurr( rContainer.begin() ); typename ContainerT::const_iterator const aEnd ( rContainer.end() ); while( aCurr != aEnd ) |