meetingrequest/mragnversit2/inc/esmrcleanuppointerarray.inl
changeset 0 8466d47a6819
child 16 b5fbb9b25d57
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2005 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:  A class for simplifying cleanup of RPointerArrays
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21 Pushes an RPointerArray onto the cleanup stack. When popped with PopAndDestroy,
       
    22 the array will be reset with ResetAndDestroy.
       
    23 @param aRef The RPointerArray to be cleaned up.
       
    24 @internalTechnology
       
    25 */
       
    26 template <class T>	
       
    27 inline void TCleanupPointerArray<T>::PushL(T& aRef)
       
    28 	{
       
    29 	CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef));
       
    30 	}
       
    31 	
       
    32 /**
       
    33 Takes a pointer to an RPointerArray and calls ResetAndDestroy on it.
       
    34 @param aPtr The RPointerArray
       
    35 @internalTechnology
       
    36 */
       
    37 template <class T>
       
    38 inline void TCleanupPointerArray<class T>::ResetAndDestroy(TAny* aPtr)
       
    39 	{
       
    40 	reinterpret_cast<T *>(aPtr)->ResetAndDestroy();
       
    41 	}
       
    42 
       
    43 /**
       
    44 Pushes an RPointerArray onto the cleanup stack. When popped with PopAndDestroy,
       
    45 the array will be reset with ResetAndDestroy.
       
    46 @param aRef The RPointerArray to be cleaned up.
       
    47 @internalTechnology
       
    48 */
       
    49 template <class T>
       
    50 inline void CleanupPointerArrayPushL(T& aRef)
       
    51 	{
       
    52 	TCleanupPointerArray<T>::PushL(aRef);
       
    53 	}
       
    54 
       
    55 // End of file.