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_H_ | 7 #ifndef _FX_STREAM_H_ |
8 #define _FX_STREAM_H_ | 8 #define _FX_STREAM_H_ |
9 #ifndef _FX_MEMORY_H_ | 9 #ifndef _FX_MEMORY_H_ |
10 #include "fx_memory.h" | 10 #include "fx_memory.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 FX_BOOL FX_File_Exist(FX_WSTR fileName); | 58 FX_BOOL FX_File_Exist(FX_WSTR fileName); |
59 FX_BOOL FX_File_Delete(FX_BSTR fileName); | 59 FX_BOOL FX_File_Delete(FX_BSTR fileName); |
60 FX_BOOL FX_File_Delete(FX_WSTR fileName); | 60 FX_BOOL FX_File_Delete(FX_WSTR fileName); |
61 FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); | 61 FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); |
62 FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); | 62 FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); |
63 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); | 63 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); |
64 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); | 64 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); |
65 class IFX_StreamWrite | 65 class IFX_StreamWrite |
66 { | 66 { |
67 public: | 67 public: |
68 | 68 virtual ~IFX_StreamWrite() { } |
69 virtual void Release() = 0; | 69 virtual void Release() = 0; |
70 | 70 |
71 virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0; | 71 virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0; |
72 }; | 72 }; |
73 class IFX_FileWrite : public IFX_StreamWrite | 73 class IFX_FileWrite : public IFX_StreamWrite |
74 { | 74 { |
75 public: | 75 public: |
76 | 76 |
77 virtual void Release() = 0; | 77 virtual void Release() = 0; |
78 | 78 |
79 virtual FX_FILESIZE GetSize() = 0; | 79 virtual FX_FILESIZE GetSize() = 0; |
80 | 80 |
81 virtual FX_BOOL Flush() = 0; | 81 virtual FX_BOOL Flush() = 0; |
82 | 82 |
83 virtual FX_BOOL WriteBlock(const void* pData, FX_FILESIZ
E offset, size_t size) = 0; | 83 virtual FX_BOOL WriteBlock(const void* pData, FX_FILESIZ
E offset, size_t size) = 0; |
84 virtual FX_BOOL WriteBlock(const void* pData, size_t siz
e) | 84 virtual FX_BOOL WriteBlock(const void* pData, size_t siz
e) |
85 { | 85 { |
86 return WriteBlock(pData, GetSize(), size); | 86 return WriteBlock(pData, GetSize(), size); |
87 } | 87 } |
88 }; | 88 }; |
89 IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename); | 89 IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename); |
90 IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename); | 90 IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename); |
91 class IFX_StreamRead | 91 class IFX_StreamRead |
92 { | 92 { |
93 public: | 93 public: |
| 94 virtual ~IFX_StreamRead() { } |
94 | 95 |
95 virtual void Release() = 0; | 96 virtual void Release() = 0; |
96 | 97 |
97 virtual FX_BOOL IsEOF() = 0; | 98 virtual FX_BOOL IsEOF() = 0; |
98 | 99 |
99 virtual FX_FILESIZE GetPosition() = 0; | 100 virtual FX_FILESIZE GetPosition() = 0; |
100 | 101 |
101 virtual size_t ReadBlock(void* buffer, size_t size) = 0
; | 102 virtual size_t ReadBlock(void* buffer, size_t size) = 0
; |
102 }; | 103 }; |
103 class IFX_FileRead : IFX_StreamRead | 104 class IFX_FileRead : IFX_StreamRead |
104 { | 105 { |
105 public: | 106 public: |
106 | |
107 virtual void Release() = 0; | 107 virtual void Release() = 0; |
108 | 108 |
109 virtual FX_FILESIZE GetSize() = 0; | 109 virtual FX_FILESIZE GetSize() = 0; |
110 | 110 |
111 virtual FX_BOOL IsEOF() | 111 virtual FX_BOOL IsEOF() |
112 { | 112 { |
113 return FALSE; | 113 return FALSE; |
114 } | 114 } |
115 | 115 |
116 virtual FX_FILESIZE GetPosition() | 116 virtual FX_FILESIZE GetPosition() |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE)
= 0; | 202 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE)
= 0; |
203 | 203 |
204 virtual FX_LPCBYTE GetBlockBuffer() = 0; | 204 virtual FX_LPCBYTE GetBlockBuffer() = 0; |
205 | 205 |
206 virtual size_t GetBlockSize() = 0; | 206 virtual size_t GetBlockSize() = 0; |
207 | 207 |
208 virtual FX_FILESIZE GetBlockOffset() = 0; | 208 virtual FX_FILESIZE GetBlockOffset() = 0; |
209 }; | 209 }; |
210 #endif | 210 #endif |
OLD | NEW |