|
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: MPresentityGroupList API object implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPRESENTITYGROUPLISTEVENTIMP_H |
|
19 #define CPRESENTITYGROUPLISTEVENTIMP_H |
|
20 |
|
21 #include "ximpapieventbase.h" |
|
22 #include "presencetypehelpers.h" |
|
23 #include "ximpdatasubscriptionstateimp.h" |
|
24 #include <presentitygrouplistevent.h> |
|
25 |
|
26 class RReadStream; |
|
27 class CPresentityGroupInfoImp; |
|
28 class CXIMPDataSubscriptionStateImp; |
|
29 |
|
30 /** |
|
31 * MOwnPresenceEvent API object implementation. |
|
32 * |
|
33 * @lib ximpdatamodel.dll |
|
34 * @since S60 v3.2 |
|
35 */ |
|
36 NONSHARABLE_CLASS( CPresentityGroupListEventImp ): public CXIMPApiEventBase, |
|
37 public MPresentityGroupListEvent |
|
38 { |
|
39 public: |
|
40 /** The class ID. */ |
|
41 enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPLISTEVENTIMP }; |
|
42 |
|
43 public: |
|
44 /** |
|
45 * Exported instantiation method for initializing |
|
46 * new event object. |
|
47 */ |
|
48 IMPORT_C static CPresentityGroupListEventImp* NewLC( |
|
49 RPrGrpInfoImpArray* aCreated, |
|
50 RPrGrpInfoImpArray* aUpdated, |
|
51 RPrGrpInfoImpArray* aDeleted, |
|
52 CXIMPDataSubscriptionStateImp* aState |
|
53 ); |
|
54 |
|
55 /** |
|
56 * Exported instantiation method for initializing |
|
57 * new event object. |
|
58 */ |
|
59 IMPORT_C static CPresentityGroupListEventImp* NewLC( |
|
60 RPrGrpInfoImpArray* aCreated, |
|
61 RPrGrpInfoImpArray* aUpdated, |
|
62 RPrGrpInfoImpArray* aDeleted, |
|
63 RPrGrpInfoImpArray* aCurrent, |
|
64 CXIMPDataSubscriptionStateImp* aState |
|
65 ); |
|
66 IMPORT_C static CPresentityGroupListEventImp* NewL( |
|
67 RPrGrpInfoImpArray* aCreated, |
|
68 RPrGrpInfoImpArray* aUpdated, |
|
69 RPrGrpInfoImpArray* aDeleted, |
|
70 RPrGrpInfoImpArray* aCurrent, |
|
71 CXIMPDataSubscriptionStateImp* aState |
|
72 ); |
|
73 |
|
74 /** |
|
75 * Instantiation method for event automation. |
|
76 * Method signature must be exactly this to work |
|
77 * with event delivery automation system. |
|
78 * |
|
79 * Event implementation must be registered to |
|
80 * XIMPEventCodec KXIMPEventConstructorTable. |
|
81 */ |
|
82 static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); |
|
83 |
|
84 virtual ~CPresentityGroupListEventImp(); |
|
85 |
|
86 |
|
87 private: |
|
88 CPresentityGroupListEventImp(); |
|
89 |
|
90 void ConstructL( |
|
91 RPrGrpInfoImpArray* aCreated, |
|
92 RPrGrpInfoImpArray* aUpdated, |
|
93 RPrGrpInfoImpArray* aDeleted, |
|
94 CXIMPDataSubscriptionStateImp* aState |
|
95 ); |
|
96 |
|
97 void ConstructL( |
|
98 RPrGrpInfoImpArray* aCreated, |
|
99 RPrGrpInfoImpArray* aUpdated, |
|
100 RPrGrpInfoImpArray* aDeleted, |
|
101 RPrGrpInfoImpArray* aCurrent, |
|
102 CXIMPDataSubscriptionStateImp* aState |
|
103 ); |
|
104 |
|
105 void ConstructL( RReadStream& aStream ); |
|
106 |
|
107 /** |
|
108 * Helper for externalize. |
|
109 */ |
|
110 void WriteArrayToStreamL( RPrGrpInfoImpArray& aArray, |
|
111 RWriteStream& aStream ) const; |
|
112 |
|
113 /** |
|
114 * Helper for internalize |
|
115 */ |
|
116 void FillArrayFromStreamL( RPrGrpInfoImpArray& aArray, |
|
117 RReadStream& aStream ); |
|
118 |
|
119 public: // From API base interfaces |
|
120 |
|
121 /** |
|
122 * Implementation of MXIMPBase interface methods |
|
123 * @see MXIMPBase |
|
124 */ |
|
125 XIMPIMP_DECLARE_IF_BASE_METHODS |
|
126 |
|
127 |
|
128 /** |
|
129 * Implementation of MXIMPEventBase interface and |
|
130 * CXIMPApiEventBase methods |
|
131 * |
|
132 * @see MXIMPEventBase |
|
133 * @see CXIMPApiEventBase |
|
134 */ |
|
135 XIMPIMP_DECLARE_EVENT_BASE_METHODS |
|
136 |
|
137 |
|
138 public: // From MPresentityGroupList |
|
139 |
|
140 TInt NewGroupsCount() const; |
|
141 const MPresentityGroupInfo& NewGroup( TInt aIndex ) const; |
|
142 |
|
143 TInt UpdatedGroupsCount() const; |
|
144 const MPresentityGroupInfo& UpdatedGroup( TInt aIndex ) const; |
|
145 |
|
146 TInt DisappearedGroupsCount() const; |
|
147 const MPresentityGroupInfo& DisappearedGroup( TInt aIndex ) const; |
|
148 |
|
149 TInt CurrentGroupsCount() const; |
|
150 const MPresentityGroupInfo& CurrentGroup( TInt aIndex ) const; |
|
151 |
|
152 const MXIMPDataSubscriptionState& DataSubscriptionState() const; |
|
153 |
|
154 private: |
|
155 |
|
156 /** |
|
157 * Compare the given arrays for equality. |
|
158 * Arrays must be sorted. This is a method specific |
|
159 * to the group info imp array. |
|
160 * @return ETrue if the arrays match, EFalse otherwise. |
|
161 */ |
|
162 static TBool CompareArrays( RPrGrpInfoImpArray* aA, RPrGrpInfoImpArray* aB ); |
|
163 |
|
164 private: // data |
|
165 |
|
166 /** |
|
167 * ETrue if constructed from stream. |
|
168 */ |
|
169 TBool iConstructedFromStream; |
|
170 |
|
171 /** |
|
172 * ETrue if current groups array is owned. |
|
173 */ |
|
174 TBool iOwnsCurrentGroupsArray; |
|
175 |
|
176 /** |
|
177 * Group informations. |
|
178 * Owns if constructed from stream. Otherwise does not own. |
|
179 */ |
|
180 RPrGrpInfoImpArray* iCreatedGroups; |
|
181 RPrGrpInfoImpArray* iUpdatedGroups; |
|
182 RPrGrpInfoImpArray* iDeletedGroups; |
|
183 RPrGrpInfoImpArray* iCurrentGroups; |
|
184 |
|
185 /** |
|
186 * |
|
187 */ |
|
188 CXIMPDataSubscriptionStateImp* iSubscriptionState; |
|
189 }; |
|
190 |
|
191 |
|
192 #endif // CPRESENTITYGROUPLISTEVENTIMP_H |