|
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 CSmsSchemeHandler |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @SYMCreationDate Created : 01/06/01 14:07:23 |
|
21 */ |
|
22 |
|
23 _LIT(KTSmsSchemeHandler_DumpName,"C:\\System\\Data\\Logs\\TSmsSchemeHandler_StateDump.bin"); |
|
24 |
|
25 inline TInt TSmsSchemeHandler_StateAccessor::InvariantTest(TAny* aTestObject) |
|
26 { |
|
27 if(aTestObject) |
|
28 { |
|
29 // CSmsSchemeHandler* SmsSchemeHandler = REINTERPRET_CAST(CSmsSchemeHandler*, aTestObject); |
|
30 } |
|
31 return KErrNone; |
|
32 } |
|
33 |
|
34 inline TInt TSmsSchemeHandler_StateAccessor::Internalize(TAny* aTestObject) |
|
35 { |
|
36 TInt error = KErrNone; |
|
37 if(aTestObject != NULL) |
|
38 { |
|
39 CSmsSchemeHandler* SmsSchemeHandler = REINTERPRET_CAST(CSmsSchemeHandler*, aTestObject); |
|
40 TRAP(error,InternalizeL(SmsSchemeHandler)); |
|
41 } |
|
42 return error; |
|
43 } |
|
44 |
|
45 inline TInt TSmsSchemeHandler_StateAccessor::Externalize(TAny* aTestObject) |
|
46 { |
|
47 TInt error = KErrNone; |
|
48 if(aTestObject != NULL) |
|
49 { |
|
50 CSmsSchemeHandler* SmsSchemeHandler = REINTERPRET_CAST(CSmsSchemeHandler*, aTestObject); |
|
51 TRAP(error,ExternalizeL(SmsSchemeHandler)); |
|
52 } |
|
53 return error; |
|
54 } |
|
55 |
|
56 inline void TSmsSchemeHandler_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CSmsSchemeHandler* /* aLoadManager */) |
|
57 { |
|
58 } |
|
59 |
|
60 inline void TSmsSchemeHandler_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CSmsSchemeHandler* /* aLoadManager */) |
|
61 { |
|
62 } |
|
63 |
|
64 inline void TSmsSchemeHandler_StateAccessor::ParseUrlL(CSmsSchemeHandler& aSms, const TDesC& aUrl) |
|
65 { |
|
66 aSms.ParseUrlL(aUrl); |
|
67 } |
|
68 |
|
69 inline RArray<SSmsNumber>& TSmsSchemeHandler_StateAccessor::GetSmsArray(CSmsSchemeHandler& aSms) |
|
70 { |
|
71 return aSms.iNumbers; |
|
72 } |
|
73 |
|
74 // internal helpers |
|
75 inline void TSmsSchemeHandler_StateAccessor::InternalizeL(CSmsSchemeHandler* aSmsSchemeHandler) |
|
76 { |
|
77 // Read in the dumped data |
|
78 RFs fs; |
|
79 User::LeaveIfError(fs.Connect()); |
|
80 CleanupClosePushL(fs); |
|
81 // Read the object dump |
|
82 TParse filename; |
|
83 filename.Set(KTSmsSchemeHandler_DumpName(),NULL,NULL); |
|
84 RFileReadStream stream; |
|
85 User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead)); |
|
86 CleanupClosePushL(stream); |
|
87 InternalizeL(stream, aSmsSchemeHandler); |
|
88 CleanupStack::PopAndDestroy(); // stream |
|
89 CleanupStack::PopAndDestroy(); // fs |
|
90 } |
|
91 |
|
92 inline void TSmsSchemeHandler_StateAccessor::ExternalizeL(CSmsSchemeHandler* aSmsSchemeHandler) |
|
93 { |
|
94 RFs fs; |
|
95 User::LeaveIfError(fs.Connect()); |
|
96 CleanupClosePushL(fs); |
|
97 // Write out the object dump |
|
98 TParse filename; |
|
99 filename.Set(KTSmsSchemeHandler_DumpName(),NULL,NULL); |
|
100 RFileWriteStream stream; |
|
101 User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite)); |
|
102 CleanupClosePushL(stream); |
|
103 ExternalizeL(stream, aSmsSchemeHandler); |
|
104 CleanupStack::PopAndDestroy(); // stream |
|
105 CleanupStack::PopAndDestroy(); // fs |
|
106 } |
|
107 |