|
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: MPresenceGrantRequestInfo API object implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "presencegrantrequestinfoimp.h" |
|
20 #include "ximpidentityimp.h" |
|
21 #include "ximprbufhelpers.h" |
|
22 #include "ximpobjecthelpers.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS ============================= |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CPresenceGrantRequestInfoImp::NewLC() |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewLC( |
|
31 const MXIMPIdentity& aIdentity, |
|
32 const TDesC16& aDisplayName ) |
|
33 { |
|
34 CPresenceGrantRequestInfoImp* self = new( ELeave ) CPresenceGrantRequestInfoImp; |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL( aIdentity, aDisplayName ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CPresenceGrantRequestInfoImp::NewLC() |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewLC() |
|
45 { |
|
46 CPresenceGrantRequestInfoImp* self = new( ELeave ) CPresenceGrantRequestInfoImp; |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL(); |
|
49 return self; |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CPresenceGrantRequestInfoImp::NewL() |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CPresenceGrantRequestInfoImp* CPresenceGrantRequestInfoImp::NewL() |
|
58 { |
|
59 CPresenceGrantRequestInfoImp* self = NewLC(); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CPresenceGrantRequestfoImp::NewFromStreamLC() |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceGrantRequestInfoImp ) |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // Implement supported interface access. |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceGrantRequestInfoImp, |
|
75 MPresenceGrantRequestInfo ) |
|
76 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
77 |
|
78 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceGrantRequestInfoImp, |
|
79 MPresenceGrantRequestInfo ) |
|
80 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
81 |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CPresenceGrantRequestInfoImp::~CPresenceGrantRequestInfoImp() |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CPresenceGrantRequestInfoImp::~CPresenceGrantRequestInfoImp() |
|
88 { |
|
89 iDisplayName.Close(); |
|
90 delete iIdentity; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CPresenceGrantRequestInfoImp::CPresenceGrantRequestInfoImp() |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 CPresenceGrantRequestInfoImp::CPresenceGrantRequestInfoImp() |
|
98 { |
|
99 } |
|
100 |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CPresenceGrantRequestInfoImp::ConstructL() |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 void CPresenceGrantRequestInfoImp::ConstructL() |
|
107 { |
|
108 iDisplayName.CreateL( 0 ); |
|
109 iIdentity = CXIMPIdentityImp::NewLC(); |
|
110 CleanupStack::Pop( iIdentity ); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CPresenceGrantRequestInfoImp::ConstructL() |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CPresenceGrantRequestInfoImp::ConstructL( |
|
118 const MXIMPIdentity& aIdentity, |
|
119 const TDesC16& aDisplayName ) |
|
120 { |
|
121 const CXIMPIdentityImp* sourceIdentity = static_cast< const CXIMPIdentityImp* >( &aIdentity ); |
|
122 iIdentity = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( *sourceIdentity ); |
|
123 iDisplayName.CreateL( aDisplayName ); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CPresenceGrantRequestInfoImp::ExternalizeL() |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void CPresenceGrantRequestInfoImp::ExternalizeL( RWriteStream& aStream ) const |
|
131 { |
|
132 iIdentity->ExternalizeL( aStream ); |
|
133 XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream ); |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CPresenceGrantRequestInfoImp::InternalizeL() |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C void CPresenceGrantRequestInfoImp::InternalizeL( RReadStream& aStream ) |
|
141 { |
|
142 iIdentity->InternalizeL( aStream ); |
|
143 XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream ); |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // From MPresenceGrantRequestInfo class. |
|
148 // CPresenceGrantRequestInfoImp::RequestorId() |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 |
|
152 const MXIMPIdentity& CPresenceGrantRequestInfoImp::RequestorId() const |
|
153 { |
|
154 return *iIdentity; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // From MPresenceGrantRequestInfo class. |
|
159 // CPresenceGrantRequestInfoImp::RequestorDisplayName() |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 const TDesC16& CPresenceGrantRequestInfoImp::RequestorDisplayName() const |
|
163 { |
|
164 return iDisplayName; |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // From MPresenceGrantRequestInfo class. |
|
169 // CPresenceGrantRequestInfoImp::SetRequestorIdL() |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 void CPresenceGrantRequestInfoImp::SetRequestorIdL( |
|
173 MXIMPIdentity* aIdentity ) |
|
174 { |
|
175 CXIMPIdentityImp* identityImp = |
|
176 TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity ); |
|
177 |
|
178 delete iIdentity; |
|
179 iIdentity = identityImp; |
|
180 } |
|
181 |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // From MPresenceGrantRequestInfo class. |
|
185 // CPresenceGrantRequestInfoImp:: |
|
186 // --------------------------------------------------------------------------- |
|
187 // |
|
188 void CPresenceGrantRequestInfoImp::SetRequestorDisplayNameL( |
|
189 const TDesC16& aDisplayName ) |
|
190 { |
|
191 HBufC16* displayNameBuf = aDisplayName.AllocL(); |
|
192 iDisplayName.Close(); |
|
193 iDisplayName.Assign( displayNameBuf ); |
|
194 } |
|
195 |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // CPresenceGrantRequestInfoImp::SetIdentityL() |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 EXPORT_C void CPresenceGrantRequestInfoImp::SetIdentity( CXIMPIdentityImp* aIdentity ) |
|
202 { |
|
203 delete iIdentity; |
|
204 iIdentity = aIdentity; |
|
205 } |
|
206 |
|
207 // --------------------------------------------------------------------------- |
|
208 // CPresenceGrantRequestInfoImp::SetDisplayName() |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 EXPORT_C void CPresenceGrantRequestInfoImp::SetDisplayName( HBufC16* aDisplayName ) |
|
212 { |
|
213 iDisplayName.Close(); |
|
214 iDisplayName.Assign( aDisplayName ); |
|
215 } |
|
216 |
|
217 // --------------------------------------------------------------------------- |
|
218 // CPresenceGrantRequestInfoImp::IdLinearOrder() |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 EXPORT_C TInt CPresenceGrantRequestInfoImp::IdLinearOrder( |
|
222 const CPresenceGrantRequestInfoImp& aA, |
|
223 const CPresenceGrantRequestInfoImp& aB ) |
|
224 { |
|
225 return aA.IdentityImp().Compare( aB.IdentityImp() ); |
|
226 } |
|
227 // --------------------------------------------------------------------------- |
|
228 // CPresenceGrantRequestInfoImp::IdentityImp() |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 EXPORT_C const CXIMPIdentityImp& CPresenceGrantRequestInfoImp::IdentityImp() const |
|
232 { |
|
233 return *iIdentity; |
|
234 } |
|
235 |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // CPresenceGrantRequestInfoImp::EqualsContent() |
|
239 // --------------------------------------------------------------------------- |
|
240 // |
|
241 TBool CPresenceGrantRequestInfoImp::EqualsContent( |
|
242 const CXIMPApiDataObjBase& aOtherInstance ) const |
|
243 { |
|
244 const CPresenceGrantRequestInfoImp* tmp = |
|
245 TXIMPGetImpClassOrPanic< const CPresenceGrantRequestInfoImp >::From( |
|
246 aOtherInstance.Base() ); |
|
247 |
|
248 TBool same = ETrue; |
|
249 TBool x; |
|
250 x = iIdentity->EqualsContent( *( tmp->iIdentity ) ); |
|
251 same &= x; |
|
252 |
|
253 x = 0 == iDisplayName.Compare( tmp->iDisplayName ); |
|
254 same &= x; |
|
255 |
|
256 // add more comparisons in a similar way... |
|
257 |
|
258 return same; |
|
259 } |
|
260 |
|
261 // End of file |