agendainterface/inc/CleanupResetAndDestroy.inl
changeset 49 5de72ea7a065
child 75 7ac58b2aae6f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agendainterface/inc/CleanupResetAndDestroy.inl	Wed Jun 23 18:11:28 2010 +0300
@@ -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 <class T>
+inline void CleanupResetAndDestroy<T>::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 <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
+{
+    static_cast<T*>( aPtr )->ResetAndDestroy();
+}
+
+/**
+ *  See header file CleanupResetAndDestroy.h for in-source comment.
+ *
+ **/
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef)
+{
+    CleanupResetAndDestroy<T>::PushL( aRef );
+}
+
+
+// End of File