|
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: LUID buffering |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __NSMLDSLUIDBUFFER_H__ |
|
20 #define __NSMLDSLUIDBUFFER_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <SmlDataSyncDefs.h> |
|
25 #include "nsmldshostclient.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CNSmlDSHostClient; |
|
29 class CNSmlDSContentItem; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Class for LUID (Local UID) buffering. |
|
35 * |
|
36 * @lib nsmldsagent.lib |
|
37 */ |
|
38 class CNSmlDSLUIDBuffer : public CBase |
|
39 { |
|
40 public: // constructors and destructor |
|
41 /** |
|
42 * C++ constructor. |
|
43 * @param aHostClient Host Client used for communication with the Host Session. |
|
44 * @param aContentItem Sync content whose LUIDs are buffered. |
|
45 */ |
|
46 CNSmlDSLUIDBuffer( CNSmlDSHostClient& aHostClient, CNSmlDSContentItem& aContentItem ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 ~CNSmlDSLUIDBuffer(); |
|
52 |
|
53 public: // new functions |
|
54 /** |
|
55 * Gets the current UID. |
|
56 * @param aLocalUID On return contains the current UID. |
|
57 */ |
|
58 void CurrentUID( TSmlDbItemUid& aLocalUID ) const; |
|
59 |
|
60 /** |
|
61 * Gets the first UID and the command associated to its modification type from buffer. |
|
62 * @param aLocalUID On return contains the next UID. |
|
63 * @param aCmdName On return contains the command associated with the returned UID's |
|
64 * modification type. |
|
65 * @return KErrNone if completed successfully or KErrEof if the buffer is empty |
|
66 */ |
|
67 TInt NextUIDL( TSmlDbItemUid& aLocalUID, TDes8& aCmdName ); |
|
68 |
|
69 /** |
|
70 * Gets the total number of UIDs, both in the buffer and written. |
|
71 * @return TInt representing the number of UIDs in the buffer. |
|
72 */ |
|
73 TInt ClientItemCount() const; |
|
74 |
|
75 /** |
|
76 * Sets the current UID as written and removes it from the buffer. |
|
77 */ |
|
78 void SetCurrentItemWritten(); |
|
79 |
|
80 /** |
|
81 * Gets UIDs of all modified items from datastore to the buffer asynchronously. |
|
82 * @param aResultCode On return contains the result code of the operation. |
|
83 */ |
|
84 void FetchModificationsL( TInt& aResultCode ); |
|
85 |
|
86 private: // constructors & operators |
|
87 /** |
|
88 * Prohibit copy constructor. |
|
89 */ |
|
90 CNSmlDSLUIDBuffer( const CNSmlDSLUIDBuffer& aOther ); |
|
91 |
|
92 /** |
|
93 * Prohibit assignment operator. |
|
94 */ |
|
95 CNSmlDSLUIDBuffer& operator=( const CNSmlDSLUIDBuffer& aOther ); |
|
96 |
|
97 private: // data |
|
98 // internal states |
|
99 enum TState |
|
100 { |
|
101 EModifications = 1, |
|
102 EEnd |
|
103 }; |
|
104 // current state |
|
105 TState iCurrState; |
|
106 // array of buffered modification items |
|
107 RNSmlDbItemModificationSet iModificationSet; |
|
108 // reference to the ds hostclient |
|
109 CNSmlDSHostClient& iHostClient; |
|
110 // reference to the current content (datastore) data |
|
111 CNSmlDSContentItem& iContentItem; |
|
112 // the number of written items |
|
113 TInt iWrittenItems; |
|
114 }; |
|
115 |
|
116 #endif // __NSMLDSLUIDBUFFER_H__ |
|
117 |
|
118 // End of File |