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 XFA_FGAS_CRT_FGAS_STREAM_H_ | 7 #ifndef XFA_FGAS_CRT_FGAS_STREAM_H_ |
8 #define XFA_FGAS_CRT_FGAS_STREAM_H_ | 8 #define XFA_FGAS_CRT_FGAS_STREAM_H_ |
9 | 9 |
| 10 #include "core/fxcrt/cfx_retain_ptr.h" |
10 #include "core/fxcrt/fx_stream.h" | 11 #include "core/fxcrt/fx_stream.h" |
11 #include "core/fxcrt/fx_system.h" | 12 #include "core/fxcrt/fx_system.h" |
12 | 13 |
13 enum FX_STREAMACCESS { | 14 enum FX_STREAMACCESS { |
14 FX_STREAMACCESS_Binary = 0x00, | 15 FX_STREAMACCESS_Binary = 0x00, |
15 FX_STREAMACCESS_Text = 0x01, | 16 FX_STREAMACCESS_Text = 0x01, |
16 FX_STREAMACCESS_Read = 0x02, | 17 FX_STREAMACCESS_Read = 0x02, |
17 FX_STREAMACCESS_Write = 0x04, | 18 FX_STREAMACCESS_Write = 0x04, |
18 FX_STREAMACCESS_Truncate = 0x10, | 19 FX_STREAMACCESS_Truncate = 0x10, |
19 FX_STREAMACCESS_Append = 0x20, | 20 FX_STREAMACCESS_Append = 0x20, |
20 FX_STREAMACCESS_Create = 0x80, | 21 FX_STREAMACCESS_Create = 0x80, |
21 }; | 22 }; |
22 | 23 |
23 enum FX_STREAMSEEK { | 24 enum FX_STREAMSEEK { |
24 FX_STREAMSEEK_Begin = 0, | 25 FX_STREAMSEEK_Begin = 0, |
25 FX_STREAMSEEK_Current, | 26 FX_STREAMSEEK_Current, |
26 FX_STREAMSEEK_End, | 27 FX_STREAMSEEK_End, |
27 }; | 28 }; |
28 | 29 |
29 class IFGAS_Stream { | 30 class IFGAS_Stream { |
30 public: | 31 public: |
31 static IFGAS_Stream* CreateStream(IFX_SeekableReadStream* pFileRead, | 32 static IFGAS_Stream* CreateStream( |
32 uint32_t dwAccess); | 33 const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead, |
33 static IFGAS_Stream* CreateStream(IFX_SeekableWriteStream* pFileWrite, | 34 uint32_t dwAccess); |
34 uint32_t dwAccess); | 35 static IFGAS_Stream* CreateStream( |
| 36 const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite, |
| 37 uint32_t dwAccess); |
35 static IFGAS_Stream* CreateStream(uint8_t* pData, | 38 static IFGAS_Stream* CreateStream(uint8_t* pData, |
36 int32_t length, | 39 int32_t length, |
37 uint32_t dwAccess); | 40 uint32_t dwAccess); |
38 static IFGAS_Stream* CreateTextStream(IFGAS_Stream* pBaseStream, | 41 static IFGAS_Stream* CreateTextStream(IFGAS_Stream* pBaseStream, |
39 bool bDeleteOnRelease); | 42 bool bDeleteOnRelease); |
40 | 43 |
41 virtual ~IFGAS_Stream() {} | 44 virtual ~IFGAS_Stream() {} |
42 virtual void Release() = 0; | 45 virtual void Release() = 0; |
43 virtual IFGAS_Stream* Retain() = 0; | 46 virtual IFGAS_Stream* Retain() = 0; |
44 | 47 |
(...skipping 11 matching lines...) Expand all Loading... |
56 int32_t iMaxLength, | 59 int32_t iMaxLength, |
57 bool& bEOS) = 0; | 60 bool& bEOS) = 0; |
58 virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; | 61 virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) = 0; |
59 virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; | 62 virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) = 0; |
60 virtual void Flush() = 0; | 63 virtual void Flush() = 0; |
61 virtual bool SetLength(int32_t iLength) = 0; | 64 virtual bool SetLength(int32_t iLength) = 0; |
62 virtual int32_t GetBOM(uint8_t bom[4]) const = 0; | 65 virtual int32_t GetBOM(uint8_t bom[4]) const = 0; |
63 virtual uint16_t GetCodePage() const = 0; | 66 virtual uint16_t GetCodePage() const = 0; |
64 virtual uint16_t SetCodePage(uint16_t wCodePage) = 0; | 67 virtual uint16_t SetCodePage(uint16_t wCodePage) = 0; |
65 | 68 |
66 IFX_SeekableReadStream* MakeSeekableReadStream(); | 69 CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream(); |
67 }; | 70 }; |
68 | 71 |
69 | 72 |
70 #endif // XFA_FGAS_CRT_FGAS_STREAM_H_ | 73 #endif // XFA_FGAS_CRT_FGAS_STREAM_H_ |
OLD | NEW |