56 bool fileFindContinue;
71 FILE *GetFileStream(
void);
72 CXFile *GetCFile(
void) {
return pCurrentFile; }
79 CXString GetFileName(
void) {
return filename; }
84 void CloseFile(
bool abort =
false);
85 void CloseAndDeleteFile(
bool abort =
false);
90 CXFileFind *GetFileFinder() {
return fileFinder; }
92 inline bool IsWriting()
const
94 return !(flags & IOFILE_IS_READING);
97 inline bool IsBinaryMode()
const
102 unsigned int FileBufferRead(
void *ptr,
unsigned int sz)
104 sz = pCurrentFile->Read(ptr,
sz);
106 if ((flags & IOFILE_ALLOW_EXCEPTIONS) &&
sz == 0)
107 XThrowExceptionWithArgs(CXFileException, CXFileException::endOfFile, filename);
112 bool FileRead(
void *ptr,
unsigned int sz)
114 if (pCurrentFile->Read(ptr,
sz) ==
sz)
117 if (flags & IOFILE_ALLOW_EXCEPTIONS)
118 XThrowExceptionWithArgs(CXFileException, CXFileException::endOfFile, filename);
123 void WriteFloat(
float value)
125 pCurrentFile->Write(&value,
sizeof(
float));
128 void WriteInt(
int value)
130 pCurrentFile->Write(&value,
sizeof(
int));
143 void WriteUInt(
unsigned int value)
145 pCurrentFile->Write(&value,
sizeof(
unsigned int));
148 void WriteShort(
short value)
150 pCurrentFile->Write(&value,
sizeof(
short));
153 void WriteUShort(
unsigned short value)
155 pCurrentFile->Write(&value,
sizeof(
unsigned short));
158 void WriteChar(
char value)
160 pCurrentFile->Write(&value,
sizeof(
char));
163 void WriteUChar(
unsigned char value)
165 pCurrentFile->Write(&value,
sizeof(
unsigned char));
168 void FileWrite(
const void *ptr,
unsigned int sz)
170 pCurrentFile->Write(ptr,
sz);
173 void FileReverseWrite(
void *ptr,
unsigned int sz)
175 unsigned char *
buf = xAllocateArray(
unsigned char,
sz);
178 ReverseBuffer(
buf,
sz);
180 pCurrentFile->Write(
buf,
sz);
182 xDeallocateArray(
buf);
196 xDeallocateArray(
buf);
204 pCurrentFile->Flush();
207 bool FileSeek(
longint offset, CXFile::SeekPosition type)
210 pCurrentFile->Seek(offset, type);
219 return pCurrentFile->GetPosition();
225 return pCurrentFile->GetLength();
228 bool FileReverseRead(
void *ptr,
unsigned int sz)
230 if (pCurrentFile->Read(ptr,
sz) !=
sz)
232 if (flags & IOFILE_ALLOW_EXCEPTIONS)
233 XThrowExceptionWithArgs(CXFileException, CXFileException::endOfFile, filename);
238 ReverseBuffer(ptr,
sz);
247 if (flags & IOFILE_ALLOW_EXCEPTIONS)
248 XThrowExceptionWithArgs(CXFileException, CXFileException::endOfFile, filename);
261 XASSERT(!(flags & IOFILE_MEMORY_FILE));
265 if (flags & IOFILE_ALLOW_EXCEPTIONS)
266 XThrowExceptionWithArgs(CXFileException, CXFileException::endOfFile, filename);
271 void WriteString(
LPCTSTR wString)
273 XASSERT(!(flags & IOFILE_MEMORY_FILE));