| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef XFA_SRC_FGAS_CRT_FGAS_STREAM_H_ | |
| 8 #define XFA_SRC_FGAS_CRT_FGAS_STREAM_H_ | |
| 9 | |
| 10 #include "core/include/fxcrt/fx_stream.h" | |
| 11 #include "core/include/fxcrt/fx_system.h" | |
| 12 | |
| 13 class IFX_Stream; | |
| 14 | |
| 15 IFX_FileRead* FX_CreateFileRead(IFX_Stream* pBaseStream, | |
| 16 FX_BOOL bReleaseStream = FALSE); | |
| 17 IFX_FileRead* FX_CreateFileRead(IFX_BufferRead* pBufferRead, | |
| 18 FX_FILESIZE iFileSize = -1, | |
| 19 FX_BOOL bReleaseStream = TRUE); | |
| 20 IFX_FileWrite* FX_CreateFileWrite(IFX_Stream* pBaseStream, | |
| 21 FX_BOOL bReleaseStream = FALSE); | |
| 22 enum FX_STREAMACCESS { | |
| 23 FX_STREAMACCESS_Binary = 0x00, | |
| 24 FX_STREAMACCESS_Text = 0x01, | |
| 25 FX_STREAMACCESS_Read = 0x02, | |
| 26 FX_STREAMACCESS_Write = 0x04, | |
| 27 FX_STREAMACCESS_Truncate = 0x10, | |
| 28 FX_STREAMACCESS_Append = 0x20, | |
| 29 FX_STREAMACCESS_Create = 0x80, | |
| 30 }; | |
| 31 | |
| 32 enum FX_STREAMSEEK { | |
| 33 FX_STREAMSEEK_Begin = 0, | |
| 34 FX_STREAMSEEK_Current, | |
| 35 FX_STREAMSEEK_End, | |
| 36 }; | |
| 37 | |
| 38 class IFX_Stream { | |
| 39 public: | |
| 40 static IFX_Stream* CreateStream(IFX_FileRead* pFileRead, FX_DWORD dwAccess); | |
| 41 static IFX_Stream* CreateStream(IFX_FileWrite* pFileWrite, FX_DWORD dwAccess); | |
| 42 static IFX_Stream* CreateStream(const FX_WCHAR* pszFileName, | |
| 43 FX_DWORD dwAccess); | |
| 44 static IFX_Stream* CreateStream(uint8_t* pData, | |
| 45 int32_t length, | |
| 46 FX_DWORD dwAccess); | |
| 47 static IFX_Stream* CreateStream(IFX_BufferRead* pBufferRead, | |
| 48 FX_DWORD dwAccess, | |
| 49 int32_t iFileSize = -1, | |
| 50 FX_BOOL bReleaseBufferRead = TRUE); | |
| 51 static IFX_Stream* CreateTextStream(IFX_Stream* pBaseStream, | |
| 52 FX_BOOL bDeleteOnRelease); | |
| 53 virtual ~IFX_Stream() {} | |
| 54 virtual void Release() = 0; | |
| 55 virtual IFX_Stream* Retain() = 0; | |
| 56 virtual FX_DWORD GetAccessModes() const = 0; | |
| 57 virtual int32_t GetLength() const = 0; | |
| 58 virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0; | |
| 59 virtual int32_t GetPosition() = 0; | |
| 60 virtual FX_BOOL IsEOF() const = 0; | |
| 61 virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) = 0; | |
| 62 virtual int32_t ReadString(FX_WCHAR* pStr, | |
| 63 int32_t iMaxLength, | |
| 64 FX_BOOL& bEOS, | |
| 65 int32_t const* pByteSize = NULL) = 0; | |
| 66 virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; | |
| 67 virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; | |
| 68 virtual void Flush() = 0; | |
| 69 virtual FX_BOOL SetLength(int32_t iLength) = 0; | |
| 70 virtual int32_t GetBOM(uint8_t bom[4]) const = 0; | |
| 71 virtual FX_WORD GetCodePage() const = 0; | |
| 72 virtual FX_WORD SetCodePage(FX_WORD wCodePage) = 0; | |
| 73 virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess, | |
| 74 int32_t iOffset, | |
| 75 int32_t iLength) = 0; | |
| 76 }; | |
| 77 | |
| 78 #endif // XFA_SRC_FGAS_CRT_FGAS_STREAM_H_ | |
| OLD | NEW |