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