Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #if !defined(__F32FILE64_H__)
23 #define __F32FILE64_H__
30 Creates and opens a file, and performs all operations on a single open file.
32 This is equivalent to RFile class.
33 This class is meant for accessing files of size greater than or equal to 2GB also.
37 - reading from and writing to the file
39 - seeking to a position within the file
41 - locking and unlocking within the file
43 - setting file attributes
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.
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.
55 - use Create() to create and open a new file for writing; an error is returned
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.
62 - use Temp() to create and open a temporary file with a unique name,
63 for writing and reading.
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.
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,
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).
83 class RFile64 : public RFile
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);
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);
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;
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;
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);
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);
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;
121 #if defined(_F32_STRICT_64_BIT_MIGRATION)
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.
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;
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);
139 #if defined(_F32_STRICT_64_BIT_MIGRATION)
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.
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;
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);
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;
163 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
164 #include <f32file64.inl>