inc/cleanupresetanddestroy.inl
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Utility class for putting to cleanup stack
       
    15 *                RPointerArray class which owns its members
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef _TR1SIDO_1_CLEANUPRESETANDDESTROY_INL
       
    20 #define _TR1SIDO_1_CLEANUPRESETANDDESTROY_INL
       
    21 
       
    22 template<typename T>
       
    23 inline void CleanupResetAndDestroyPushL( T& aRef );
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // CleanupResetAndDestroy::PushL
       
    27 // ---------------------------------------------------------------------------
       
    28 template<typename T>
       
    29 inline void CleanupResetAndDestroy<T>::PushL( T& aRef )
       
    30     {
       
    31     CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) );
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CleanupResetAndDestroy::ResetAndDestroy
       
    36 // ---------------------------------------------------------------------------
       
    37 template<typename T>
       
    38 void CleanupResetAndDestroy<T>::ResetAndDestroy( TAny *aPtr )
       
    39     {
       
    40     ( static_cast<T*> ( aPtr ) )->ResetAndDestroy();
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CleanupResetAndDestroyPushL
       
    45 // ---------------------------------------------------------------------------
       
    46 template<typename T>
       
    47 inline void CleanupResetAndDestroyPushL( T& aRef )
       
    48     {
       
    49     CleanupResetAndDestroy<T>::PushL( aRef );
       
    50     }
       
    51 
       
    52 #endif // _TR1SIDO_1_CLEANUPRESETANDDESTROY_INL