| 48 | |
| 49 | |
| 50 | class File |
| 51 | { |
| 52 | private: |
| 53 | FileHandle hFile; |
| 54 | bool LastWrite; |
| 55 | FILE_HANDLETYPE HandleType; |
| 56 | bool SkipClose; |
| 57 | bool IgnoreReadErrors; |
| 58 | bool NewFile; |
| 59 | bool AllowDelete; |
| 60 | bool AllowExceptions; |
| 61 | #ifdef _WIN_ALL |
| 62 | bool NoSequentialRead; |
| 63 | uint CreateMode; |
| 64 | #endif |
| 65 | bool PreserveAtime; |
| 66 | protected: |
| 67 | bool OpenShared; // Set by 'Archive' class. |
| 68 | public: |
| 69 | wchar FileName[NM]; |
| 70 | |
| 71 | FILE_ERRORTYPE ErrorType; |
| 72 | public: |
| 73 | File(); |
| 74 | virtual ~File(); |
| 75 | void operator = (File &SrcFile); |
| 76 | |
| 77 | // Several functions below are 'virtual', because they are redefined |
| 78 | // by Archive for QOpen and by MultiFile for split files in WinRAR. |
| 79 | virtual bool Open(const wchar *Name,uint Mode=FMF_READ); |
| 80 | void TOpen(const wchar *Name); |
| 81 | bool WOpen(const wchar *Name); |
| 82 | bool Create(const wchar *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD); |
| 83 | void TCreate(const wchar *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD); |
| 84 | bool WCreate(const wchar *Name,uint Mode=FMF_UPDATE|FMF_SHAREREAD); |
| 85 | virtual bool Close(); // 'virtual' for MultiFile class. |
| 86 | bool Delete(); |
| 87 | bool Rename(const wchar *NewName); |
| 88 | bool Write(const void *Data,size_t Size); |
| 89 | virtual int Read(void *Data,size_t Size); |
| 90 | int DirectRead(void *Data,size_t Size); |
| 91 | virtual void Seek(int64 Offset,int Method); |
| 92 | bool RawSeek(int64 Offset,int Method); |
| 93 | virtual int64 Tell(); |
| 94 | void Prealloc(int64 Size); |
| 95 | byte GetByte(); |
| 96 | void PutByte(byte Byte); |
| 97 | bool Truncate(); |
| 98 | void Flush(); |
| 99 | void SetOpenFileTime(RarTime *ftm,RarTime *ftc=NULL,RarTime *fta=NULL); |
| 100 | void SetCloseFileTime(RarTime *ftm,RarTime *fta=NULL); |
| 101 | static void SetCloseFileTimeByName(const wchar *Name,RarTime *ftm,RarTime *fta); |
| 102 | void GetOpenFileTime(RarTime *ft); |
| 103 | virtual bool IsOpened() {return hFile!=FILE_BAD_HANDLE;} // 'virtual' for MultiFile class. |
| 104 | int64 FileLength(); |
| 105 | void SetHandleType(FILE_HANDLETYPE Type) {HandleType=Type;} |
| 106 | FILE_HANDLETYPE GetHandleType() {return HandleType;} |
| 107 | bool IsDevice(); |
nothing calls this directly
no outgoing calls
no test coverage detected