|
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: MPresentityPresenceEvent API object implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "presentitypresenceeventimp.h" |
|
19 #include "presenceinfoimp.h" |
|
20 #include "ximpidentityimp.h" |
|
21 #include "ximpdatasubscriptionstateimp.h" |
|
22 #include "ximpobjecthelpers.h" |
|
23 #include <s32strm.h> |
|
24 |
|
25 |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CPresentityPresenceEventImp::NewLC() |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 EXPORT_C CPresentityPresenceEventImp* CPresentityPresenceEventImp::NewLC( |
|
32 CXIMPDataSubscriptionStateImp* aState ) |
|
33 { |
|
34 CPresentityPresenceEventImp* self = new( ELeave ) CPresentityPresenceEventImp(); |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL( aState ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CPresentityPresenceEventImp::NewL() |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C CPresentityPresenceEventImp* CPresentityPresenceEventImp::NewL( |
|
45 CXIMPDataSubscriptionStateImp* aState ) |
|
46 { |
|
47 CPresentityPresenceEventImp* self = NewLC( aState ); |
|
48 CleanupStack::Pop( self ); |
|
49 return self; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CPresentityPresenceEventImp::NewFromStreamLC() |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CXIMPApiEventBase* CPresentityPresenceEventImp::NewFromStreamLC( RReadStream& aStream ) |
|
57 { |
|
58 CPresentityPresenceEventImp* self = new( ELeave ) CPresentityPresenceEventImp; |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL( aStream ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CPresentityPresenceEventImp::~CPresentityPresenceEventImp() |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CPresentityPresenceEventImp::~CPresentityPresenceEventImp() |
|
69 { |
|
70 delete iPresentityIdentity; |
|
71 delete iSubscriptionState; |
|
72 delete iPresenceInfo; |
|
73 } |
|
74 |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CPresentityPresenceEventImp::CPresentityPresenceEventImp() |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 CPresentityPresenceEventImp::CPresentityPresenceEventImp() |
|
81 { |
|
82 } |
|
83 |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CPresentityPresenceEventImp::ConstructL() |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void CPresentityPresenceEventImp::ConstructL( CXIMPDataSubscriptionStateImp* aState ) |
|
90 { |
|
91 iPresentityIdentity = CXIMPIdentityImp::NewL(); |
|
92 iPresenceInfo = CPresenceInfoImp::NewL(); |
|
93 |
|
94 iSubscriptionState = aState; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CPresentityGroupContentEventImp::ConstructL() |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CPresentityPresenceEventImp::ConstructL( RReadStream& aStream ) |
|
102 { |
|
103 iPresentityIdentity = CXIMPIdentityImp::NewL(); |
|
104 iPresenceInfo = CPresenceInfoImp::NewL(); |
|
105 iSubscriptionState = CXIMPDataSubscriptionStateImp::NewL(); |
|
106 InternalizeL( aStream ); |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // Implement supported interface access. |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresentityPresenceEventImp, |
|
114 MPresentityPresenceEvent ) |
|
115 XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this ) |
|
116 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
117 |
|
118 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresentityPresenceEventImp, |
|
119 MPresentityPresenceEvent ) |
|
120 XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) |
|
121 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
122 |
|
123 |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // Implement methods from base event interface and base event class |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CPresentityPresenceEventImp, |
|
130 MPresentityPresenceEvent ) |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // CPresentityPresenceEventImp::EqualsContent |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 TBool CPresentityPresenceEventImp::EqualsContent( |
|
137 const CXIMPApiEventBase& aOtherInstance ) const |
|
138 { |
|
139 const CPresentityPresenceEventImp* tmp = |
|
140 TXIMPGetImpClassOrPanic< const CPresentityPresenceEventImp >::From( |
|
141 aOtherInstance.Base() ); |
|
142 TBool same = ETrue; |
|
143 TBool x = iPresentityIdentity->EqualsContent( *tmp->iPresentityIdentity ); |
|
144 same &= x; |
|
145 |
|
146 x = iSubscriptionState->EqualsContent( *tmp->iSubscriptionState ); |
|
147 same &= x; |
|
148 |
|
149 x = iPresenceInfo->EqualsContent( *tmp->iPresenceInfo ); |
|
150 same &= x; |
|
151 |
|
152 return same; |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // From class CXIMPApiEventBase |
|
157 // CPresentityPresenceEventImp::ExternalizeL |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 void CPresentityPresenceEventImp::ExternalizeL( RWriteStream& aStream ) const |
|
161 { |
|
162 iPresentityIdentity->ExternalizeL( aStream ); |
|
163 iSubscriptionState->ExternalizeL( aStream ); |
|
164 iPresenceInfo->ExternalizeL( aStream ); |
|
165 } |
|
166 |
|
167 |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // CPresentityPresenceEventImp::InternalizeL() |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 void CPresentityPresenceEventImp::InternalizeL( RReadStream& aStream ) |
|
174 { |
|
175 iPresentityIdentity->InternalizeL( aStream ); |
|
176 iSubscriptionState->InternalizeL( aStream ); |
|
177 iPresenceInfo->InternalizeL( aStream ); |
|
178 } |
|
179 |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // From class MPresentityPresenceEvent. |
|
183 // CPresentityPresenceEventImp::PresentityId() |
|
184 // --------------------------------------------------------------------------- |
|
185 // |
|
186 const MXIMPIdentity& CPresentityPresenceEventImp::PresentityId() const |
|
187 { |
|
188 return *iPresentityIdentity; |
|
189 } |
|
190 |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // From class MPresentityPresenceEvent. |
|
194 // CPresentityPresenceEventImp::SubscribedPresence() |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 const MPresenceInfo& |
|
198 CPresentityPresenceEventImp::SubscribedPresence() const |
|
199 { |
|
200 return *iPresenceInfo; |
|
201 } |
|
202 |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // From class MPresentityPresenceEvent. |
|
206 // COwnPresenceEventImp::Status() |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 const MXIMPDataSubscriptionState& |
|
210 CPresentityPresenceEventImp::DataSubscriptionState() const |
|
211 { |
|
212 return *iSubscriptionState; |
|
213 } |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // COwnPresenceEventImp::SetPresenceInfo |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 void CPresentityPresenceEventImp::SetPresenceInfo( CPresenceInfoImp* aInfoImp ) |
|
220 { |
|
221 delete iPresenceInfo; |
|
222 iPresenceInfo = aInfoImp; |
|
223 } |
|
224 |
|
225 // --------------------------------------------------------------------------- |
|
226 // COwnPresenceEventImp::SetIdentityL() |
|
227 // --------------------------------------------------------------------------- |
|
228 // |
|
229 void CPresentityPresenceEventImp::SetIdentityL( const CXIMPIdentityImp& aIdentity ) |
|
230 { |
|
231 CXIMPIdentityImp* id = TXIMPObjectCloner< CXIMPIdentityImp >::CloneL( aIdentity ); |
|
232 delete iPresentityIdentity; |
|
233 iPresentityIdentity = id; |
|
234 } |
|
235 |
|
236 |
|
237 // End of file |
|
238 |