rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrprotectiondomain.cpp
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2009 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:      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include "rtsecmgrprotectiondomain.h"
       
    23 #include "rtsecmgrserverdef.h"
       
    24 
       
    25 #include <e32debug.h>
       
    26 #include <centralrepository.h>
       
    27 
       
    28 CProtectionDomain* CProtectionDomain::NewL()
       
    29 	{
       
    30 	CProtectionDomain* self = CProtectionDomain::NewLC ();
       
    31 	CleanupStack::Pop (self);
       
    32 	return self;
       
    33 	}
       
    34 
       
    35 CProtectionDomain* CProtectionDomain::NewLC()
       
    36 	{
       
    37 	CProtectionDomain* self = new (ELeave) CProtectionDomain();
       
    38 	CleanupStack::PushL (self);
       
    39 	self->ConstructL ();
       
    40 	return self;
       
    41 	}
       
    42 
       
    43 CProtectionDomain* CProtectionDomain::NewL(RStoreReadStream& aSource)
       
    44 	{
       
    45 	CProtectionDomain* self = CProtectionDomain::NewLC (aSource);
       
    46 	CleanupStack::Pop (self);
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 CProtectionDomain* CProtectionDomain::NewLC(RStoreReadStream& aSource)
       
    51 	{
       
    52 	CProtectionDomain* self = CProtectionDomain::NewLC ();
       
    53 	self->InternalizeL (aSource);
       
    54 	return self;
       
    55 	}
       
    56 
       
    57 CProtectionDomain::~CProtectionDomain()
       
    58 	{
       
    59 	if ( iDomain)
       
    60 		{
       
    61 		delete iDomain;
       
    62 		iDomain = NULL;
       
    63 		}
       
    64 
       
    65 	if ( iPermSet)
       
    66 		{
       
    67 		delete iPermSet;
       
    68 		iPermSet = NULL;
       
    69 		}
       
    70 	}
       
    71 
       
    72 void CProtectionDomain::ExternalizeL(RStoreWriteStream& aSink) const
       
    73 	{
       
    74 	//externalise policy info data
       
    75 	aSink.WriteInt32L (iDomain->Des().MaxLength ());
       
    76 	aSink << *iDomain;
       
    77 	iPermSet->ExternalizeL (aSink);
       
    78 	}
       
    79 
       
    80 void CProtectionDomain::InternalizeL(RStoreReadStream& aSource)
       
    81 	{
       
    82 	TInt32 len = aSource.ReadInt32L ();
       
    83 	if ( iDomain)
       
    84 		{
       
    85 		delete iDomain;
       
    86 		iDomain = NULL;
       
    87 		}
       
    88 
       
    89 	iDomain = HBufC::NewL (aSource, len);
       
    90 
       
    91 	if ( iPermSet)
       
    92 		{
       
    93 		delete iPermSet;
       
    94 		iPermSet = NULL;
       
    95 		}
       
    96 
       
    97 	iPermSet = CPermissionSet::NewL ();
       
    98 	iPermSet->InternalizeL (aSource);
       
    99 	}