os/persistentdata/loggingservices/eventlogger/test/inc/t_logsecuritypolicy.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef t_logsecuritypolicy_h
    17 #define t_logsecuritypolicy_h
    18 
    19 #include <e32std.h>
    20 
    21 /**
    22 TCompiledSecurityPolicy is a test class used for accessing private data members
    23 of TSecurityPolicy class. It uses the fact that TSecurityPolicy class has a friend class, 
    24 which name is TCompiledSecurityPolicy.
    25 @internalComponent
    26 */
    27 class TCompiledSecurityPolicy
    28 	{
    29 public:
    30 	TCompiledSecurityPolicy(const TSecurityPolicy& aSecurityPolicy) :
    31 		iSecurityPolicy(aSecurityPolicy)
    32 		{
    33 		}
    34 	TSecurityPolicy::TType Type() const
    35 		{
    36 		return static_cast <TSecurityPolicy::TType> (iSecurityPolicy.iType);
    37 		}
    38 	TUint32 SecureId() const
    39 		{
    40 		return iSecurityPolicy.iSecureId;
    41 		}
    42 	TUint32 VendorId() const
    43 		{
    44 		return iSecurityPolicy.iVendorId;
    45 		}
    46 	TCapability Capability(TInt aIndex) const
    47 		{
    48 		if(aIndex < 3)
    49 			{
    50 			return static_cast <TCapability> (iSecurityPolicy.iCaps[aIndex]);
    51 			}
    52 		else if(aIndex < 7)
    53 			{
    54 			return static_cast <TCapability> (iSecurityPolicy.iExtraCaps[aIndex - 3]);
    55 			}
    56 		User::Invariant();
    57 		return ECapability_None;
    58 		}
    59 
    60 private:
    61 	const TSecurityPolicy& iSecurityPolicy;
    62 
    63 	};
    64 
    65 inline TBool operator==(const TCompiledSecurityPolicy& aLeft, const TCompiledSecurityPolicy& aRight)
    66 	{
    67 	return aLeft.Type() == aRight.Type() && 
    68 	       aLeft.SecureId() == aRight.SecureId() &&
    69 	       aLeft.VendorId() == aRight.VendorId() &&
    70 	       aLeft.Capability(0) == aRight.Capability(0) &&
    71 	       aLeft.Capability(1) == aRight.Capability(1) &&
    72 	       aLeft.Capability(2) == aRight.Capability(2) &&
    73 	       aLeft.Capability(3) == aRight.Capability(3) &&
    74 	       aLeft.Capability(4) == aRight.Capability(4) &&
    75 	       aLeft.Capability(5) == aRight.Capability(5) &&
    76 	       aLeft.Capability(6) == aRight.Capability(6);
    77 	}
    78 
    79 #endif//t_logsecuritypolicy_h