sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @publishedAll sl@0: @prototype sl@0: */ sl@0: sl@0: #if !defined(__F32FILE64_H__) sl@0: #define __F32FILE64_H__ sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @prototype sl@0: sl@0: Creates and opens a file, and performs all operations on a single open file. sl@0: sl@0: This is equivalent to RFile class. sl@0: This class is meant for accessing files of size greater than or equal to 2GB also. sl@0: sl@0: These include: sl@0: sl@0: - reading from and writing to the file sl@0: sl@0: - seeking to a position within the file sl@0: sl@0: - locking and unlocking within the file sl@0: sl@0: - setting file attributes sl@0: sl@0: Before using any of these services, a connection to a file server session must sl@0: have been made, and the file must be open. sl@0: sl@0: Opening Files: sl@0: sl@0: - use Open() to open an existing file for reading or writing; an error is sl@0: returned if it does not already exist. sl@0: To open an existing file for reading only, use Open() with an access mode of sl@0: EFileRead, and a share mode of EFileShareReadersOnly. sl@0: sl@0: - use Create() to create and open a new file for writing; an error is returned sl@0: if it already exists. sl@0: sl@0: - use Replace() to open a file for writing, replacing any existing file of sl@0: the same name if one exists, or creating a new file if one does not exist. sl@0: Note that if a file exists, its length is reset to zero. sl@0: sl@0: - use Temp() to create and open a temporary file with a unique name, sl@0: for writing and reading. sl@0: sl@0: When opening a file, you must specify the file server session to use for sl@0: operations with that file. If you do not close the file explicitly, it is sl@0: closed when the server session associated with it is closed. sl@0: sl@0: Reading and Writing: sl@0: sl@0: There are several variants of both Read() and Write(). sl@0: The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented sl@0: by variants allowing the descriptor length to be overridden, or the seek sl@0: position of the first byte to be specified, or asynchronous completion, sl@0: or any combination. sl@0: sl@0: Reading transfers data from a file to a descriptor, and writing transfers sl@0: data from a descriptor to a file. In all cases, the file data is treated sl@0: as binary and byte descriptors are used (TDes8, TDesC8). sl@0: sl@0: @see RFile sl@0: */ sl@0: class RFile64 : public RFile sl@0: { sl@0: public: sl@0: EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode); sl@0: EFSRV_IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode); sl@0: EFSRV_IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode); sl@0: EFSRV_IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode); sl@0: sl@0: EFSRV_IMPORT_C TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsIndex, TInt aFileIndex); sl@0: EFSRV_IMPORT_C TInt AdoptFromServer(TInt aFsHandle, TInt aFileHandle); sl@0: EFSRV_IMPORT_C TInt AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex); sl@0: sl@0: inline TInt Read(TDes8& aDes) const; sl@0: inline void Read(TDes8& aDes,TRequestStatus& aStatus) const; sl@0: inline TInt Read(TDes8& aDes,TInt aLength) const; sl@0: inline void Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; sl@0: sl@0: EFSRV_IMPORT_C TInt Read(TInt64 aPos, TDes8& aDes) const; sl@0: EFSRV_IMPORT_C void Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const; sl@0: EFSRV_IMPORT_C TInt Read(TInt64 aPos, TDes8& aDes, TInt aLength) const; sl@0: EFSRV_IMPORT_C void Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const; sl@0: sl@0: inline TInt Write(const TDesC8& aDes); sl@0: inline void Write(const TDesC8& aDes,TRequestStatus& aStatus); sl@0: inline TInt Write(const TDesC8& aDes,TInt aLength); sl@0: inline void Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); sl@0: sl@0: EFSRV_IMPORT_C TInt Write(TInt64 aPos, const TDesC8& aDes); sl@0: EFSRV_IMPORT_C void Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus); sl@0: EFSRV_IMPORT_C TInt Write(TInt64 aPos, const TDesC8& aDes,TInt aLength); sl@0: EFSRV_IMPORT_C void Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); sl@0: sl@0: EFSRV_IMPORT_C TInt Seek(TSeek aMode, TInt64& aPos) const; sl@0: EFSRV_IMPORT_C TInt Size(TInt64& aSize) const; sl@0: EFSRV_IMPORT_C TInt SetSize(TInt64 aSize); sl@0: EFSRV_IMPORT_C TInt Lock(TInt64 aPos, TInt64 aLength) const; sl@0: EFSRV_IMPORT_C TInt UnLock(TInt64 aPos, TInt64 aLength) const; sl@0: sl@0: #if defined(_F32_STRICT_64_BIT_MIGRATION) sl@0: // sl@0: // If _F32_STRICT_64_BIT_MIGRATION is defined, hide TUint overloads of RFile64::Read sl@0: // and RFile64::Write APIs to force compiler errors when TUint positions are used. sl@0: // sl@0: private: sl@0: #endif sl@0: sl@0: EFSRV_IMPORT_C TInt Read(TUint aPos,TDes8& aDes) const; sl@0: EFSRV_IMPORT_C void Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const; sl@0: EFSRV_IMPORT_C TInt Read(TUint aPos,TDes8& aDes,TInt aLength) const; sl@0: EFSRV_IMPORT_C void Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; sl@0: sl@0: EFSRV_IMPORT_C TInt Write(TUint aPos,const TDesC8& aDes); sl@0: EFSRV_IMPORT_C void Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus); sl@0: EFSRV_IMPORT_C TInt Write(TUint aPos,const TDesC8& aDes,TInt aLength); sl@0: EFSRV_IMPORT_C void Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); sl@0: sl@0: #if defined(_F32_STRICT_64_BIT_MIGRATION) sl@0: // sl@0: // If _F32_STRICT_64_BIT_MIGRATION is defined, create private overloads of legacy 32-bit sl@0: // RFile Read/Write API's to force compiler errors when TInt positions are used. sl@0: // sl@0: private: sl@0: #endif sl@0: sl@0: inline TInt Read(TInt aPos,TDes8& aDes) const; sl@0: inline void Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const; sl@0: inline TInt Read(TInt aPos,TDes8& aDes,TInt aLength) const; sl@0: inline void Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; sl@0: sl@0: inline TInt Write(TInt aPos,const TDesC8& aDes); sl@0: inline void Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus); sl@0: inline TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength); sl@0: inline void Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); sl@0: sl@0: private: sl@0: TInt Seek(TSeek aMode, TInt& aPos) const; // This API is not supported for RFile64 sl@0: TInt Size(TInt& aSize) const; // This API is not supported for RFile64 sl@0: friend class RFilePlugin; sl@0: }; sl@0: sl@0: #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API sl@0: #include sl@0: #endif sl@0: sl@0: #endif