|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: MPresenceBlockInfo API object implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "presenceblockinfoimp.h" |
|
19 #include "ximpidentityimp.h" |
|
20 #include "ximprbufhelpers.h" |
|
21 #include "ximpobjecthelpers.h" |
|
22 |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS ============================= |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CPresenceBlockInfoImp::NewLC() |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewLC( |
|
31 const MXIMPIdentity& aIdentity, |
|
32 const TDesC16& aDisplayName ) |
|
33 { |
|
34 CPresenceBlockInfoImp* self = new( ELeave ) CPresenceBlockInfoImp; |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL( aIdentity, aDisplayName ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CPresenceBlockInfoImp::NewLC() |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewLC() |
|
45 { |
|
46 CPresenceBlockInfoImp* self = new( ELeave ) CPresenceBlockInfoImp; |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL(); |
|
49 return self; |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CPresenceBlockInfoImp::NewL() |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CPresenceBlockInfoImp* CPresenceBlockInfoImp::NewL() |
|
58 { |
|
59 CPresenceBlockInfoImp* self = NewLC(); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CXIMPFeatureInfoImp::NewFromStreamLC() |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceBlockInfoImp ) |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // Implement supported interface access. |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceBlockInfoImp, |
|
75 MPresenceBlockInfo ) |
|
76 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
77 |
|
78 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceBlockInfoImp, |
|
79 MPresenceBlockInfo ) |
|
80 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
81 |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CPresenceBlockInfoImp::~CPresenceBlockInfoImp() |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CPresenceBlockInfoImp::~CPresenceBlockInfoImp() |
|
88 { |
|
89 iDisplayName.Close(); |
|
90 delete iIdentity; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CPresenceBlockInfoImp::CPresenceBlockInfoImp() |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 CPresenceBlockInfoImp::CPresenceBlockInfoImp() |
|
98 { |
|
99 } |
|
100 |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CPresenceBlockInfoImp::ConstructL() |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 void CPresenceBlockInfoImp::ConstructL() |
|
107 { |
|
108 iDisplayName.CreateL( 0 ); |
|
109 iIdentity = CXIMPIdentityImp::NewL(); |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // CPresenceBlockInfoImp::ConstructL() |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 void CPresenceBlockInfoImp::ConstructL( |
|
117 const MXIMPIdentity& aIdentity, |
|
118 const TDesC16& aDisplayName ) |
|
119 { |
|
120 const CXIMPIdentityImp* sourceIdentity = |
|
121 TXIMPGetImpClassOrPanic< const CXIMPIdentityImp>::From( aIdentity ); |
|
122 |
|
123 iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity ); |
|
124 iDisplayName.CreateL( aDisplayName ); |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CPresenceBlockInfoImp::ExternalizeL() |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C void CPresenceBlockInfoImp::ExternalizeL( RWriteStream& aStream ) const |
|
132 { |
|
133 iIdentity->ExternalizeL( aStream ); |
|
134 XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // CPresenceBlockInfoImp::InternalizeL() |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 EXPORT_C void CPresenceBlockInfoImp::InternalizeL( RReadStream& aStream ) |
|
142 { |
|
143 iIdentity->InternalizeL( aStream ); |
|
144 XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // From MPresenceBlockInfo class. |
|
149 // CPresenceBlockInfoImp::BlockedEntityId() |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 const MXIMPIdentity& CPresenceBlockInfoImp::BlockedEntityId() const |
|
153 { |
|
154 return *iIdentity; |
|
155 } |
|
156 |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // From MPresenceBlockInfo class. |
|
160 // CPresenceBlockInfoImp::BlockedEntityDisplayName() |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 const TDesC16& CPresenceBlockInfoImp::BlockedEntityDisplayName() const |
|
164 { |
|
165 return iDisplayName; |
|
166 } |
|
167 |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // From MPresenceBlockInfo class. |
|
171 // CPresenceBlockInfoImp::SetBlockedEntityIdL() |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 void CPresenceBlockInfoImp::SetBlockedEntityIdL( |
|
175 MXIMPIdentity* aIdentity ) |
|
176 { |
|
177 CXIMPIdentityImp* identityImp = |
|
178 TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); |
|
179 |
|
180 delete iIdentity; |
|
181 iIdentity = identityImp; |
|
182 } |
|
183 |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // From MPresenceBlockInfo class. |
|
187 // CPresenceBlockInfoImp::SetBlockedEntityDisplayNameL() |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 void CPresenceBlockInfoImp::SetBlockedEntityDisplayNameL( |
|
191 const TDesC16& aDisplayName ) |
|
192 { |
|
193 HBufC16* displayNameBuf = aDisplayName.AllocL(); |
|
194 iDisplayName.Close(); |
|
195 iDisplayName.Assign( displayNameBuf ); |
|
196 } |
|
197 |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // CPresenceBlockInfoImp::EqualsContent() |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 TBool CPresenceBlockInfoImp::EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const |
|
204 { |
|
205 const CPresenceBlockInfoImp* tmp = |
|
206 TXIMPGetImpClassOrPanic< const CPresenceBlockInfoImp >::From( aOtherInstance.Base() ); |
|
207 |
|
208 TBool same = ETrue; |
|
209 TBool x; |
|
210 |
|
211 x = ( iIdentity->Compare( *tmp->iIdentity ) == 0 ); |
|
212 same &= x; |
|
213 |
|
214 x = ( iDisplayName.Compare( tmp->iDisplayName ) == 0 ); |
|
215 same &= x; |
|
216 |
|
217 return same; |
|
218 } |
|
219 |
|
220 // --------------------------------------------------------------------------- |
|
221 // CPresenceBlockInfoImp::SetIdentityL() |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 EXPORT_C void CPresenceBlockInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity ) |
|
225 { |
|
226 delete iIdentity; |
|
227 iIdentity = aIdentity; |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // CPresenceBlockInfoImp::SetDisplayName() |
|
232 // --------------------------------------------------------------------------- |
|
233 // |
|
234 EXPORT_C void CPresenceBlockInfoImp::SetDisplayName( HBufC16* aDisplayName ) |
|
235 { |
|
236 iDisplayName.Close(); |
|
237 iDisplayName.Assign( aDisplayName ); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // CPresenceBlockInfoImp::IdLinearOrder() |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 EXPORT_C TInt CPresenceBlockInfoImp::IdLinearOrder( |
|
245 const CPresenceBlockInfoImp& aA, |
|
246 const CPresenceBlockInfoImp& aB ) |
|
247 { |
|
248 return aA.IdentityImp().Compare( aB.IdentityImp() ); |
|
249 } |
|
250 // --------------------------------------------------------------------------- |
|
251 // CPresenceBlockInfoImp::IdentityImp() |
|
252 // --------------------------------------------------------------------------- |
|
253 // |
|
254 EXPORT_C const CXIMPIdentityImp& CPresenceBlockInfoImp::IdentityImp() const |
|
255 { |
|
256 return *iIdentity; |
|
257 } |
|
258 |
|
259 // End of file |