eapol/eapol_framework/eapol_symbian/am/include/EapAutomatic.h
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
     1 /*
       
     2 * Copyright (c) 2001-2006 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 the License "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:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 3 %
       
    20 */
       
    21 
       
    22 #ifndef _EAP_AUTOMATIC_H_
       
    23 #define _EAP_AUTOMATIC_H_
       
    24 
       
    25 template <class Type>
       
    26 class PointerArrayResetAndDestroy
       
    27 {
       
    28 
       
    29 public:
       
    30 
       
    31 	PointerArrayResetAndDestroy( RPointerArray<Type> * aArray, const TBool aDeleteWhenTrue)
       
    32 		: iArray(aArray)
       
    33 		, iDeleteWhenTrue(aDeleteWhenTrue)
       
    34 	{
       
    35 	}
       
    36 
       
    37 	virtual ~PointerArrayResetAndDestroy()
       
    38 	{
       
    39 		if (iArray != 0)
       
    40 		{
       
    41 			iArray->ResetAndDestroy();
       
    42 			iArray->Close();
       
    43 
       
    44 			if (iDeleteWhenTrue)
       
    45 			{
       
    46 				delete iArray;
       
    47 			}
       
    48 			iArray = 0;
       
    49 		}
       
    50 	}
       
    51 
       
    52 	void DoNotFreeArray()
       
    53 	{
       
    54 		iArray = 0;
       
    55 	}
       
    56 
       
    57 private:
       
    58 
       
    59 	RPointerArray<Type> * iArray;
       
    60 
       
    61 	TBool iDeleteWhenTrue;
       
    62 
       
    63 };
       
    64 
       
    65 #endif // _EAP_AUTOMATIC_H_
       
    66 
       
    67 // End of file