|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_NCDSTORAGEITEM_H |
|
20 #define M_NCDSTORAGEITEM_H |
|
21 |
|
22 |
|
23 class MNcdStorageDataItem; |
|
24 |
|
25 /** |
|
26 * Database storage item interface |
|
27 * |
|
28 * Used to operate on items in the database |
|
29 */ |
|
30 class MNcdStorageItem |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * Opens the item for reading/writing. |
|
36 * Must be saved or rollbacked |
|
37 */ |
|
38 virtual void OpenL() = 0; |
|
39 |
|
40 /** |
|
41 * Marks the item as saved but doesn't commit it to storage until all |
|
42 * opened items are saved |
|
43 */ |
|
44 virtual void SaveL() = 0; |
|
45 |
|
46 /** |
|
47 * Rollbacks modifications to this item and all other open or saved but |
|
48 * not committed items in the database |
|
49 */ |
|
50 virtual void Rollback() = 0; |
|
51 |
|
52 /** |
|
53 * Internalizes data from the database to the data item set for this item. |
|
54 */ |
|
55 virtual void ReadDataL() = 0; |
|
56 |
|
57 |
|
58 /** |
|
59 * Externalizes data from the data item to the database |
|
60 */ |
|
61 virtual void WriteDataL() = 0; |
|
62 |
|
63 /** |
|
64 * Removes the item from the database |
|
65 */ |
|
66 virtual void RemoveFromStorageL() = 0; |
|
67 |
|
68 /** |
|
69 * Reads the data from the database and returns it in a descriptor. |
|
70 * |
|
71 * @return Item's data in a 8-bit descriptor. The descriptor is added |
|
72 * to the cleanupstack |
|
73 */ |
|
74 virtual HBufC8* GetDataLC() = 0; |
|
75 |
|
76 |
|
77 /** |
|
78 * Open-state getter |
|
79 * |
|
80 * @return ETrue if the item is open, otherwise EFalse |
|
81 */ |
|
82 virtual TBool IsOpen() const = 0; |
|
83 |
|
84 |
|
85 /** |
|
86 * Item UID getter |
|
87 * |
|
88 * @return Item's UID |
|
89 */ |
|
90 virtual const TDesC& Uid() const = 0; |
|
91 |
|
92 |
|
93 /** |
|
94 * Item type getter |
|
95 * |
|
96 * @return Item's type |
|
97 */ |
|
98 virtual TInt Type() const = 0; |
|
99 |
|
100 |
|
101 /** |
|
102 * Sets data item for this item. |
|
103 * |
|
104 * ReadDataL() and WriteDataL() internalize and externalize data from |
|
105 * this data item to/from the database |
|
106 */ |
|
107 virtual void SetDataItem( MNcdStorageDataItem* aDataItem ) = 0; |
|
108 |
|
109 protected: |
|
110 |
|
111 virtual ~MNcdStorageItem() |
|
112 { |
|
113 } |
|
114 }; |
|
115 |
|
116 |
|
117 |
|
118 #endif |