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