charconvfw/numbergrouping/Inc/cleanuputil.inl
changeset 21 f2f7b3284356
equal deleted inserted replaced
16:56cd22a7a1cb 21:f2f7b3284356
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 * FORM Cursor Navigation header file holding policy interface class.
       
    16 *
       
    17 */
       
    18 #ifndef CLEANUPUTIL_INL
       
    19 #define CLEANUPUTIL_INL
       
    20 
       
    21 #include "cleanuputil.h"
       
    22 
       
    23 template <class T>
       
    24 class CleanupResetAndDestroy
       
    25     {
       
    26 public:
       
    27     inline static void PushL(T& aRef);
       
    28 private:
       
    29     static void ResetAndDestroy(TAny *aPtr);
       
    30     };
       
    31 
       
    32 template <class T>
       
    33 inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
       
    34     {
       
    35     CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));
       
    36     }
       
    37 
       
    38 template <class T>
       
    39 void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
       
    40     {
       
    41     static_cast<T*>(aPtr)->ResetAndDestroy();
       
    42     }
       
    43 
       
    44 template <class T>
       
    45 inline void CleanupResetAndDestroyPushL(T& aRef)
       
    46     {
       
    47     CleanupResetAndDestroy<T>::PushL(aRef);
       
    48     }
       
    49 	
       
    50 #endif