|
1 // Copyright (c) 2004-2009 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 #include "MsvSecurityCapabilitySet.h" |
|
17 #include <msvstd.hrh> |
|
18 #include <s32strm.h> |
|
19 #include <barsread.h> |
|
20 |
|
21 |
|
22 void MsvSecurityCapabilitySetUtils::ReadFromResourceL(TResourceReader& aResourceReader, TCapabilitySet& aCaps) |
|
23 { |
|
24 aResourceReader.ReadInt32(); // Version. Not used yet |
|
25 aCaps.SetEmpty(); |
|
26 const TInt count = aResourceReader.ReadInt16(); |
|
27 for (TInt ii=0; ii<count; ++ii) |
|
28 { |
|
29 aCaps.AddCapability(static_cast<TCapability>(aResourceReader.ReadInt32())); |
|
30 } |
|
31 } |
|
32 |
|
33 void MsvSecurityCapabilitySetUtils::ExternalizeL(RWriteStream& aWriteStream, const TCapabilitySet& aCaps) |
|
34 { |
|
35 aWriteStream.WriteInt32L(KMsvCurrentSecurityCapabilitySetVersion); // Always write out the current version |
|
36 // Create a non-modifiable pointer descriptor over aCaps and write to the stream |
|
37 TPckgC<TCapabilitySet> capSetPckgC(aCaps); |
|
38 aWriteStream << capSetPckgC; |
|
39 } |
|
40 |
|
41 void MsvSecurityCapabilitySetUtils::InternalizeL(RReadStream& aReadStream, TCapabilitySet& aCaps) |
|
42 { |
|
43 aReadStream.ReadInt32L(); // Version. Not used yet |
|
44 // Create a modifiable pointer descriptor over aCaps and read directly into it from the stream |
|
45 TPckg<TCapabilitySet> capSetPckg(aCaps); |
|
46 aReadStream >> capSetPckg; |
|
47 } |