|
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_NCDFILESTORAGE_H |
|
20 #define M_NCDFILESTORAGE_H |
|
21 |
|
22 class RFs; |
|
23 |
|
24 /** |
|
25 * File storage interface |
|
26 * |
|
27 * ?more_complete_description |
|
28 */ |
|
29 class MNcdFileStorage |
|
30 { |
|
31 public: |
|
32 |
|
33 /** |
|
34 * Adds a file to the file storage |
|
35 * |
|
36 * @param aFilepath Path to the file |
|
37 * @param aOverwrite If true, an already existing file is overwritten. |
|
38 * If false, leaves with KErrAlreadyExists |
|
39 * @throw KErrAlreadyExists if the file was already in the storage and |
|
40 * overwrite-flag was false |
|
41 * @throw KErrBadName if the given filepath was invalid |
|
42 * @note Moves the file to the storage dir |
|
43 */ |
|
44 virtual void AddFileL( const TDesC& aFilepath, |
|
45 TBool aOverwrite = EFalse ) = 0; |
|
46 |
|
47 /** |
|
48 * Removes the file from the storage |
|
49 * |
|
50 * @param aFilename Filename (without any path information) |
|
51 * @throw KErrNotFound if the file doesn't exist in the storage |
|
52 * @throw KErrBadName if the given filename was empty |
|
53 */ |
|
54 virtual void RemoveFileL( const TDesC& aFilename ) = 0; |
|
55 |
|
56 |
|
57 /** |
|
58 * Opens the file from the storage with the given file server session |
|
59 * |
|
60 * @param aFilename Filename |
|
61 * @param aFileMode File mode. See TFileMode in S60 documentation |
|
62 * @return A handle to the opened file |
|
63 * @throw KErrNotFound if the file doesn't exist in the storage |
|
64 * @throw KErrBadName if the filename was empty |
|
65 * @throw Error code returned by RFile::Open() |
|
66 * @note This should be used if the file is supposed to be shared |
|
67 * with the client. |
|
68 */ |
|
69 virtual RFile OpenFileL( RFs& aFs, const TDesC& aFilename, |
|
70 TUint aFileMode ) = 0; |
|
71 |
|
72 |
|
73 /** |
|
74 * Storage UID getter |
|
75 * |
|
76 * @return Storage UID |
|
77 */ |
|
78 virtual const TDesC& Uid() const = 0; |
|
79 |
|
80 protected: |
|
81 |
|
82 virtual ~MNcdFileStorage() |
|
83 { |
|
84 } |
|
85 }; |
|
86 |
|
87 |
|
88 #endif // M_NCDFILESTORAGE_H |