|
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: DS notepad datastore. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __NSMLNOTEPADMODSFETCHER_H__ |
|
20 #define __NSMLNOTEPADMODSFETCHER_H__ |
|
21 |
|
22 |
|
23 //Forward declaraations |
|
24 class CNSmlChangeFinder; |
|
25 class CNSmlNotepadDatabase; |
|
26 class TNSmlSnapshotItem; |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KNSmlSnapshotSize = 56; |
|
30 const TInt KNSmlSnapshotSmallSize = 8; |
|
31 const TInt KNSmlSnapshotItemCount = 20; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 // ------------------------------------------------------------------------------------------------ |
|
36 // CNSmlnotepadModsFetcher |
|
37 // |
|
38 // @lib nsmlnotepaddataprovider.lib |
|
39 // ------------------------------------------------------------------------------------------------ |
|
40 class CNSmlNotepadModsFetcher : public CActive |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * two phase constructor |
|
45 * @param aSnapshotRegistered Is snapshot registered. |
|
46 * @param aCntDb Pointer to opened database. |
|
47 * @param aKey Key array. |
|
48 * @param aChangeFinder Pointer to Changefinder. |
|
49 */ |
|
50 static CNSmlNotepadModsFetcher* NewL(TBool& aSnapshotRegistered, |
|
51 CNSmlNotepadDatabase* aNpdDb, |
|
52 TKeyArrayFix& aKey, |
|
53 CNSmlChangeFinder& aChangeFinder ); |
|
54 /** |
|
55 * two phase constructor |
|
56 * @param aSnapshotRegistered Is snapshot registered. |
|
57 * @param aCntDb Pointer to opened database. |
|
58 * @param aKey Key array. |
|
59 * @param aChangeFinder Pointer to Changefinder. |
|
60 */ |
|
61 static CNSmlNotepadModsFetcher* NewLC(TBool& aSnapshotRegistered, |
|
62 CNSmlNotepadDatabase* aNpdDb, |
|
63 TKeyArrayFix& aKey, |
|
64 CNSmlChangeFinder& aChangeFinder ); |
|
65 /** |
|
66 * C++ constructor. |
|
67 * @param aSnapshotRegistered Is snapshot registered. |
|
68 * @param aCntDb Pointer to opened database. |
|
69 * @param aKey Key array. |
|
70 * @param aChangeFinder Pointer to Changefinder. |
|
71 */ |
|
72 |
|
73 /** |
|
74 * ~CCNSmlNotepadModsFetcher() desctructor. |
|
75 */ |
|
76 virtual ~CNSmlNotepadModsFetcher(); |
|
77 |
|
78 private: |
|
79 CNSmlNotepadModsFetcher( TBool& aSnapshotRegistered, |
|
80 CNSmlNotepadDatabase* aNpdDb, |
|
81 TKeyArrayFix& aKey, |
|
82 CNSmlChangeFinder& aChangeFinder ); |
|
83 /** |
|
84 * Second phase constructor. |
|
85 */ |
|
86 void ConstructL(); |
|
87 |
|
88 |
|
89 public: |
|
90 /** |
|
91 * Reads all modifications from clients notepad databse. |
|
92 * @param aStatus On completion of the operation, contains the result code. |
|
93 */ |
|
94 TInt FetchModificationsL( TRequestStatus& aStatus ); |
|
95 |
|
96 /** |
|
97 * Reset the flag to avoid duplication of snapshotitem. |
|
98 */ |
|
99 void Reset(); |
|
100 |
|
101 private: |
|
102 /** |
|
103 * Fetches next chunk of data (client notepad data changes). |
|
104 */ |
|
105 void FetchNextChunkL(); |
|
106 |
|
107 /** |
|
108 * From CActive. Called when asynchronous operation completes. |
|
109 */ |
|
110 void RunL(); |
|
111 |
|
112 /** |
|
113 * From CActive. Cancels operation. |
|
114 */ |
|
115 void DoCancel(); |
|
116 |
|
117 private: // data |
|
118 TRequestStatus* iCallerStatus; |
|
119 TBool iBeginning; |
|
120 TBool iEnd; |
|
121 CArrayFixSeg<TNSmlSnapshotItem>* iSnapshot; |
|
122 TBool& iSnapshotRegistered; |
|
123 CNSmlNotepadDatabase* iNpdDb; |
|
124 TKeyArrayFix& iKey; |
|
125 CNSmlChangeFinder& iChangeFinder; |
|
126 TInt iCurrentSnapshotCounter; |
|
127 }; |
|
128 |
|
129 #endif // __NSMLNOTEPADMODSFETCHER_H__ |
|
130 |
|
131 // End of File |