diff -r 000000000000 -r f979ecb2b13e calendarui/inc/CleanupResetAndDestroy.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/calendarui/inc/CleanupResetAndDestroy.inl Tue Feb 02 10:12:19 2010 +0200 @@ -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 "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: 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