36 #if !defined(_FPDFAPI_MINI_) || (defined(_WIN32) && !defined(_FX_NO_WINDOWS_)) || _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || _FX_OS_ == _FX_ANDROID_ || _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 95 #if _FX_OS_ != _FX_EMBEDDED_ 132 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_ 133 #if defined(_FX_LARGEFILE_SUPPORT_) 135 #define _FX_LARGEFILE_USED_ 138 #define FX_FILESIZE FX_INT64 139 #define FX_GETBYTEOFFSET32(a) ((FX_BYTE)((a>>16)>>16)) 140 #define FX_GETBYTEOFFSET40(a) ((FX_BYTE)(((a>>16)>>16)>>8)) 141 #define FX_GETBYTEOFFSET48(a) ((FX_BYTE)(((a>>16)>>16)>>16)) 142 #define FX_GETBYTEOFFSET56(a) ((FX_BYTE)((((a>>16)>>16)>>16)>>8)) 145 #define FX_FILESIZE FX_INT32 146 #define FX_GETBYTEOFFSET32(a) 0 147 #define FX_GETBYTEOFFSET40(a) 0 148 #define FX_GETBYTEOFFSET48(a) 0 149 #define FX_GETBYTEOFFSET56(a) 0 151 #elif _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ 152 #if defined(_FX_LARGEFILE_SUPPORT_) 154 #define _FX_LARGEFILE_USED_ 156 #ifndef _LARGEFILE_SOURCE 157 #define _LARGEFILE_SOURCE 159 #ifndef _LARGEFILE64_SOURCE 160 #define _LARGEFILE64_SOURCE 163 #if defined(_FX_LARGEFILE_SUPPORT_) 164 #define FX_GETBYTEOFFSET32(a) ((FX_BYTE)((a>>16)>>16)) 165 #define FX_GETBYTEOFFSET40(a) ((FX_BYTE)(((a>>16)>>16)>>8)) 166 #define FX_GETBYTEOFFSET48(a) ((FX_BYTE)(((a>>16)>>16)>>16)) 167 #define FX_GETBYTEOFFSET56(a) ((FX_BYTE)((((a>>16)>>16)>>16)>>8)) 169 #define FX_GETBYTEOFFSET32(a) 0 170 #define FX_GETBYTEOFFSET40(a) 0 171 #define FX_GETBYTEOFFSET48(a) 0 172 #define FX_GETBYTEOFFSET56(a) 0 176 #include <sys/stat.h> 182 #define O_LARGEFILE 0 186 #if defined(_FX_LARGEFILE_SUPPORT_) 187 #if _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_ANDROID_ 190 #ifndef _CHROME_PNACL_ 191 #define _FX_USE_OFF64_T_ 195 #if defined(_FX_USE_OFF64_T_) 196 #define FX_FILESIZE off64_t 198 #ifndef _CHROME_PNACL_ 199 #define FX_FILESIZE off_t 201 #define FX_FILESIZE FX_INT32 204 #else //do not support large file. 206 #define FX_FILESIZE FX_INT32 207 #define FX_GETBYTEOFFSET32(a) 0 208 #define FX_GETBYTEOFFSET40(a) 0 209 #define FX_GETBYTEOFFSET48(a) 0 210 #define FX_GETBYTEOFFSET56(a) 0 214 #define FX_GETBYTEOFFSET24(a) ((FX_BYTE)(a>>24)) 215 #define FX_GETBYTEOFFSET16(a) ((FX_BYTE)(a>>16)) 216 #define FX_GETBYTEOFFSET8(a) ((FX_BYTE)(a>>8)) 217 #define FX_GETBYTEOFFSET0(a) ((FX_BYTE)(a)) 224 #define FX_FILEMODE_Write 0 226 #define FX_FILEMODE_ReadOnly 1 228 #define FX_FILEMODE_Truncate 2 // 298 size_t FX_File_Read(FX_HFILE hFile,
void* pBuffer,
size_t szBuffer);
319 size_t FX_File_Write(FX_HFILE hFile,
const void* pBuffer,
size_t szBuffer);
548 virtual size_t ReadBlock(
void* buffer,
size_t size) = 0;
616 virtual size_t ReadBlock(
void* buffer,
size_t size) {
return 0;}
703 virtual size_t ReadBlock(
void* buffer,
size_t size) = 0;
814 class IFX_FileCollection
817 virtual void Release() = 0;
823 virtual ~IFX_FileCollection() {}
855 virtual void EstimateSize(
size_t nInitSize,
size_t nGrowSize) = 0;
957 virtual size_t ReadBlock(
void* buffer,
size_t size) = 0;
995 #define FX_FILECACHE_CHUNKSIZE 32768 996 #define FX_FILECACHE_CHUNKCOUNT 64 1073 virtual size_t ReadBlock(
void* buffer,
size_t size);
1076 FXMT_LOCKOBJECT_DEFINE(m_LockObj);
1092 #endif // _FX_STREAM_H_ virtual void GetPath(CFX_WideString &wsPath)=0
Get current path string.
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)=0
Read a data block from the file.
IFX_MemoryStream * FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver=0, IFX_Allocator *pAllocator=0)
Creates a stream object by a given memory buffer. This function creates a consecutive memory stream o...
virtual FX_INT64 GetSize()
Get total size of the file.
void * FX_LPVOID
Pointer to any type.
Definition: fx_system.h:633
Memory stream interface.
Definition: fx_stream.h:831
virtual size_t ReadBlock(void *buffer, size_t size)
Read data block from stream.
Definition: fx_stream.h:616
wchar_t FX_WCHAR
Compiler dependant Unicode character (16-bit for Microsoft Compiler, 32-bit for gcc).
Definition: fx_system.h:708
virtual void Release()=0
Called when to release everything.
IFX_FileAccess * FX_CreateDefaultFileAccess(FX_WSTR wsPath, IFX_Allocator *pAllocator=0)
Create a CRT based file I/O interface.
File writing interface.
Definition: fx_stream.h:449
unsigned long FX_DWORD
32-bit unsigned integer.
Definition: fx_system.h:698
FX_BOOL AttachFile(IFX_FileRead *pFile, FX_BOOL bTakeOver)
Attach a file read.
virtual void Release()=0
Destroy the current instance.
CONSTANT WIDE STRING CLASS.
Definition: fx_string.h:1216
virtual FX_BOOL WriteBlock(const void *pData, FX_INT64 offset, size_t size)=0
Write a block data.
virtual FX_BOOL SetRange(FX_INT64 offset, FX_INT64 size)
Set accessing range.
Definition: fx_stream.h:591
FX_BOOL FX_File_Exist(FX_BSTR fileName)
Determine whether a file exists or not.
void FX_File_Close(FX_HFILE hFile, IFX_Allocator *pAllocator=0)
Close file.
FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
Copy file.
virtual void Release()=0
Destroy the current instance.
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
virtual FX_LPBYTE GetBuffer() const =0
Get the current memory buffer.
void FX_CloseFolder(void *handle)
Close folder handle.
virtual FX_LPCBYTE GetBlockBuffer()=0
Get internal buffer of block data.
FX_WCHAR FX_GetFolderSeparator()
Get folder separator for the system. Most likely it's either /' or '\'.
virtual size_t ReadBlock(void *buffer, size_t size)=0
Read data block from sequential stream.
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
virtual FX_INT64 GetPosition()
Get the current reading position in stream.
Definition: fx_stream.h:582
wchar_t const * FX_LPCWSTR
Pointer to constant Unicode characters.
Definition: fx_system.h:712
virtual void Release()=0
Called when to release everything.
size_t FX_File_WritePos(FX_HFILE hFile, const void *pBuffer, size_t szBuffer, FX_INT64 pos)
Write data at specified position.
FX_BOOL FX_GetNextFile(void *handle, CFX_ByteString &filename, FX_BOOL &bFolder, FX_LPCSTR absPath=0)
Read next entry in the folder.
FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode, IFX_Allocator *pAllocator=0)
Open file with specified accessing mode.
FX_BOOL Init(FX_INT32 nChunkSize, FX_INT32 nChunkCount, FX_LPVOID pBuffer, IFX_Allocator *pAllocator=0)
Initialize the chunk size and chunk count.
Cached file read interface.
Definition: fx_stream.h:999
virtual void Release()=0
Called when to release everything.
virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver=0)=0
Attach a memory buffer.
File reading interface.
Definition: fx_stream.h:555
WIDE STRING CLASS.
Definition: fx_string.h:1463
Stream writing interface.
Definition: fx_stream.h:422
void * FX_POSITION
A value used to denote the position of an element in a collection.
Definition: fx_system.h:637
size_t FX_File_Read(FX_HFILE hFile, void *pBuffer, size_t szBuffer)
Read data from the current file accessing position.
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
virtual FX_INT64 GetPosition()
Get the current reading position in stream.
virtual FX_BOOL WriteBlock(const void *buffer, size_t size)
Write a block data to the end of current stream.
Definition: fx_stream.h:723
Stream reading interface.
Definition: fx_stream.h:518
virtual FX_BOOL IsEOF()
Determine whether reach the end of stream.
Definition: fx_stream.h:576
size_t FX_File_Write(FX_HFILE hFile, const void *pBuffer, size_t szBuffer)
Write data from the current file accessing position.
virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart=0)=0
Read the next block in sequential stream.
virtual FX_BOOL Flush()=0
Flush internal buffer of the file.
IFX_BufferRead stream provides an optimized approach to read stream data. Usually,...
Definition: fx_stream.h:926
int FX_INT32
32-bit signed integer.
Definition: fx_system.h:662
IFX_FileWrite * FX_CreateFileWrite(FX_LPCSTR filename, IFX_Allocator *pAllocator=0)
(Available only for platforms supporting CRT file access (fopen, ...)) Create a CRT based file writin...
size_t FX_File_ReadPos(FX_HFILE hFile, void *pBuffer, size_t szBuffer, FX_INT64 pos)
Read data from specified position.
virtual FX_INT64 GetBlockOffset()=0
Get the offset of data in internal buffer.
virtual size_t GetBlockSize()=0
Get the size of data in internal buffer.
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:666
File access interface, open file.
Definition: fx_stream.h:765
FX_BOOL FX_CreateFolder(FX_LPCSTR path)
Create new folder.
void * FX_OpenFolder(FX_LPCSTR path)
Open a folder for reading.
virtual void Release()
Destroy the current instance.
virtual FX_BOOL Flush()
Flush stream data.
Definition: fx_stream.h:442
char const * FX_LPCSTR
Pointer to constant 8-bit Windows (ANSI) characters.
Definition: fx_system.h:679
virtual FX_BOOL Flush()
Flush internal buffer.
Definition: fx_stream.h:1087
FX_BOOL FX_IsFilePathExist(FX_LPCWSTR path)
Check if the path exists, including file path and folder path.
File stream interface, reading & writing.
Definition: fx_stream.h:649
virtual IFX_FileAccess * Retain()=0
Create a shared instance.
virtual FX_BOOL IsEOF()
Determine whether reach the end of stream.
virtual FX_BOOL WriteBlock(const void *pData, size_t size)
Write a block data to the end.
Definition: fx_stream.h:485
virtual IFX_FileStream * Retain()
Create a shared instance.
virtual FX_BOOL WriteBlock(const void *buffer, FX_INT64 offset, size_t size)
Write a block data into stream.
Definition: fx_stream.h:1085
FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
Move file.
unsigned char * FX_LPBYTE
Pointer to a FX_BYTE.
Definition: fx_system.h:646
virtual FX_INT64 GetSize()=0
Get total size of the file.
FX_BOOL FX_File_Delete(FX_BSTR fileName)
Delete file.
FX_INT64 FX_File_GetPosition(FX_HFILE hFile)
Get the current file accessing position.
Foxit allocator interface.
Definition: fx_memory.h:960
virtual FX_BOOL WriteBlock(const void *buffer, FX_INT64 offset, size_t size)=0
Write a block data into stream.
FX_BOOL FX_File_Flush(FX_HFILE hFile)
Flush internal buffer if need.
virtual void ClearRange()
Clear accessing range set by function IFX_FileRead::SetRange.
Definition: fx_stream.h:597
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
FX_INT64 FX_File_GetSize(FX_HFILE hFile)
Get file size.
virtual size_t ReadBlock(void *buffer, size_t size)=0
Read data block from sequential stream.
virtual FX_INT64 GetSize()=0
Get total size of the file.
#define TRUE
Keyword which value is 1.
Definition: fx_system.h:757
virtual FX_BOOL Flush()=0
Flush internal buffer.
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
virtual void DetachBuffer()=0
Detach the current memory buffer.
virtual FX_INT64 GetSize()=0
Get the current stream size, in bytes.
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)=0
Read a data block from stream.
CONSTANT BYTE STRING CLASS.
Definition: fx_string.h:51
virtual void Release()=0
Called when to release everything.
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_INT64 szFile)
Truncate file size.
virtual FX_BOOL WriteBlock(const void *pData, size_t size)=0
Write a block data.
FX_BOOL PreCache(FX_INT64 offset, FX_INT32 nCacheCount)
Attach a file read.
BYTE STRING CLASS.
Definition: fx_string.h:317
IFX_FileRead * FX_CreateFileRead(FX_LPCSTR filename, IFX_Allocator *pAllocator=0)
(Available only for platforms supporting CRT file access) Create a CRT based file reading interface.
unsigned char const * FX_LPCBYTE
Pointer to a constant FX_BYTE.
Definition: fx_system.h:648
IFX_FileStream * FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes, IFX_Allocator *pAllocator=0)
(Available only for platforms supporting CRT file access) Create a CRT based file I/O interface.
Header file for Memory management related definitions and classes.
#define FALSE
Keyword which value is 0.
Definition: fx_system.h:762
virtual IFX_FileStream * Retain()=0
Create a shared instance.
#define NULL
The null-pointer value.
Definition: fx_system.h:767
#define FX_DEFINEHANDLE(name)
Macro to define a handle type.
Definition: fx_system.h:749
#define FX_FILESIZE
Support large file directly.
Definition: fx_stream.h:138
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)
Read a data block from the file.
virtual IFX_FileStream * CreateFileStream(FX_DWORD dwModes)=0
Create IFX_FileStream to operate file.
virtual FX_BOOL IsConsecutive() const =0
Determine whether the current mode is consecutive or not.
virtual void EstimateSize(size_t nInitSize, size_t nGrowSize)=0
Change initialize size and grow size.
virtual void Release()=0
Called when to release the current instance.
FX_INT64 FX_File_SetPosition(FX_HFILE hFile, FX_INT64 pos)
Set the current file accessing position.