diff -r fd30d51f876b -r b6db4fd4947b agendainterface/inc/CleanupResetAndDestroy.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agendainterface/inc/CleanupResetAndDestroy.inl Mon Jun 28 15:22:02 2010 +0530 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides cleanup item to push ResetAndDestroy calls to +* cleanup stack. It is heavily used for RPointerArrays, +* which are used all over Symbian's CalenInterimAPI. +* Implementation is more or less copy-paste of +* cleanup item of Close method and CleanupClosePushL +* +*/ + + + +#include "CleanupResetAndDestroy.h" + + +/** + * Creates a TCleanupItem for the specified object. + * The cleanup operation is the private static function ResetAndDestroy() of this class. + * @param aRef The object for which a TCleanupItem is to be constructed. + **/ +template +inline void CleanupResetAndDestroy::PushL(T& aRef) +{ + CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) ); +} + +/** + * The cleanup operation to be performed. + * @param aPtr A pointer to the object for which clean up is to be performed. + * The implementation calls ResetAndDestroy() on this object. + **/ +template +void CleanupResetAndDestroy::ResetAndDestroy(TAny *aPtr) +{ + static_cast( aPtr )->ResetAndDestroy(); +} + +/** + * See header file CleanupResetAndDestroy.h for in-source comment. + * + **/ +template +inline void CleanupResetAndDestroyPushL(T& aRef) +{ + CleanupResetAndDestroy::PushL( aRef ); +} + + +// End of File