diff -r 000000000000 -r 8466d47a6819 emailuis/emailui/inc/FreestyleEmailExportedUtilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailuis/emailui/inc/FreestyleEmailExportedUtilities.h Thu Dec 17 08:39:21 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2008 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: Exported utilities for FS Email +* +*/ + + +#ifndef FREESTYLEEMAILEXPORTEDUTILITIES_H_ +#define FREESTYLEEMAILEXPORTEDUTILITIES_H_ + +/** +* CleanupResetAndDestroyClose +* +* Use CleanupResetAndDestroyClosePushL to push RPointerArray items +* on the cleanup stack. Use CleanupStack::PopAndDestroy( &ptrarray ) +* to resetanddestroy + close the pointer array. +* +*/ +template class CleanupResetAndDestroyClose + { +public: + inline static void PushL( T& aRef ); +private: + static void Close( TAny *aPtr ); + }; + +template inline void CleanupResetAndDestroyClosePushL( T& aRef ); + +template inline void CleanupResetAndDestroyClose::PushL( T& aRef ) + { + CleanupStack::PushL( TCleanupItem( &Close, &aRef ) ); + } + +template void CleanupResetAndDestroyClose::Close( TAny *aPtr ) + { + static_cast(aPtr)->ResetAndDestroy(); + static_cast(aPtr)->Close(); + } + +template inline void CleanupResetAndDestroyClosePushL( T& aRef ) + { + CleanupResetAndDestroyClose::PushL( aRef ); + } + +#endif /*FREESTYLEEMAILEXPORTEDUTILITIES_H_*/