|
1 // Copyright (c) 1997-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 // The implementation of the accessor class upon the CComponentInfo |
|
15 // |
|
16 // |
|
17 |
|
18 // ______________________________________________________________________________ |
|
19 // |
|
20 _LIT(KTComponentInfo_DumpName,"C:\\System\\Data\\Logs\\TComponentInfo_StateDump.bin"); |
|
21 |
|
22 inline TInt TComponentInfo_StateAccessor::InvariantTest(TAny* aTestObject) |
|
23 { |
|
24 if(aTestObject) |
|
25 { |
|
26 // Nothing to do |
|
27 } |
|
28 return KErrNone; |
|
29 } |
|
30 |
|
31 inline TInt TComponentInfo_StateAccessor::Internalize(TAny* aTestObject) |
|
32 { |
|
33 TInt error = KErrNone; |
|
34 if(aTestObject != NULL) |
|
35 { |
|
36 CComponentInfo* ComponentInfo = REINTERPRET_CAST(CComponentInfo*, aTestObject); |
|
37 TRAP(error,InternalizeL(ComponentInfo)); |
|
38 } |
|
39 return error; |
|
40 } |
|
41 |
|
42 inline TInt TComponentInfo_StateAccessor::Externalize(TAny* aTestObject) |
|
43 { |
|
44 TInt error = KErrNone; |
|
45 if(aTestObject != NULL) |
|
46 { |
|
47 CComponentInfo* ComponentInfo = REINTERPRET_CAST(CComponentInfo*, aTestObject); |
|
48 TRAP(error,ExternalizeL(ComponentInfo)); |
|
49 } |
|
50 return error; |
|
51 } |
|
52 |
|
53 inline void TComponentInfo_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CComponentInfo* /* aLoadManager */) |
|
54 { |
|
55 // Nothing to do |
|
56 } |
|
57 |
|
58 inline void TComponentInfo_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CComponentInfo* /* aLoadManager */) |
|
59 { |
|
60 // Nothing to do |
|
61 } |
|
62 |
|
63 // internal helpers |
|
64 inline void TComponentInfo_StateAccessor::InternalizeL(CComponentInfo* aComponentInfo) |
|
65 { |
|
66 // Read in the dumped data |
|
67 RFs fs; |
|
68 User::LeaveIfError(fs.Connect()); |
|
69 CleanupClosePushL(fs); |
|
70 // Read the object dump |
|
71 TParse filename; |
|
72 filename.Set(KTComponentInfo_DumpName(),NULL,NULL); |
|
73 RFileReadStream stream; |
|
74 User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead)); |
|
75 CleanupClosePushL(stream); |
|
76 InternalizeL(stream, aComponentInfo); |
|
77 CleanupStack::PopAndDestroy(2); // stream & fs |
|
78 } |
|
79 |
|
80 inline void TComponentInfo_StateAccessor::ExternalizeL(CComponentInfo* aComponentInfo) |
|
81 { |
|
82 RFs fs; |
|
83 User::LeaveIfError(fs.Connect()); |
|
84 CleanupClosePushL(fs); |
|
85 // Write out the object dump |
|
86 TParse filename; |
|
87 filename.Set(KTComponentInfo_DumpName(),NULL,NULL); |
|
88 RFileWriteStream stream; |
|
89 User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite)); |
|
90 CleanupClosePushL(stream); |
|
91 ExternalizeL(stream, aComponentInfo); |
|
92 CleanupStack::PopAndDestroy(2); // stream & fs |
|
93 } |
|
94 |