OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FX_STREAM | 7 #ifndef _FX_STREAM |
8 #define _FX_STREAM | 8 #define _FX_STREAM |
9 class IFX_Stream; | 9 class IFX_Stream; |
10 IFX_FileRead* FX_CreateFileRead(IFX_Stream *pBaseStream, FX_BOOL bReleaseStrea
m = FALSE); | 10 IFX_FileRead* FX_CreateFileRead(IFX_Stream *pBaseStream, FX_BOOL bReleaseStrea
m = FALSE); |
11 #ifdef FX_FILESIZE | 11 #ifdef FX_FILESIZE |
12 IFX_FileRead* FX_CreateFileRead(IFX_BufferRead *pBufferRead, FX_FILESIZE iFile
Size = -1, FX_BOOL bReleaseStream = TRUE); | 12 IFX_FileRead* FX_CreateFileRead(IFX_BufferRead *pBufferRead, FX_FILESIZE iFile
Size = -1, FX_BOOL bReleaseStream = TRUE); |
13 #else | 13 #else |
14 IFX_FileRead*» FX_CreateFileRead(IFX_BufferRead *pBufferRead, FX_INT32 iFileSiz
e = -1, FX_BOOL bReleaseStream = TRUE); | 14 IFX_FileRead*» FX_CreateFileRead(IFX_BufferRead *pBufferRead, int32_t iFileSize
= -1, FX_BOOL bReleaseStream = TRUE); |
15 #endif | 15 #endif |
16 IFX_FileWrite* FX_CreateFileWrite(IFX_Stream *pBaseStream, FX_BOOL bReleaseStre
am = FALSE); | 16 IFX_FileWrite* FX_CreateFileWrite(IFX_Stream *pBaseStream, FX_BOOL bReleaseStre
am = FALSE); |
17 enum FX_STREAMACCESS { | 17 enum FX_STREAMACCESS { |
18 FX_STREAMACCESS_Binary = 0x00, | 18 FX_STREAMACCESS_Binary = 0x00, |
19 FX_STREAMACCESS_Text = 0x01, | 19 FX_STREAMACCESS_Text = 0x01, |
20 FX_STREAMACCESS_Read = 0x02, | 20 FX_STREAMACCESS_Read = 0x02, |
21 FX_STREAMACCESS_Write = 0x04, | 21 FX_STREAMACCESS_Write = 0x04, |
22 FX_STREAMACCESS_Truncate = 0x10, | 22 FX_STREAMACCESS_Truncate = 0x10, |
23 FX_STREAMACCESS_Append = 0x20, | 23 FX_STREAMACCESS_Append = 0x20, |
24 FX_STREAMACCESS_Create = 0x80, | 24 FX_STREAMACCESS_Create = 0x80, |
25 }; | 25 }; |
26 enum FX_STREAMSEEK { | 26 enum FX_STREAMSEEK { |
27 FX_STREAMSEEK_Begin = 0 , | 27 FX_STREAMSEEK_Begin = 0 , |
28 FX_STREAMSEEK_Current , | 28 FX_STREAMSEEK_Current , |
29 FX_STREAMSEEK_End , | 29 FX_STREAMSEEK_End , |
30 }; | 30 }; |
31 class IFX_Stream | 31 class IFX_Stream |
32 { | 32 { |
33 public: | 33 public: |
34 static IFX_Stream* CreateStream(IFX_FileRead *pFileRead, FX
_DWORD dwAccess); | 34 static IFX_Stream* CreateStream(IFX_FileRead *pFileRead, FX
_DWORD dwAccess); |
35 static IFX_Stream* CreateStream(IFX_FileWrite *pFileWrite,
FX_DWORD dwAccess); | 35 static IFX_Stream* CreateStream(IFX_FileWrite *pFileWrite,
FX_DWORD dwAccess); |
36 static IFX_Stream* CreateStream(FX_LPCWSTR pszFileName, FX_
DWORD dwAccess); | 36 static IFX_Stream* CreateStream(FX_LPCWSTR pszFileName, FX_
DWORD dwAccess); |
37 static IFX_Stream*» » » CreateStream(FX_LPBYTE pData, FX_INT32 l
ength, FX_DWORD dwAccess); | 37 static IFX_Stream*» » » CreateStream(FX_LPBYTE pData, int32_t le
ngth, FX_DWORD dwAccess); |
38 static IFX_Stream*» » » CreateStream(IFX_BufferRead *pBufferRead
, FX_DWORD dwAccess, FX_INT32 iFileSize = -1, FX_BOOL bReleaseBufferRead = TRUE)
; | 38 static IFX_Stream*» » » CreateStream(IFX_BufferRead *pBufferRead
, FX_DWORD dwAccess, int32_t iFileSize = -1, FX_BOOL bReleaseBufferRead = TRUE); |
39 static IFX_Stream* CreateTextStream(IFX_Stream *pBaseStream
, FX_BOOL bDeleteOnRelease); | 39 static IFX_Stream* CreateTextStream(IFX_Stream *pBaseStream
, FX_BOOL bDeleteOnRelease); |
40 virtual void Release() = 0; | 40 virtual void Release() = 0; |
41 virtual IFX_Stream* Retain() = 0; | 41 virtual IFX_Stream* Retain() = 0; |
42 virtual FX_DWORD GetAccessModes() const = 0; | 42 virtual FX_DWORD GetAccessModes() const = 0; |
43 virtual FX_INT32» » » GetLength() const = 0; | 43 virtual int32_t» » » GetLength() const = 0; |
44 virtual FX_INT32» » » Seek(FX_STREAMSEEK eSeek, FX_INT32 iOffs
et) = 0; | 44 virtual int32_t» » » Seek(FX_STREAMSEEK eSeek, int32_t iOffse
t) = 0; |
45 virtual FX_INT32» » » GetPosition() = 0; | 45 virtual int32_t» » » GetPosition() = 0; |
46 virtual FX_BOOL IsEOF() const = 0; | 46 virtual FX_BOOL IsEOF() const = 0; |
47 virtual FX_INT32» » » ReadData(FX_LPBYTE pBuffer, FX_INT32 iBu
fferSize) = 0; | 47 virtual int32_t» » » ReadData(FX_LPBYTE pBuffer, int32_t iBuf
ferSize) = 0; |
48 virtual FX_INT32» » » ReadString(FX_LPWSTR pStr, FX_INT32 iMax
Length, FX_BOOL &bEOS, FX_INT32 const *pByteSize = NULL) = 0; | 48 virtual int32_t» » » ReadString(FX_LPWSTR pStr, int32_t iMaxL
ength, FX_BOOL &bEOS, int32_t const *pByteSize = NULL) = 0; |
49 virtual FX_INT32» » » WriteData(FX_LPCBYTE pBuffer, FX_INT32 i
BufferSize) = 0; | 49 virtual int32_t» » » WriteData(FX_LPCBYTE pBuffer, int32_t iB
ufferSize) = 0; |
50 virtual FX_INT32» » » WriteString(FX_LPCWSTR pStr, FX_INT32 iL
ength) = 0; | 50 virtual int32_t» » » WriteString(FX_LPCWSTR pStr, int32_t iLe
ngth) = 0; |
51 virtual void Flush() = 0; | 51 virtual void Flush() = 0; |
52 virtual FX_BOOL» » » » SetLength(FX_INT32 iLength) = 0; | 52 virtual FX_BOOL» » » » SetLength(int32_t iLength) = 0; |
53 virtual FX_INT32» » » GetBOM(FX_BYTE bom[4]) const = 0; | 53 virtual int32_t» » » GetBOM(uint8_t bom[4]) const = 0; |
54 virtual FX_WORD GetCodePage() const = 0; | 54 virtual FX_WORD GetCodePage() const = 0; |
55 virtual FX_WORD SetCodePage(FX_WORD wCodePage) =
0; | 55 virtual FX_WORD SetCodePage(FX_WORD wCodePage) =
0; |
56 virtual void Lock() = 0; | 56 virtual void Lock() = 0; |
57 virtual void Unlock() = 0; | 57 virtual void Unlock() = 0; |
58 virtual IFX_Stream*»» » CreateSharedStream(FX_DWORD dwAccess, FX
_INT32 iOffset, FX_INT32 iLength) = 0; | 58 virtual IFX_Stream*»» » CreateSharedStream(FX_DWORD dwAccess, in
t32_t iOffset, int32_t iLength) = 0; |
59 }; | 59 }; |
60 #endif | 60 #endif |
OLD | NEW |