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