diff -r 000000000000 -r 094583676ce7 wvuing/IMPSConnectionUI/NotifySrc/RGenericObserverArray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wvuing/IMPSConnectionUI/NotifySrc/RGenericObserverArray.inl Thu Dec 17 08:41:52 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for thin templated RGenericObserverArray +* +*/ + + + +// ================= HELPER CLASS ======================= +/** + * Helper inline class to forward requests + * from base mediator (typeless) to type specific + * mediator. + * + * @since 2.1 + */ +template +class TGenObserverNotifyMediatorBase : public MGenObserverNotifyMediatorBase + { + public: + inline TGenObserverNotifyMediatorBase( MGenObserverNotifyMediator& aSpecificMediator ) + : iSpecificMediator( aSpecificMediator ){} + + private: + inline void MediateNotifyL( TAny* aObserverToNotify, TAny* aNotifyData ) + { iSpecificMediator.MediateNotifyL( *( static_cast( aObserverToNotify ) ), + *( static_cast( aNotifyData ) ) ); } + + inline void MediateNotifyError( TAny* aObserverToNotify, TInt aLeaveError ) + { iSpecificMediator.MediateNotifyError( *( static_cast( aObserverToNotify ) ), aLeaveError ); } + + inline void MediateError( TAny* aObserverToNotify, TInt aError ) + { iSpecificMediator.MediateError( *( static_cast( aObserverToNotify ) ), aError ); } + + private: + ///< Observer type specific notify mediator, not owned + MGenObserverNotifyMediator& iSpecificMediator; + }; + + +// ================= MEMBER FUNCTIONS ======================= +// C++ default constructor can NOT contain any code, that +// might leave. +// +template +inline RGenericObserverArray::RGenericObserverArray() + { + } + +// ----------------------------------------------------------------------------- +// RGenericObserverArray::Close() +// ----------------------------------------------------------------------------- +// +template +inline void RGenericObserverArray::Close() + { + RGenericObserverArrayBase::Close(); + } + + +// ----------------------------------------------------------------------------- +// RGenericObserverArray::AddObserver() +// ----------------------------------------------------------------------------- +// +template +inline TInt RGenericObserverArray::AddObserver( const T* aObserver ) + { + return RGenericObserverArrayBase::AddObserver( static_cast( aObserver ) ); + } + + +// ----------------------------------------------------------------------------- +// RGenericObserverArray::AddObserverL() +// ----------------------------------------------------------------------------- +// +template +inline void RGenericObserverArray::AddObserverL( const T* aObserver ) + { + User::LeaveIfError( AddObserver( aObserver ) ); + } + + +// ----------------------------------------------------------------------------- +// RGenericObserverArray::RemoveObserver() +// ----------------------------------------------------------------------------- +// +template +inline TInt RGenericObserverArray::RemoveObserver( T* aObserver ) + { + return RGenericObserverArrayBase::RemoveObserver( static_cast( aObserver ) ); + } + + +// ----------------------------------------------------------------------------- +// RGenericObserverArray::Count() +// ----------------------------------------------------------------------------- +// +template +inline TInt RGenericObserverArray::Count() + { + return RGenericObserverArrayBase::Count(); + } + + +// ----------------------------------------------------------------------------- +// RGenericObserverArray::NotifyObservers() +// ----------------------------------------------------------------------------- +// +template +inline void RGenericObserverArray::NotifyObservers( MGenObserverNotifyMediator& aNotifyMediator, + P& aNotifyData ) + { + TGenObserverNotifyMediatorBase baseMediator( aNotifyMediator ); + RGenericObserverArrayBase::NotifyObservers( baseMediator, + static_cast( &aNotifyData) ); + } + + +// ----------------------------------------------------------------------------- +// RGenericObserverArray::NotifyObserversFromError() +// ----------------------------------------------------------------------------- +// +template +inline void RGenericObserverArray::NotifyObserversFromError( MGenObserverNotifyMediator& aNotifyMediator, + TInt aError ) + { + TGenObserverNotifyMediatorBase baseMediator( aNotifyMediator ); + RGenericObserverArrayBase::NotifyObserversFromError( baseMediator, aError ); + } + +// End of File +