|
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 "csendastestaddress.h" |
|
17 |
|
18 #include <s32strm.h> |
|
19 |
|
20 const TInt KSendAsTestAddressVersion = 1; |
|
21 |
|
22 EXPORT_C CSendAsTestAddress* CSendAsTestAddress::NewL() |
|
23 { |
|
24 return new (ELeave) CSendAsTestAddress(); |
|
25 } |
|
26 |
|
27 EXPORT_C CSendAsTestAddress::~CSendAsTestAddress() |
|
28 { |
|
29 delete iAddress; |
|
30 delete iAlias; |
|
31 } |
|
32 |
|
33 CSendAsTestAddress::CSendAsTestAddress() |
|
34 : CBase() |
|
35 { |
|
36 } |
|
37 |
|
38 void CSendAsTestAddress::InternalizeL(RReadStream& aStream) |
|
39 { |
|
40 aStream.ReadInt16L(); //version. Not used yet |
|
41 |
|
42 HBufC* address = HBufC::NewL(aStream, KMaxTInt); |
|
43 delete iAddress; |
|
44 iAddress = address; |
|
45 |
|
46 HBufC* alias = HBufC::NewL(aStream, KMaxTInt); |
|
47 delete iAlias; |
|
48 iAlias = alias; |
|
49 |
|
50 iAddressType = static_cast<CSendAsTestMessage::TSendAsTestAddressType>(aStream.ReadInt32L()); |
|
51 } |
|
52 |
|
53 void CSendAsTestAddress::ExternalizeL(RWriteStream& aStream) const |
|
54 { |
|
55 aStream.WriteInt16L(KSendAsTestAddressVersion); |
|
56 |
|
57 aStream << Address(); |
|
58 aStream << Alias(); |
|
59 |
|
60 aStream.WriteInt32L(iAddressType); |
|
61 } |
|
62 |
|
63 EXPORT_C const TDesC& CSendAsTestAddress::Address() const |
|
64 { |
|
65 return iAddress != NULL ? *iAddress : KNullDesC(); |
|
66 } |
|
67 |
|
68 EXPORT_C void CSendAsTestAddress::SetAddressL(const TDesC& aAddress) |
|
69 { |
|
70 HBufC* address = aAddress.AllocL(); |
|
71 delete iAddress; |
|
72 iAddress = address; |
|
73 } |
|
74 |
|
75 EXPORT_C const TDesC& CSendAsTestAddress::Alias() const |
|
76 { |
|
77 return iAlias != NULL ? *iAlias : KNullDesC(); |
|
78 } |
|
79 |
|
80 EXPORT_C void CSendAsTestAddress::SetAliasL(const TDesC& aAlias) |
|
81 { |
|
82 HBufC* alias = aAlias.AllocL(); |
|
83 delete iAlias; |
|
84 iAlias = alias; |
|
85 } |
|
86 |
|
87 EXPORT_C CSendAsTestMessage::TSendAsTestAddressType CSendAsTestAddress::AddressType() const |
|
88 { |
|
89 return iAddressType; |
|
90 } |
|
91 |
|
92 EXPORT_C void CSendAsTestAddress::SetAddressType(CSendAsTestMessage::TSendAsTestAddressType aAddressType) |
|
93 { |
|
94 iAddressType = aAddressType; |
|
95 } |