1 favouritesfile.h |
1 /* |
|
2 * Copyright (c) 2004 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 the License "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: Declaration of FavouritesFile |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef FAVOURITES_FILE_H |
|
20 #define FAVOURITES_FILE_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <FavouritesHandle.h> |
|
25 |
|
26 // FORWARD DECLARATION |
|
27 |
|
28 class RFavouritesDb; |
|
29 class CFavouritesFileImpl; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * RFavouritesFile is a class derived from RFavouritesHandle. |
|
35 * Each favourites item or folder can have an associated file |
|
36 * with arbitrary content. |
|
37 */ |
|
38 class RFavouritesFile: public RFavouritesHandle |
|
39 { |
|
40 |
|
41 public: // Constructor and destructor |
|
42 |
|
43 /** |
|
44 * Constructor. |
|
45 * @since 0.9 |
|
46 */ |
|
47 inline RFavouritesFile(); |
|
48 |
|
49 /** |
|
50 * Close this object. |
|
51 * @since 0.9 |
|
52 * @return void |
|
53 */ |
|
54 IMPORT_C void Close(); |
|
55 |
|
56 /** |
|
57 * Open existing file with shared read-access. |
|
58 * @since 0.9 |
|
59 * @param aDb Database handle. |
|
60 * @param aUid Uid of item. |
|
61 * @return Error code. |
|
62 */ |
|
63 IMPORT_C TInt Open( RFavouritesDb& aDb, TInt aUid ); |
|
64 |
|
65 /** |
|
66 * Create new file / replace existing with exclusive write-access. |
|
67 * Existing content of the file, if any, is lost. |
|
68 * @since 0.9 |
|
69 * @param aDb Database handle. |
|
70 * @param aUid Uid of item. |
|
71 * @return Error code. |
|
72 */ |
|
73 IMPORT_C TInt Replace( RFavouritesDb& aDb, TInt aUid ); |
|
74 |
|
75 public: // new methods |
|
76 |
|
77 /** |
|
78 * Read from file. |
|
79 * @since 0.9 |
|
80 * @param aDes Descriptor into which binary data is read. Any existing |
|
81 * contents are overwritten. On return, its length is set to the number |
|
82 * of bytes read. |
|
83 * @return Error code. |
|
84 */ |
|
85 IMPORT_C TInt Read( TDes8& aDes ) const; |
|
86 |
|
87 /** |
|
88 * Writes to file. |
|
89 * @since 0.9 |
|
90 * @param aDes Descriptor from which binary data is written. |
|
91 * @return Error code. |
|
92 */ |
|
93 IMPORT_C TInt Write( const TDesC8& aDes ); |
|
94 |
|
95 /** |
|
96 * Get the size of the file. |
|
97 * @since 0.9 |
|
98 * @param aSize Gives back the size of the file. |
|
99 * @return Error code. |
|
100 */ |
|
101 IMPORT_C TInt Size(TInt &aSize) const; |
|
102 |
|
103 private: // new methods |
|
104 |
|
105 /** |
|
106 * Implementation of Open functions. |
|
107 * @since 0.9 |
|
108 * @param aDb Database handle. |
|
109 * @param aUid Uid of item. |
|
110 * @param aFunction Function. |
|
111 * @return Error code. |
|
112 */ |
|
113 TInt DoOpen( RFavouritesDb& aDb, TInt aUid, TInt aFunction ); |
|
114 |
|
115 private: // data |
|
116 |
|
117 CFavouritesFileImpl* iImpl; ///< Implementation. Owned. |
|
118 |
|
119 }; |
|
120 |
|
121 #include <FavouritesFile.inl> |
|
122 |
|
123 #endif |
|
124 |
|
125 // End of File |