Foxit PDF Conversion SDK

fx_stream.h
Go to the documentation of this file.
1
15 //<<<+++OPENSOURCE
16 //<<<+++OPENSOURCE_LICENSE
17 //<<<+++OPENSOURCE_BEGIN LIC==FOXIT||LIC==GOOGLE
18
24 //<<<+++OPENSOURCE_MUST_BEGIN
25 #ifndef _FX_STREAM_H_
26 #define _FX_STREAM_H_
27
28 #ifndef _FX_MEMORY_H_
29 #include "fx_memory.h"
30 #endif
31 //<<<+++OPENSOURCE_MUST_END
32
33 //*****************************************************************************
34 //* Folder access
35 //*****************************************************************************
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_
37
44 void* FX_OpenFolder(FX_LPCSTR path);
52 void* FX_OpenFolder(FX_LPCWSTR path);
53
64 FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder, FX_LPCSTR absPath=NULL);
75 FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder, FX_LPCSTR absPath=NULL);
76
84 void FX_CloseFolder(void* handle);
85
91 FX_WCHAR FX_GetFolderSeparator();
92
93 #endif
94
95 #if _FX_OS_ != _FX_EMBEDDED_
96 //<<<+++OPENSOURCE_BEGIN LIC==FOXIT
104 FX_BOOL FX_CreateFolder(FX_LPCSTR path);
112 FX_BOOL FX_CreateFolder(FX_LPCWSTR path);
113
121 FX_BOOL FX_IsFilePathExist(FX_LPCWSTR path);
122 //<<<+++OPENSOURCE_END
123 #endif
124
125 //*****************************************************************************
126 //* File access
127 //*****************************************************************************
129 FX_DEFINEHANDLE(FX_HFILE)
130
131 //<<<+++OPENSOURCE_MUST_BEGIN LIC==FOXIT
132 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_
133 #if defined(_FX_LARGEFILE_SUPPORT_)
134
135 #define _FX_LARGEFILE_USED_
136
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))
143 #else
144
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
150 #endif
151 #elif _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || _FX_OS_==_FX_LINUX_EMBEDDED_
152 #if defined(_FX_LARGEFILE_SUPPORT_)
153
154 #define _FX_LARGEFILE_USED_
155
156 #ifndef _LARGEFILE_SOURCE
157 #define _LARGEFILE_SOURCE
158 #endif
159 #ifndef _LARGEFILE64_SOURCE
160 #define _LARGEFILE64_SOURCE
161 #endif
162 #endif
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))
168 #else
169 #define FX_GETBYTEOFFSET32(a) 0
170 #define FX_GETBYTEOFFSET40(a) 0
171 #define FX_GETBYTEOFFSET48(a) 0
172 #define FX_GETBYTEOFFSET56(a) 0
173 #endif
174 #include <fcntl.h>
175 #include <unistd.h>
176 #include <sys/stat.h>
177
178 #ifndef O_BINARY
179 #define O_BINARY 0
180 #endif
181 #ifndef O_LARGEFILE
182 #define O_LARGEFILE 0
183 #endif
184
186 #if defined(_FX_LARGEFILE_SUPPORT_)
187 #if _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_ANDROID_
188 // mac and bsd are always 64 bit. use off_t
189 // linux and android uses off64_t
190 #ifndef _CHROME_PNACL_
191 #define _FX_USE_OFF64_T_
192 #endif
193 #endif
194 #endif
195 #if defined(_FX_USE_OFF64_T_)
196 #define FX_FILESIZE off64_t
197 #elif _FX_OS_ == _FX_LINUX_EMBEDDED_
198 #define FX_FILESIZE FX_INT32
199 #else
200 #ifndef _CHROME_PNACL_
201 #define FX_FILESIZE off_t
202 #else
203 #define FX_FILESIZE FX_INT32
204 #endif
205 #endif
206 #else //do not support large file.
207
208 #define FX_FILESIZE FX_INT32
209 #define FX_GETBYTEOFFSET32(a) 0
210 #define FX_GETBYTEOFFSET40(a) 0
211 #define FX_GETBYTEOFFSET48(a) 0
212 #define FX_GETBYTEOFFSET56(a) 0
213 #endif
214 //<<<+++OPENSOURCE_MUST_END
215
216 #define FX_GETBYTEOFFSET24(a) ((FX_BYTE)(a>>24))
217 #define FX_GETBYTEOFFSET16(a) ((FX_BYTE)(a>>16))
218 #define FX_GETBYTEOFFSET8(a) ((FX_BYTE)(a>>8))
219 #define FX_GETBYTEOFFSET0(a) ((FX_BYTE)(a))
220
226 #define FX_FILEMODE_Write 0
227
228 #define FX_FILEMODE_ReadOnly 1
229
230 #define FX_FILEMODE_Truncate 2 //
231
243 FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode, IFX_Allocator* pAllocator = NULL);
254 FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode, IFX_Allocator* pAllocator = NULL);
263 void FX_File_Close(FX_HFILE hFile, IFX_Allocator* pAllocator = NULL);
264 //<<<+++OPENSOURCE_END
265
273 FX_FILESIZE FX_File_GetSize(FX_HFILE hFile);
281 FX_FILESIZE FX_File_GetPosition(FX_HFILE hFile);
290 FX_FILESIZE FX_File_SetPosition(FX_HFILE hFile, FX_FILESIZE pos);
300 size_t FX_File_Read(FX_HFILE hFile, void* pBuffer, size_t szBuffer);
311 size_t FX_File_ReadPos(FX_HFILE hFile, void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
321 size_t FX_File_Write(FX_HFILE hFile, const void* pBuffer, size_t szBuffer);
332 size_t FX_File_WritePos(FX_HFILE hFile, const void* pBuffer, size_t szBuffer, FX_FILESIZE pos);
340 FX_BOOL FX_File_Flush(FX_HFILE hFile);
349 FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile);
350
358 FX_BOOL FX_File_Exist(FX_BSTR fileName);
366 FX_BOOL FX_File_Exist(FX_WSTR fileName);
374 FX_BOOL FX_File_Delete(FX_BSTR fileName);
382 FX_BOOL FX_File_Delete(FX_WSTR fileName);
391 FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst);
400 FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst);
409 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst);
418 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst);
419
420 //*****************************************************************************
421 //* IFX_StreamWrite/IFX_FileWrite
422 //*****************************************************************************
424 class IFX_StreamWrite
425 {
426 public:
428 virtual void Release() = 0;
429
438 virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0;
444 virtual FX_BOOL Flush() { return true; }
445
446 protected:
447 virtual ~IFX_StreamWrite() {}
448 };
449
451 class IFX_FileWrite : public IFX_StreamWrite
452 {
453 public:
455 virtual void Release() = 0;
456
462 virtual FX_FILESIZE GetSize() = 0;
468 virtual FX_BOOL Flush() = 0;
478 virtual FX_BOOL WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) = 0;
487 virtual FX_BOOL WriteBlock(const void* pData, size_t size) {return WriteBlock(pData, GetSize(), size);}
488
489 protected:
490 virtual ~IFX_FileWrite() {}
491 };
492
502 IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename, IFX_Allocator* pAllocator = NULL);
503
513 IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename, IFX_Allocator* pAllocator = NULL);
514 //<<<+++OPENSOURCE_END
515
516 //*****************************************************************************
517 //* IFX_FileRead
518 //*****************************************************************************
520 class IFX_StreamRead
521 {
522 public:
528 virtual void Release() = 0;
529
535 virtual FX_BOOL IsEOF() = 0;
541 virtual FX_FILESIZE GetPosition() = 0;
550 virtual size_t ReadBlock(void* buffer, size_t size) = 0;
551
559 virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) { FXSYS_assert(false && "Unsupport"); return -1; }
560
561 protected:
562 virtual ~IFX_StreamRead() {}
563 };
564
566 class IFX_FileRead : public IFX_StreamRead
567 {
568 public:
574 virtual void Release() = 0;
575
581 virtual FX_FILESIZE GetSize() = 0;
587 virtual FX_BOOL IsEOF() {return false;}
593 virtual FX_FILESIZE GetPosition() {return 0;}
602 virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) {return false;}
608 virtual void ClearRange() {}
618 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
627 virtual size_t ReadBlock(void* buffer, size_t size) {return 0;}
628
636 virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) { FXSYS_assert(false && "Unsupport"); return -1; }
637
638 protected:
639 virtual ~IFX_FileRead() {}
640 };
641
651 IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename, IFX_Allocator* pAllocator = NULL);
652
662 IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename, IFX_Allocator* pAllocator = NULL);
663 //<<<+++OPENSOURCE_END
664
665 //*****************************************************************************
666 //* IFX_FileStream
667 //*****************************************************************************
669 class IFX_FileStream
670 : public IFX_FileRead, public IFX_FileWrite
671 {
672 public:
678 virtual IFX_FileStream* Retain() = 0;
684 virtual void Release() = 0;
685
691 virtual FX_FILESIZE GetSize() = 0;
697 virtual FX_BOOL IsEOF() = 0;
703 virtual FX_FILESIZE GetPosition() = 0;
704
714 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
723 virtual size_t ReadBlock(void* buffer, size_t size) = 0;
724
734 virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) = 0;
743 virtual FX_BOOL WriteBlock(const void* buffer, size_t size) {return WriteBlock(buffer, GetSize(), size);}
744
750 virtual FX_BOOL Flush() = 0;
751
752 protected:
753 virtual ~IFX_FileStream() {}
754 };
755
766 IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes, IFX_Allocator* pAllocator = NULL);
767
778 IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes, IFX_Allocator* pAllocator = NULL);
779 //<<<+++OPENSOURCE_END
780
781 //*****************************************************************************
782 //* IFX_ChunkFileStream
783 //*****************************************************************************
785 class IFX_ChunkFileStream : public IFX_FileStream
786 {
787 public:
793 virtual void Release() = 0;
794
800 virtual FX_FILESIZE GetSize() = 0;
806 virtual FX_BOOL IsEOF() = 0;
812 virtual FX_FILESIZE GetPosition() = 0;
813
823 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
832 virtual size_t ReadBlock(void* buffer, size_t size) = 0;
833
843 virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) = 0;
852 virtual FX_BOOL WriteBlock(const void* buffer, size_t size)
853 {
854 return WriteBlock(buffer, GetSize(), size);
855 }
856
862 virtual FX_BOOL Flush() = 0;
863
864 protected:
870 virtual IFX_FileStream* Retain() = 0;
871
872 virtual ~IFX_ChunkFileStream() {}
873
874 friend class CFX_ChunkFileStreamsManager;
875 };
876
877 //*****************************************************************************
878 //* CFX_ChunkFileStreamsManager
879 //*****************************************************************************
881 class CFX_ChunkFileStreamsManagerImpl;
882 class CFX_ChunkFileStreamsManager : public CFX_Object
883 {
884 public:
892 CFX_ChunkFileStreamsManager(IFX_FileStream* pFileStream, size_t nChunkSize = 1024);
899 ~CFX_ChunkFileStreamsManager();
900
907 IFX_ChunkFileStream* CreateChunkFileStream();
908
909 private:
910 std::shared_ptr<CFX_ChunkFileStreamsManagerImpl> m_pImpl;
911 };
912
913 //*****************************************************************************
914 //* IFX_FileAccess
915 //*****************************************************************************
917 class IFX_FileAccess
918 {
919 public:
925 virtual void Release() = 0;
926
932 virtual IFX_FileAccess* Retain() = 0;
940 virtual void GetPath(CFX_WideString& wsPath) = 0;
941
949 virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 0;
950
951 protected:
952 virtual ~IFX_FileAccess() {}
953 };
954
964 IFX_FileAccess* FX_CreateDefaultFileAccess(FX_WSTR wsPath, IFX_Allocator* pAllocator = NULL);
965
966 class IFX_FileCollection
967 {
968 public:
969 virtual void Release() = 0;
970
971 virtual FX_POSITION GetStartPos() = 0;
972 virtual IFX_FileAccess* GetNextFile(FX_POSITION& pos) = 0;
973
974 protected:
975 virtual ~IFX_FileCollection() {}
976 };
977 //<<<+++OPENSOURCE_END
978
979 //*****************************************************************************
980 //* Memory stream
981 //*****************************************************************************
983 class IFX_MemoryStream : public IFX_FileStream
984 {
985 public:
986 virtual ~IFX_MemoryStream() {}
987
993 virtual FX_BOOL IsConsecutive() const = 0;
1007 virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
1016 virtual FX_LPBYTE GetBuffer() const = 0;
1031 virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = false) = 0;
1039 virtual void DetachBuffer() = 0;
1040 };
1054 IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = false, IFX_Allocator* pAllocator = NULL);
1055
1067 IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = false, IFX_Allocator* pAllocator = NULL);
1068 //<<<+++OPENSOURCE_END
1069
1070 //*****************************************************************************
1071 //* Buffer read stream
1072 //*****************************************************************************
1078 class IFX_BufferRead : public IFX_StreamRead
1079 {
1080 public:
1086 virtual void Release() = 0;
1087
1093 virtual FX_BOOL IsEOF() = 0;
1099 virtual FX_FILESIZE GetPosition() = 0;
1100
1109 virtual size_t ReadBlock(void* buffer, size_t size) = 0;
1110
1118 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = false) = 0;
1124 virtual FX_LPCBYTE GetBlockBuffer() = 0;
1130 virtual size_t GetBlockSize() = 0;
1138 virtual FX_FILESIZE GetBlockOffset() = 0;
1139
1140 protected:
1141 virtual ~IFX_BufferRead() {}
1142 };
1143
1144 //*****************************************************************************
1145 //* Cached file read
1146 //*****************************************************************************
1147 #define FX_FILECACHE_CHUNKSIZE 32768
1148 #define FX_FILECACHE_CHUNKCOUNT 64
1149
1151 class CFX_CachedFileRead : public IFX_FileStream, public CFX_Object
1152 {
1153 public:
1155 CFX_CachedFileRead();
1157 virtual ~CFX_CachedFileRead();
1158
1170 FX_BOOL Init(FX_INT32 nChunkSize, FX_INT32 nChunkCount, FX_LPVOID pBuffer, IFX_Allocator* pAllocator = NULL);
1179 FX_BOOL AttachFile(IFX_FileRead* pFile, FX_BOOL bTakeOver);
1188 FX_BOOL PreCache(FX_FILESIZE offset, FX_INT32 nCacheCount);
1189
1195 virtual FX_FILESIZE GetSize();
1201 virtual FX_BOOL IsEOF();
1207 virtual FX_FILESIZE GetPosition();
1208
1218 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
1227 virtual size_t ReadBlock(void* buffer, size_t size);
1228
1229 protected:
1230 FXMT_LOCKOBJECT_DEFINE(m_LockObj);
1231 FX_LPVOID m_pData;
1232 FX_DWORD m_dwCount;
1233
1234 /* @brief Create a shared instance. */
1235 virtual IFX_FileStream* Retain();
1236 /* @brief Called when to release everything */
1237 virtual void Release();
1239 virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) {return false;}
1241 virtual FX_BOOL Flush() {return false;}
1242 };
1243 //<<<+++OPENSOURCE_END
1244
1245 //<<<+++OPENSOURCE_MUST_BEGIN
1246 #endif // _FX_STREAM_H_
1247 //<<<+++OPENSOURCE_MUST_END
1248
1251 //<<<+++OPENSOURCE_END
IFX_FileAccess::GetPath
virtual void GetPath(CFX_WideString &wsPath)=0
Get current path string.
IFX_FileRead::ReadBlock
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)=0
Read a data block from the file.
CFX_CachedFileRead::GetSize
virtual FX_INT64 GetSize()
Get total size of the file.
FX_LPVOID
void * FX_LPVOID
Pointer to any type.
Definition: fx_system.h:650
IFX_MemoryStream
Memory stream interface.
Definition: fx_stream.h:983
IFX_FileRead::ReadBlock
virtual size_t ReadBlock(void *buffer, size_t size)
Read data block from stream.
Definition: fx_stream.h:627
FX_WCHAR
wchar_t FX_WCHAR
Compiler dependant Unicode character (16-bit for Microsoft Compiler, 32-bit for gcc).
Definition: fx_system.h:726
IFX_FileWrite::Release
virtual void Release()=0
Called when to release everything.
FX_CreateDefaultFileAccess
IFX_FileAccess * FX_CreateDefaultFileAccess(FX_WSTR wsPath, IFX_Allocator *pAllocator=0)
Create a CRT based file I/O interface.
IFX_FileWrite
File writing interface.
Definition: fx_stream.h:451
FX_DWORD
unsigned long FX_DWORD
32-bit unsigned integer.
Definition: fx_system.h:720
CFX_CachedFileRead::AttachFile
FX_BOOL AttachFile(IFX_FileRead *pFile, FX_BOOL bTakeOver)
Attach a file read.
IFX_FileStream::Release
virtual void Release()=0
Destroy the current instance.
CFX_WideStringC
CONSTANT WIDE STRING CLASS.
Definition: fx_string.h:1205
IFX_FileWrite::WriteBlock
virtual FX_BOOL WriteBlock(const void *pData, FX_INT64 offset, size_t size)=0
Write a block data.
IFX_FileRead::SetRange
virtual FX_BOOL SetRange(FX_INT64 offset, FX_INT64 size)
Set accessing range.
Definition: fx_stream.h:602
FX_File_Exist
FX_BOOL FX_File_Exist(FX_BSTR fileName)
Determine whether a file exists or not.
FX_File_Close
void FX_File_Close(FX_HFILE hFile, IFX_Allocator *pAllocator=0)
Close file.
IFX_StreamRead::SetPosition
virtual FX_INT64 SetPosition(FX_INT64 pos)
Set the current file accessing position.
Definition: fx_stream.h:559
FX_File_Copy
FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
Copy file.
IFX_FileAccess::Release
virtual void Release()=0
Destroy the current instance.
IFX_StreamRead::IsEOF
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
IFX_ChunkFileStream
Chunk-based File stream interface, reading & writing.
Definition: fx_stream.h:785
IFX_MemoryStream::GetBuffer
virtual FX_LPBYTE GetBuffer() const =0
Get the current memory buffer.
IFX_ChunkFileStream::WriteBlock
virtual FX_BOOL WriteBlock(const void *buffer, FX_INT64 offset, size_t size)=0
Write a block data into stream.
FX_CloseFolder
void FX_CloseFolder(void *handle)
Close folder handle.
IFX_BufferRead::GetBlockBuffer
virtual FX_LPCBYTE GetBlockBuffer()=0
Get internal buffer of block data.
FX_GetFolderSeparator
FX_WCHAR FX_GetFolderSeparator()
Get folder separator for the system. Most likely it's either /' or '\'.
IFX_StreamRead::ReadBlock
virtual size_t ReadBlock(void *buffer, size_t size)=0
Read data block from sequential stream.
IFX_FileStream::IsEOF
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
IFX_FileRead::GetPosition
virtual FX_INT64 GetPosition()
Get the current reading position in stream.
Definition: fx_stream.h:593
FX_LPCWSTR
wchar_t const * FX_LPCWSTR
Pointer to constant Unicode characters.
Definition: fx_system.h:730
IFX_StreamWrite::Release
virtual void Release()=0
Called when to release everything.
IFX_FileRead::SetPosition
virtual FX_INT64 SetPosition(FX_INT64 pos)
Set the current file accessing position.
Definition: fx_stream.h:636
IFX_ChunkFileStream::ReadBlock
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)=0
Read a data block from stream.
FX_File_WritePos
size_t FX_File_WritePos(FX_HFILE hFile, const void *pBuffer, size_t szBuffer, FX_INT64 pos)
Write data at specified position.
FX_GetNextFile
FX_BOOL FX_GetNextFile(void *handle, CFX_ByteString &filename, FX_BOOL &bFolder, FX_LPCSTR absPath=0)
Read next entry in the folder.
FX_File_Open
FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode, IFX_Allocator *pAllocator=0)
Open file with specified accessing mode.
CFX_CachedFileRead::Init
FX_BOOL Init(FX_INT32 nChunkSize, FX_INT32 nChunkCount, FX_LPVOID pBuffer, IFX_Allocator *pAllocator=0)
Initialize the chunk size and chunk count.
CFX_CachedFileRead
Cached file read interface.
Definition: fx_stream.h:1151
IFX_FileRead::Release
virtual void Release()=0
Called when to release everything.
IFX_FileRead
File reading interface.
Definition: fx_stream.h:566
CFX_WideString
WIDE STRING CLASS.
Definition: fx_string.h:1452
IFX_StreamWrite
Stream writing interface.
Definition: fx_stream.h:424
FX_POSITION
void * FX_POSITION
A value used to denote the position of an element in a collection.
Definition: fx_system.h:654
FX_File_Read
size_t FX_File_Read(FX_HFILE hFile, void *pBuffer, size_t szBuffer)
Read data from the current file accessing position.
IFX_StreamRead::GetPosition
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
CFX_CachedFileRead::GetPosition
virtual FX_INT64 GetPosition()
Get the current reading position in stream.
IFX_FileStream::WriteBlock
virtual FX_BOOL WriteBlock(const void *buffer, size_t size)
Write a block data to the end of current stream.
Definition: fx_stream.h:743
IFX_StreamRead
Stream reading interface.
Definition: fx_stream.h:520
IFX_FileRead::IsEOF
virtual FX_BOOL IsEOF()
Determine whether reach the end of stream.
Definition: fx_stream.h:587
IFX_ChunkFileStream::GetPosition
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
FX_File_Write
size_t FX_File_Write(FX_HFILE hFile, const void *pBuffer, size_t szBuffer)
Write data from the current file accessing position.
IFX_FileWrite::Flush
virtual FX_BOOL Flush()=0
Flush internal buffer of the file.
IFX_BufferRead
IFX_BufferRead stream provides an optimized approach to read stream data. Usually,...
Definition: fx_stream.h:1078
IFX_ChunkFileStream::Flush
virtual FX_BOOL Flush()=0
Flush internal buffer.
FX_INT32
int FX_INT32
32-bit signed integer.
Definition: fx_system.h:679
IFX_ChunkFileStream::IsEOF
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
FX_CreateFileWrite
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...
FX_File_ReadPos
size_t FX_File_ReadPos(FX_HFILE hFile, void *pBuffer, size_t szBuffer, FX_INT64 pos)
Read data from specified position.
IFX_ChunkFileStream::Retain
virtual IFX_FileStream * Retain()=0
Create a shared instance.
IFX_BufferRead::GetBlockOffset
virtual FX_INT64 GetBlockOffset()=0
Get the offset of data in internal buffer.
IFX_BufferRead::GetBlockSize
virtual size_t GetBlockSize()=0
Get the size of data in internal buffer.
FX_BOOL
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:687
IFX_FileAccess
File access interface, open file.
Definition: fx_stream.h:917
FX_CreateFolder
FX_BOOL FX_CreateFolder(FX_LPCSTR path)
Create new folder.
FX_OpenFolder
void * FX_OpenFolder(FX_LPCSTR path)
Open a folder for reading.
CFX_CachedFileRead::Release
virtual void Release()
Destroy the current instance.
IFX_StreamWrite::Flush
virtual FX_BOOL Flush()
Flush stream data.
Definition: fx_stream.h:444
FX_LPCSTR
char const * FX_LPCSTR
Pointer to constant 8-bit Windows (ANSI) characters.
Definition: fx_system.h:701
CFX_CachedFileRead::Flush
virtual FX_BOOL Flush()
Flush internal buffer. Unsupported for reading mode, return false directly.
Definition: fx_stream.h:1241
FX_IsFilePathExist
FX_BOOL FX_IsFilePathExist(FX_LPCWSTR path)
Check if the path exists, including file path and folder path.
IFX_BufferRead::ReadNextBlock
virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart=false)=0
Read the next block in sequential stream.
IFX_FileStream
File stream interface, reading & writing.
Definition: fx_stream.h:669
CFX_CachedFileRead::CFX_CachedFileRead
CFX_CachedFileRead()
Constructor.
IFX_FileAccess::Retain
virtual IFX_FileAccess * Retain()=0
Create a shared instance.
CFX_CachedFileRead::IsEOF
virtual FX_BOOL IsEOF()
Determine whether reach the end of stream.
IFX_FileWrite::WriteBlock
virtual FX_BOOL WriteBlock(const void *pData, size_t size)
Write a block data to the end.
Definition: fx_stream.h:487
CFX_CachedFileRead::Retain
virtual IFX_FileStream * Retain()
Create a shared instance.
CFX_CachedFileRead::WriteBlock
virtual FX_BOOL WriteBlock(const void *buffer, FX_INT64 offset, size_t size)
Write a block data into stream. Unsupported for reading mode, return false directly.
Definition: fx_stream.h:1239
FX_File_Move
FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
Move file.
FX_LPBYTE
unsigned char * FX_LPBYTE
Pointer to a FX_BYTE.
Definition: fx_system.h:663
IFX_FileRead::GetSize
virtual FX_INT64 GetSize()=0
Get total size of the file.
FX_File_Delete
FX_BOOL FX_File_Delete(FX_BSTR fileName)
Delete file.
FX_File_GetPosition
FX_INT64 FX_File_GetPosition(FX_HFILE hFile)
Get the current file accessing position.
IFX_Allocator
Foxit allocator interface.
Definition: fx_memory.h:997
IFX_FileStream::WriteBlock
virtual FX_BOOL WriteBlock(const void *buffer, FX_INT64 offset, size_t size)=0
Write a block data into stream.
FX_File_Flush
FX_BOOL FX_File_Flush(FX_HFILE hFile)
Flush internal buffer if need.
IFX_FileRead::ClearRange
virtual void ClearRange()
Clear accessing range set by function IFX_FileRead::SetRange.
Definition: fx_stream.h:608
FXSYS_assert
#define FXSYS_assert
Assertion.
Definition: fx_system.h:797
IFX_BufferRead::GetPosition
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
FX_File_GetSize
FX_INT64 FX_File_GetSize(FX_HFILE hFile)
Get file size.
IFX_BufferRead::ReadBlock
virtual size_t ReadBlock(void *buffer, size_t size)=0
Read data block from sequential stream.
IFX_FileWrite::GetSize
virtual FX_INT64 GetSize()=0
Get total size of the file.
IFX_FileStream::Flush
virtual FX_BOOL Flush()=0
Flush internal buffer.
IFX_BufferRead::IsEOF
virtual FX_BOOL IsEOF()=0
Determine whether reach the end of stream.
IFX_MemoryStream::DetachBuffer
virtual void DetachBuffer()=0
Detach the current memory buffer.
IFX_FileStream::GetSize
virtual FX_INT64 GetSize()=0
Get the current stream size, in bytes.
IFX_FileStream::ReadBlock
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)=0
Read a data block from stream.
CFX_ByteStringC
CONSTANT BYTE STRING CLASS.
Definition: fx_string.h:51
IFX_StreamRead::Release
virtual void Release()=0
Called when to release everything.
IFX_FileStream::GetPosition
virtual FX_INT64 GetPosition()=0
Get the current reading position in stream.
FX_File_Truncate
FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_INT64 szFile)
Truncate file size.
IFX_StreamWrite::WriteBlock
virtual FX_BOOL WriteBlock(const void *pData, size_t size)=0
Write a block data.
CFX_CachedFileRead::PreCache
FX_BOOL PreCache(FX_INT64 offset, FX_INT32 nCacheCount)
Attach a file read.
CFX_ByteString
BYTE STRING CLASS.
Definition: fx_string.h:317
IFX_ChunkFileStream::GetSize
virtual FX_INT64 GetSize()=0
Get the current stream size, in bytes.
FX_CreateFileRead
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.
FX_LPCBYTE
unsigned char const * FX_LPCBYTE
Pointer to a constant FX_BYTE.
Definition: fx_system.h:665
FX_CreateFileStream
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.
fx_memory.h
Header file for Memory management related definitions and classes.
IFX_ChunkFileStream::WriteBlock
virtual FX_BOOL WriteBlock(const void *buffer, size_t size)
Write a block data to the end of current stream.
Definition: fx_stream.h:852
IFX_MemoryStream::AttachBuffer
virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver=false)=0
Attach a memory buffer.
IFX_FileStream::Retain
virtual IFX_FileStream * Retain()=0
Create a shared instance.
NULL
#define NULL
The null-pointer value.
Definition: fx_system.h:785
FX_DEFINEHANDLE
#define FX_DEFINEHANDLE(name)
Macro to define a handle type.
Definition: fx_system.h:765
FX_FILESIZE
#define FX_FILESIZE
Support large file directly.
Definition: fx_stream.h:138
CFX_CachedFileRead::ReadBlock
virtual FX_BOOL ReadBlock(void *buffer, FX_INT64 offset, size_t size)
Read a data block from the file.
IFX_FileAccess::CreateFileStream
virtual IFX_FileStream * CreateFileStream(FX_DWORD dwModes)=0
Create IFX_FileStream to operate file.
IFX_MemoryStream::IsConsecutive
virtual FX_BOOL IsConsecutive() const =0
Determine whether the current mode is consecutive or not.
IFX_MemoryStream::EstimateSize
virtual void EstimateSize(size_t nInitSize, size_t nGrowSize)=0
Change initialize size and grow size.
IFX_ChunkFileStream::Release
virtual void Release()=0
Destroy the current instance.
IFX_BufferRead::Release
virtual void Release()=0
Called when to release the current instance.
FX_File_SetPosition
FX_INT64 FX_File_SetPosition(FX_HFILE hFile, FX_INT64 pos)
Set the current file accessing position.
FX_CreateMemoryStream
IFX_MemoryStream * FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver=false, IFX_Allocator *pAllocator=0)
Creates a stream object by a given memory buffer. This function creates a consecutive memory stream o...
CFX_CachedFileRead::~CFX_CachedFileRead
virtual ~CFX_CachedFileRead()
Destructor.