|
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 C_NCDSTORAGEFILEDATAITEM_H |
|
20 #define C_NCDSTORAGEFILEDATAITEM_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "ncdstoragedataitem.h" |
|
25 |
|
26 class RFile; |
|
27 class RFs; |
|
28 |
|
29 /** |
|
30 * Externalizes the given file to the database storage |
|
31 * @ Consider adding an observer for errors |
|
32 */ |
|
33 class CNcdStorageFileDataItem : public CBase, public MNcdStorageDataItem |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Creates a new file data item |
|
39 * |
|
40 * @param aFilename Path to the file that is written to the database |
|
41 * during ExternalizeL() |
|
42 * @return A new file data item |
|
43 * @throw KErrArgument If the filename is empty |
|
44 */ |
|
45 static CNcdStorageFileDataItem* NewL( const TDesC& aFilename, RFs& aFs ); |
|
46 |
|
47 |
|
48 /** |
|
49 * Creates a new file data item |
|
50 * |
|
51 * @param aFilename Path to the file that is written to the database |
|
52 * during ExternalizeL() |
|
53 * @return A new file data item |
|
54 * @throw KErrArgument If the filename is empty |
|
55 */ |
|
56 static CNcdStorageFileDataItem* NewLC( const TDesC& aFilename, RFs& aFs ); |
|
57 |
|
58 |
|
59 |
|
60 virtual ~CNcdStorageFileDataItem(); |
|
61 |
|
62 |
|
63 public: // from MNcdStorageDataItem |
|
64 |
|
65 /** |
|
66 * Externalizes the file to the database |
|
67 * |
|
68 * @param aStream Write stream |
|
69 */ |
|
70 void ExternalizeL( RWriteStream& aStream ); |
|
71 |
|
72 |
|
73 /** |
|
74 * Not supported. Use MNcdStorageItem::GetDataL() instead |
|
75 * |
|
76 * @throw KErrNotSupported |
|
77 */ |
|
78 void InternalizeL( RReadStream& aStream ); |
|
79 |
|
80 |
|
81 private: |
|
82 |
|
83 CNcdStorageFileDataItem( RFs& aFs ); |
|
84 |
|
85 void ConstructL( const TDesC& aFilename ); |
|
86 |
|
87 |
|
88 private: // data |
|
89 |
|
90 RFs& iFs; |
|
91 RBuf iFilename; |
|
92 |
|
93 }; |
|
94 |
|
95 |
|
96 #endif // C_NCDSTORAGEFILEDATAITEM_H |