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