Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: core/fxcrt/fx_stream.h

Issue 2443723002: Rename IFX_ stream names (Closed)
Patch Set: Nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxcrt/fx_extension.cpp ('k') | core/fxcrt/fx_xml.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CORE_FXCRT_FX_STREAM_H_ 7 #ifndef CORE_FXCRT_FX_STREAM_H_
8 #define CORE_FXCRT_FX_STREAM_H_ 8 #define CORE_FXCRT_FX_STREAM_H_
9 9
10 #include "core/fxcrt/fx_string.h" 10 #include "core/fxcrt/fx_string.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #define FX_GETBYTEOFFSET48(a) 0 48 #define FX_GETBYTEOFFSET48(a) 0
49 #define FX_GETBYTEOFFSET56(a) 0 49 #define FX_GETBYTEOFFSET56(a) 0
50 #define FX_GETBYTEOFFSET24(a) ((uint8_t)(a >> 24)) 50 #define FX_GETBYTEOFFSET24(a) ((uint8_t)(a >> 24))
51 #define FX_GETBYTEOFFSET16(a) ((uint8_t)(a >> 16)) 51 #define FX_GETBYTEOFFSET16(a) ((uint8_t)(a >> 16))
52 #define FX_GETBYTEOFFSET8(a) ((uint8_t)(a >> 8)) 52 #define FX_GETBYTEOFFSET8(a) ((uint8_t)(a >> 8))
53 #define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) 53 #define FX_GETBYTEOFFSET0(a) ((uint8_t)(a))
54 #define FX_FILEMODE_Write 0 54 #define FX_FILEMODE_Write 0
55 #define FX_FILEMODE_ReadOnly 1 55 #define FX_FILEMODE_ReadOnly 1
56 #define FX_FILEMODE_Truncate 2 56 #define FX_FILEMODE_Truncate 2
57 57
58 class IFX_StreamWrite { 58 class IFX_WriteStream {
59 public: 59 public:
60 virtual ~IFX_StreamWrite() {} 60 virtual ~IFX_WriteStream() {}
61 virtual void Release() = 0; 61 virtual void Release() = 0;
62 virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0; 62 virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0;
63 }; 63 };
64 64
65 class IFX_FileWrite : public IFX_StreamWrite { 65 class IFX_ReadStream {
66 public: 66 public:
67 // IFX_StreamWrite: 67 virtual ~IFX_ReadStream() {}
68
69 virtual void Release() = 0;
70 virtual FX_BOOL IsEOF() = 0;
71 virtual FX_FILESIZE GetPosition() = 0;
72 virtual size_t ReadBlock(void* buffer, size_t size) = 0;
73 };
74
75 class IFX_SeekableWriteStream : public IFX_WriteStream {
76 public:
77 // IFX_WriteStream:
68 FX_BOOL WriteBlock(const void* pData, size_t size) override; 78 FX_BOOL WriteBlock(const void* pData, size_t size) override;
69 virtual FX_FILESIZE GetSize() = 0; 79 virtual FX_FILESIZE GetSize() = 0;
70 virtual FX_BOOL Flush() = 0; 80 virtual FX_BOOL Flush() = 0;
71 virtual FX_BOOL WriteBlock(const void* pData, 81 virtual FX_BOOL WriteBlock(const void* pData,
72 FX_FILESIZE offset, 82 FX_FILESIZE offset,
73 size_t size) = 0; 83 size_t size) = 0;
74 }; 84 };
75 85
76 class IFX_StreamRead { 86 class IFX_SeekableReadStream : public IFX_ReadStream {
77 public: 87 public:
78 virtual ~IFX_StreamRead() {} 88 // IFX_ReadStream:
79
80 virtual void Release() = 0;
81 virtual FX_BOOL IsEOF() = 0;
82 virtual FX_FILESIZE GetPosition() = 0;
83 virtual size_t ReadBlock(void* buffer, size_t size) = 0;
84 };
85
86 class IFX_FileRead : public IFX_StreamRead {
87 public:
88 // IFX_StreamRead:
89 void Release() override = 0; 89 void Release() override = 0;
90 FX_BOOL IsEOF() override; 90 FX_BOOL IsEOF() override;
91 FX_FILESIZE GetPosition() override; 91 FX_FILESIZE GetPosition() override;
92 size_t ReadBlock(void* buffer, size_t size) override; 92 size_t ReadBlock(void* buffer, size_t size) override;
93 93
94 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0; 94 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
95 virtual FX_FILESIZE GetSize() = 0; 95 virtual FX_FILESIZE GetSize() = 0;
96 }; 96 };
97 97
98 IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename); 98 IFX_SeekableReadStream* FX_CreateFileRead(const FX_CHAR* filename);
99 IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename); 99 IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename);
100 100
101 class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { 101 class IFX_SeekableStream : public IFX_SeekableReadStream,
102 public IFX_SeekableWriteStream {
102 public: 103 public:
103 virtual IFX_FileStream* Retain() = 0; 104 virtual IFX_SeekableStream* Retain() = 0;
104 105
105 // IFX_FileRead: 106 // IFX_SeekableReadStream:
106 void Release() override = 0; 107 void Release() override = 0;
107 FX_BOOL IsEOF() override = 0; 108 FX_BOOL IsEOF() override = 0;
108 FX_FILESIZE GetPosition() override = 0; 109 FX_FILESIZE GetPosition() override = 0;
109 size_t ReadBlock(void* buffer, size_t size) override = 0; 110 size_t ReadBlock(void* buffer, size_t size) override = 0;
110 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0; 111 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0;
111 FX_FILESIZE GetSize() override = 0; 112 FX_FILESIZE GetSize() override = 0;
112 113
113 // IFX_FileWrite: 114 // IFX_SeekableWriteStream:
114 FX_BOOL WriteBlock(const void* buffer, 115 FX_BOOL WriteBlock(const void* buffer,
115 FX_FILESIZE offset, 116 FX_FILESIZE offset,
116 size_t size) override = 0; 117 size_t size) override = 0;
117 FX_BOOL WriteBlock(const void* buffer, size_t size) override; 118 FX_BOOL WriteBlock(const void* buffer, size_t size) override;
118 FX_BOOL Flush() override = 0; 119 FX_BOOL Flush() override = 0;
119 }; 120 };
120 121
121 IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, uint32_t dwModes); 122 IFX_SeekableStream* FX_CreateFileStream(const FX_CHAR* filename,
122 IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, uint32_t dwModes); 123 uint32_t dwModes);
124 IFX_SeekableStream* FX_CreateFileStream(const FX_WCHAR* filename,
125 uint32_t dwModes);
123 126
124 #ifdef PDF_ENABLE_XFA 127 #ifdef PDF_ENABLE_XFA
125 class IFX_FileAccess { 128 class IFX_FileAccess {
126 public: 129 public:
127 virtual ~IFX_FileAccess() {} 130 virtual ~IFX_FileAccess() {}
128 virtual void Release() = 0; 131 virtual void Release() = 0;
129 virtual IFX_FileAccess* Retain() = 0; 132 virtual IFX_FileAccess* Retain() = 0;
130 virtual void GetPath(CFX_WideString& wsPath) = 0; 133 virtual void GetPath(CFX_WideString& wsPath) = 0;
131 virtual IFX_FileStream* CreateFileStream(uint32_t dwModes) = 0; 134 virtual IFX_SeekableStream* CreateFileStream(uint32_t dwModes) = 0;
132 }; 135 };
133 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath); 136 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
134 #endif // PDF_ENABLE_XFA 137 #endif // PDF_ENABLE_XFA
135 138
136 class IFX_MemoryStream : public IFX_FileStream { 139 class IFX_MemoryStream : public IFX_SeekableStream {
137 public: 140 public:
138 virtual FX_BOOL IsConsecutive() const = 0; 141 virtual FX_BOOL IsConsecutive() const = 0;
139 virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0; 142 virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
140 virtual uint8_t* GetBuffer() const = 0; 143 virtual uint8_t* GetBuffer() const = 0;
141 virtual void AttachBuffer(uint8_t* pBuffer, 144 virtual void AttachBuffer(uint8_t* pBuffer,
142 size_t nSize, 145 size_t nSize,
143 FX_BOOL bTakeOver = FALSE) = 0; 146 FX_BOOL bTakeOver = FALSE) = 0;
144 virtual void DetachBuffer() = 0; 147 virtual void DetachBuffer() = 0;
145 }; 148 };
146 149
147 IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, 150 IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
148 size_t nSize, 151 size_t nSize,
149 FX_BOOL bTakeOver = FALSE); 152 FX_BOOL bTakeOver = FALSE);
150 IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE); 153 IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE);
151 154
152 class IFX_BufferRead : public IFX_StreamRead { 155 class IFX_BufferRead : public IFX_ReadStream {
153 public: 156 public:
154 // IFX_StreamRead: 157 // IFX_ReadStream:
155 void Release() override = 0; 158 void Release() override = 0;
156 FX_BOOL IsEOF() override = 0; 159 FX_BOOL IsEOF() override = 0;
157 FX_FILESIZE GetPosition() override = 0; 160 FX_FILESIZE GetPosition() override = 0;
158 size_t ReadBlock(void* buffer, size_t size) override = 0; 161 size_t ReadBlock(void* buffer, size_t size) override = 0;
159 162
160 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; 163 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0;
161 virtual const uint8_t* GetBlockBuffer() = 0; 164 virtual const uint8_t* GetBlockBuffer() = 0;
162 virtual size_t GetBlockSize() = 0; 165 virtual size_t GetBlockSize() = 0;
163 virtual FX_FILESIZE GetBlockOffset() = 0; 166 virtual FX_FILESIZE GetBlockOffset() = 0;
164 }; 167 };
(...skipping 13 matching lines...) Expand all
178 }; 181 };
179 182
180 class CFindFileDataW : public CFindFileData { 183 class CFindFileDataW : public CFindFileData {
181 public: 184 public:
182 ~CFindFileDataW() override {} 185 ~CFindFileDataW() override {}
183 WIN32_FIND_DATAW m_FindData; 186 WIN32_FIND_DATAW m_FindData;
184 }; 187 };
185 #endif 188 #endif
186 189
187 #endif // CORE_FXCRT_FX_STREAM_H_ 190 #endif // CORE_FXCRT_FX_STREAM_H_
OLDNEW
« no previous file with comments | « core/fxcrt/fx_extension.cpp ('k') | core/fxcrt/fx_xml.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698