|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedAll |
|
19 @prototype |
|
20 */ |
|
21 |
|
22 #if !defined(__F32FILE64_H__) |
|
23 #define __F32FILE64_H__ |
|
24 |
|
25 |
|
26 /** |
|
27 @publishedAll |
|
28 @prototype |
|
29 |
|
30 Creates and opens a file, and performs all operations on a single open file. |
|
31 |
|
32 This is equivalent to RFile class. |
|
33 This class is meant for accessing files of size greater than or equal to 2GB also. |
|
34 |
|
35 These include: |
|
36 |
|
37 - reading from and writing to the file |
|
38 |
|
39 - seeking to a position within the file |
|
40 |
|
41 - locking and unlocking within the file |
|
42 |
|
43 - setting file attributes |
|
44 |
|
45 Before using any of these services, a connection to a file server session must |
|
46 have been made, and the file must be open. |
|
47 |
|
48 Opening Files: |
|
49 |
|
50 - use Open() to open an existing file for reading or writing; an error is |
|
51 returned if it does not already exist. |
|
52 To open an existing file for reading only, use Open() with an access mode of |
|
53 EFileRead, and a share mode of EFileShareReadersOnly. |
|
54 |
|
55 - use Create() to create and open a new file for writing; an error is returned |
|
56 if it already exists. |
|
57 |
|
58 - use Replace() to open a file for writing, replacing any existing file of |
|
59 the same name if one exists, or creating a new file if one does not exist. |
|
60 Note that if a file exists, its length is reset to zero. |
|
61 |
|
62 - use Temp() to create and open a temporary file with a unique name, |
|
63 for writing and reading. |
|
64 |
|
65 When opening a file, you must specify the file server session to use for |
|
66 operations with that file. If you do not close the file explicitly, it is |
|
67 closed when the server session associated with it is closed. |
|
68 |
|
69 Reading and Writing: |
|
70 |
|
71 There are several variants of both Read() and Write(). |
|
72 The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented |
|
73 by variants allowing the descriptor length to be overridden, or the seek |
|
74 position of the first byte to be specified, or asynchronous completion, |
|
75 or any combination. |
|
76 |
|
77 Reading transfers data from a file to a descriptor, and writing transfers |
|
78 data from a descriptor to a file. In all cases, the file data is treated |
|
79 as binary and byte descriptors are used (TDes8, TDesC8). |
|
80 |
|
81 @see RFile |
|
82 */ |
|
83 class RFile64 : public RFile |
|
84 { |
|
85 public: |
|
86 EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
87 EFSRV_IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
88 EFSRV_IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
89 EFSRV_IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode); |
|
90 |
|
91 EFSRV_IMPORT_C TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsIndex, TInt aFileIndex); |
|
92 EFSRV_IMPORT_C TInt AdoptFromServer(TInt aFsHandle, TInt aFileHandle); |
|
93 EFSRV_IMPORT_C TInt AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex); |
|
94 |
|
95 inline TInt Read(TDes8& aDes) const; |
|
96 inline void Read(TDes8& aDes,TRequestStatus& aStatus) const; |
|
97 inline TInt Read(TDes8& aDes,TInt aLength) const; |
|
98 inline void Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; |
|
99 |
|
100 EFSRV_IMPORT_C TInt Read(TInt64 aPos, TDes8& aDes) const; |
|
101 EFSRV_IMPORT_C void Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const; |
|
102 EFSRV_IMPORT_C TInt Read(TInt64 aPos, TDes8& aDes, TInt aLength) const; |
|
103 EFSRV_IMPORT_C void Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const; |
|
104 |
|
105 inline TInt Write(const TDesC8& aDes); |
|
106 inline void Write(const TDesC8& aDes,TRequestStatus& aStatus); |
|
107 inline TInt Write(const TDesC8& aDes,TInt aLength); |
|
108 inline void Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
109 |
|
110 EFSRV_IMPORT_C TInt Write(TInt64 aPos, const TDesC8& aDes); |
|
111 EFSRV_IMPORT_C void Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus); |
|
112 EFSRV_IMPORT_C TInt Write(TInt64 aPos, const TDesC8& aDes,TInt aLength); |
|
113 EFSRV_IMPORT_C void Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
114 |
|
115 EFSRV_IMPORT_C TInt Seek(TSeek aMode, TInt64& aPos) const; |
|
116 EFSRV_IMPORT_C TInt Size(TInt64& aSize) const; |
|
117 EFSRV_IMPORT_C TInt SetSize(TInt64 aSize); |
|
118 EFSRV_IMPORT_C TInt Lock(TInt64 aPos, TInt64 aLength) const; |
|
119 EFSRV_IMPORT_C TInt UnLock(TInt64 aPos, TInt64 aLength) const; |
|
120 |
|
121 #if defined(_F32_STRICT_64_BIT_MIGRATION) |
|
122 // |
|
123 // If _F32_STRICT_64_BIT_MIGRATION is defined, hide TUint overloads of RFile64::Read |
|
124 // and RFile64::Write APIs to force compiler errors when TUint positions are used. |
|
125 // |
|
126 private: |
|
127 #endif |
|
128 |
|
129 EFSRV_IMPORT_C TInt Read(TUint aPos,TDes8& aDes) const; |
|
130 EFSRV_IMPORT_C void Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const; |
|
131 EFSRV_IMPORT_C TInt Read(TUint aPos,TDes8& aDes,TInt aLength) const; |
|
132 EFSRV_IMPORT_C void Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; |
|
133 |
|
134 EFSRV_IMPORT_C TInt Write(TUint aPos,const TDesC8& aDes); |
|
135 EFSRV_IMPORT_C void Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus); |
|
136 EFSRV_IMPORT_C TInt Write(TUint aPos,const TDesC8& aDes,TInt aLength); |
|
137 EFSRV_IMPORT_C void Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
138 |
|
139 #if defined(_F32_STRICT_64_BIT_MIGRATION) |
|
140 // |
|
141 // If _F32_STRICT_64_BIT_MIGRATION is defined, create private overloads of legacy 32-bit |
|
142 // RFile Read/Write API's to force compiler errors when TInt positions are used. |
|
143 // |
|
144 private: |
|
145 #endif |
|
146 |
|
147 inline TInt Read(TInt aPos,TDes8& aDes) const; |
|
148 inline void Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const; |
|
149 inline TInt Read(TInt aPos,TDes8& aDes,TInt aLength) const; |
|
150 inline void Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; |
|
151 |
|
152 inline TInt Write(TInt aPos,const TDesC8& aDes); |
|
153 inline void Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus); |
|
154 inline TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength); |
|
155 inline void Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
156 |
|
157 private: |
|
158 TInt Seek(TSeek aMode, TInt& aPos) const; // This API is not supported for RFile64 |
|
159 TInt Size(TInt& aSize) const; // This API is not supported for RFile64 |
|
160 friend class RFilePlugin; |
|
161 }; |
|
162 |
|
163 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
164 #include <f32file64.inl> |
|
165 #endif |
|
166 |
|
167 #endif |