|
1 /* |
|
2 * Copyright (c) 2005 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: Private change finder header |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CHANGEFINDER_H__ |
|
20 #define __CHANGEFINDER_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <msvids.h> |
|
24 #include <nsmlchangefinder.h> |
|
25 #include "SnapshotItem.h" |
|
26 |
|
27 // DATATYPES |
|
28 typedef CArrayFixSeg<TSnapshotItem> CSnapshotArray; |
|
29 |
|
30 // Granularity used with dynamic array |
|
31 const TInt KSnapshotGranularity = 32; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * @brief CChangeFinder Class |
|
37 * This is a ChangeFinder class, which can be used to track down changes in the message store. |
|
38 * It's functionality is equal to CSmlChangeFinder, except the functionality is a bit wider |
|
39 * since this class can also detect "partially updated" items. It means that if only the status |
|
40 * Bits of the message are changed, it can be detected. It is achieved by using TSnapshotItem |
|
41 * class, which contain also this information. Because neither of these classes contained virtual |
|
42 * functionality, the functionality of this class couldn't be inherited from the CSmlChangeFinder |
|
43 */ |
|
44 class CChangeFinder : public CBase |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Class constructor, Creates a new class instance. |
|
50 * |
|
51 * @param aSyncRelationship IN: Reference to MSmlSyncRelationship interface. |
|
52 * @param aKey IN: Key that is used in sorting snapshot. |
|
53 * @param aStreamUid IN: Snapshot stream UID. |
|
54 * @return CChangeFinder*, New ChangeFinder instance. |
|
55 */ |
|
56 static CChangeFinder* NewL( MSmlSyncRelationship& aSyncRelationship, |
|
57 TKeyArrayFix aKey, |
|
58 TBool& aHasHistory, |
|
59 TInt aStreamUid = KNSmlDefaultSnapshotStreamUID ); |
|
60 |
|
61 /** |
|
62 * Class destructor. |
|
63 */ |
|
64 ~CChangeFinder(); |
|
65 |
|
66 /** |
|
67 * Close ChangeFinder object, stores snapshot. |
|
68 */ |
|
69 void CloseL(); |
|
70 |
|
71 /** |
|
72 * Reset change information, makes all content new from ChangeFinder point of view. |
|
73 */ |
|
74 void ResetL(); |
|
75 |
|
76 /** |
|
77 * Find changed items by comparing snapshots. |
|
78 * |
|
79 * @param aChangedUids IN: Array for results. |
|
80 */ |
|
81 void FindChangedItemsL( CNSmlDataItemUidSet& aChangedUids ); |
|
82 |
|
83 /** |
|
84 * Find deleteed items by comparing snapshots. |
|
85 * |
|
86 * @param aDeletedUids IN: Array for results. |
|
87 */ |
|
88 void FindDeletedItemsL( CNSmlDataItemUidSet& aDeletedUids ); |
|
89 |
|
90 /** |
|
91 * Find new items by comparing snapshots. |
|
92 * |
|
93 * @param aNewUids IN: Array for results. |
|
94 */ |
|
95 void FindNewItemsL(CNSmlDataItemUidSet& aNewUids); |
|
96 |
|
97 /** |
|
98 * Find moved items by comparing snapshots. |
|
99 * |
|
100 * @param aMovedUids IN: Array for results. |
|
101 */ |
|
102 void FindMovedItemsL( CNSmlDataItemUidSet& aMovedUids ); |
|
103 |
|
104 /** |
|
105 * Add item to snapshot, it is no loger reported. |
|
106 * |
|
107 * @param aItem IN: item to add. |
|
108 */ |
|
109 void ItemAddedL( const TSnapshotItem& aItem ); |
|
110 |
|
111 /** |
|
112 * Delete item from snapshot, it is no loger reported. |
|
113 * |
|
114 * @param aItem IN: item to delete. |
|
115 */ |
|
116 void ItemDeletedL( const TSnapshotItem& aItem ); |
|
117 |
|
118 /** |
|
119 * Update item to snapshot, it is no loger reported. |
|
120 * |
|
121 * @param aItem IN: item to update. |
|
122 */ |
|
123 void ItemUpdatedL( const TSnapshotItem& aItem ); |
|
124 |
|
125 /** |
|
126 * Move item within snapshot, it is no loger reported. |
|
127 * |
|
128 * @param aItem IN: item to move. |
|
129 */ |
|
130 void ItemMovedL( const TSnapshotItem& aItem ); |
|
131 |
|
132 /** |
|
133 * Commit all changes to snapshot, there's nothing to report anymore. |
|
134 */ |
|
135 void CommitChangesL(); |
|
136 |
|
137 /** |
|
138 * Commit a set of items to snapshot, these items won't be reported anymore. |
|
139 * |
|
140 * @param aUids IN: a set of items to commit. |
|
141 */ |
|
142 void CommitChangesL( const MSmlDataItemUidSet& aUids ); |
|
143 |
|
144 /** |
|
145 * Sets new snapshot to compare against. |
|
146 * |
|
147 * @param aNewSnapshot IN: a new snapshot. |
|
148 */ |
|
149 void SetNewSnapshot( CSnapshotArray* aNewSnapshot ); |
|
150 |
|
151 /** |
|
152 * Retrieves DataStore id number. |
|
153 * |
|
154 * @return TInt64, DataStore id. |
|
155 */ |
|
156 TInt64 DataStoreUid() const; |
|
157 |
|
158 /** |
|
159 * Sets DataStore id number. |
|
160 * |
|
161 * @param aUid IN: a new datastore id. |
|
162 */ |
|
163 void SetDataStoreUid( TInt64 aUid ); |
|
164 |
|
165 /** |
|
166 * Checks whether specific item can be partially updated. |
|
167 * |
|
168 * @param aUid IN: item id. |
|
169 * @return TBool Result, ETrue if the item contains only status change (read<->unread). |
|
170 */ |
|
171 TBool UpdatePartialL( TSmlDbItemUid& aUid ); |
|
172 |
|
173 protected: |
|
174 |
|
175 /** |
|
176 * C++ Constructor |
|
177 * |
|
178 * @param aSyncRelationship IN: Reference to MSmlSyncRelationship interface. |
|
179 * @param aKey IN: Key that is used in sorting snapshot. |
|
180 * @param aStreamUid IN: Snapshot stream UID. |
|
181 */ |
|
182 CChangeFinder( MSmlSyncRelationship& aSyncRelationship, |
|
183 TKeyArrayFix aKey, |
|
184 TInt aStreamUid ); |
|
185 |
|
186 /** |
|
187 * 2nd-phase Constructor |
|
188 * |
|
189 * @param aHasHistory IN: ETrue, if there was synchronization history. |
|
190 */ |
|
191 void ConstructL( TBool& aHasHistory ); |
|
192 |
|
193 private: |
|
194 |
|
195 /** |
|
196 * Allows access to streams. |
|
197 */ |
|
198 MSmlSyncRelationship& iSyncRelationship; |
|
199 |
|
200 /** |
|
201 * New snapshot to compare against. |
|
202 */ |
|
203 CSnapshotArray* iCurrentSnapshot; |
|
204 |
|
205 /** |
|
206 * Current snapshot. |
|
207 */ |
|
208 CSnapshotArray* iOldSnapshot; |
|
209 |
|
210 /** |
|
211 * Key that is used in sorting snapshot. |
|
212 */ |
|
213 TKeyArrayFix iKey; |
|
214 |
|
215 /** |
|
216 * Stream id number to access sync relationship. |
|
217 */ |
|
218 TInt iStreamUid; |
|
219 |
|
220 /** |
|
221 * Data store id number. |
|
222 */ |
|
223 TInt64 iDataStoreUid; |
|
224 }; |
|
225 |
|
226 #endif // __CHANGEFINDER_H__ |