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

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

Issue 2450183003: Fix some FX_BOOL / int noise in fxcrt. (Closed)
Patch Set: moar 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_parser.cpp » ('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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_WriteStream { 58 class IFX_WriteStream {
59 public: 59 public:
60 virtual ~IFX_WriteStream() {} 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 bool WriteBlock(const void* pData, size_t size) = 0;
63 }; 63 };
64 64
65 class IFX_ReadStream { 65 class IFX_ReadStream {
66 public: 66 public:
67 virtual ~IFX_ReadStream() {} 67 virtual ~IFX_ReadStream() {}
68 68
69 virtual void Release() = 0; 69 virtual void Release() = 0;
70 virtual FX_BOOL IsEOF() = 0; 70 virtual bool IsEOF() = 0;
71 virtual FX_FILESIZE GetPosition() = 0; 71 virtual FX_FILESIZE GetPosition() = 0;
72 virtual size_t ReadBlock(void* buffer, size_t size) = 0; 72 virtual size_t ReadBlock(void* buffer, size_t size) = 0;
73 }; 73 };
74 74
75 class IFX_SeekableWriteStream : public IFX_WriteStream { 75 class IFX_SeekableWriteStream : public IFX_WriteStream {
76 public: 76 public:
77 // IFX_WriteStream: 77 // IFX_WriteStream:
78 FX_BOOL WriteBlock(const void* pData, size_t size) override; 78 bool WriteBlock(const void* pData, size_t size) override;
79 virtual FX_FILESIZE GetSize() = 0; 79 virtual FX_FILESIZE GetSize() = 0;
80 virtual FX_BOOL Flush() = 0; 80 virtual bool Flush() = 0;
81 virtual FX_BOOL WriteBlock(const void* pData, 81 virtual bool WriteBlock(const void* pData,
82 FX_FILESIZE offset, 82 FX_FILESIZE offset,
83 size_t size) = 0; 83 size_t size) = 0;
84 }; 84 };
85 85
86 class IFX_SeekableReadStream : public IFX_ReadStream { 86 class IFX_SeekableReadStream : public IFX_ReadStream {
87 public: 87 public:
88 // IFX_ReadStream: 88 // IFX_ReadStream:
89 void Release() override = 0; 89 void Release() override = 0;
90 FX_BOOL IsEOF() override; 90 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 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_SeekableReadStream* FX_CreateFileRead(const FX_CHAR* filename); 98 IFX_SeekableReadStream* FX_CreateFileRead(const FX_CHAR* filename);
99 IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename); 99 IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename);
100 100
101 class IFX_SeekableStream : public IFX_SeekableReadStream, 101 class IFX_SeekableStream : public IFX_SeekableReadStream,
102 public IFX_SeekableWriteStream { 102 public IFX_SeekableWriteStream {
103 public: 103 public:
104 virtual IFX_SeekableStream* Retain() = 0; 104 virtual IFX_SeekableStream* Retain() = 0;
105 105
106 // IFX_SeekableReadStream: 106 // IFX_SeekableReadStream:
107 void Release() override = 0; 107 void Release() override = 0;
108 FX_BOOL IsEOF() override = 0; 108 bool IsEOF() override = 0;
109 FX_FILESIZE GetPosition() override = 0; 109 FX_FILESIZE GetPosition() override = 0;
110 size_t ReadBlock(void* buffer, size_t size) override = 0; 110 size_t ReadBlock(void* buffer, size_t size) override = 0;
111 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0; 111 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0;
112 FX_FILESIZE GetSize() override = 0; 112 FX_FILESIZE GetSize() override = 0;
113 113
114 // IFX_SeekableWriteStream: 114 // IFX_SeekableWriteStream:
115 FX_BOOL WriteBlock(const void* buffer, 115 bool WriteBlock(const void* buffer,
116 FX_FILESIZE offset, 116 FX_FILESIZE offset,
117 size_t size) override = 0; 117 size_t size) override = 0;
118 FX_BOOL WriteBlock(const void* buffer, size_t size) override; 118 bool WriteBlock(const void* buffer, size_t size) override;
119 FX_BOOL Flush() override = 0; 119 bool Flush() override = 0;
120 }; 120 };
121 121
122 IFX_SeekableStream* FX_CreateFileStream(const FX_CHAR* filename, 122 IFX_SeekableStream* FX_CreateFileStream(const FX_CHAR* filename,
123 uint32_t dwModes); 123 uint32_t dwModes);
124 IFX_SeekableStream* FX_CreateFileStream(const FX_WCHAR* filename, 124 IFX_SeekableStream* FX_CreateFileStream(const FX_WCHAR* filename,
125 uint32_t dwModes); 125 uint32_t dwModes);
126 126
127 #ifdef PDF_ENABLE_XFA 127 #ifdef PDF_ENABLE_XFA
128 class IFX_FileAccess { 128 class IFX_FileAccess {
129 public: 129 public:
130 virtual ~IFX_FileAccess() {} 130 virtual ~IFX_FileAccess() {}
131 virtual void Release() = 0; 131 virtual void Release() = 0;
132 virtual IFX_FileAccess* Retain() = 0; 132 virtual IFX_FileAccess* Retain() = 0;
133 virtual void GetPath(CFX_WideString& wsPath) = 0; 133 virtual void GetPath(CFX_WideString& wsPath) = 0;
134 virtual IFX_SeekableStream* CreateFileStream(uint32_t dwModes) = 0; 134 virtual IFX_SeekableStream* CreateFileStream(uint32_t dwModes) = 0;
135 }; 135 };
136 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath); 136 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
137 #endif // PDF_ENABLE_XFA 137 #endif // PDF_ENABLE_XFA
138 138
139 class IFX_MemoryStream : public IFX_SeekableStream { 139 class IFX_MemoryStream : public IFX_SeekableStream {
140 public: 140 public:
141 virtual FX_BOOL IsConsecutive() const = 0; 141 virtual bool IsConsecutive() const = 0;
142 virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0; 142 virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
143 virtual uint8_t* GetBuffer() const = 0; 143 virtual uint8_t* GetBuffer() const = 0;
144 virtual void AttachBuffer(uint8_t* pBuffer, 144 virtual void AttachBuffer(uint8_t* pBuffer,
145 size_t nSize, 145 size_t nSize,
146 FX_BOOL bTakeOver = FALSE) = 0; 146 bool bTakeOver = FALSE) = 0;
147 virtual void DetachBuffer() = 0; 147 virtual void DetachBuffer() = 0;
148 }; 148 };
149 149
150 IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, 150 IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
151 size_t nSize, 151 size_t nSize,
152 FX_BOOL bTakeOver = FALSE); 152 bool bTakeOver = FALSE);
153 IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE); 153 IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive = FALSE);
154 154
155 class IFX_BufferRead : public IFX_ReadStream { 155 class IFX_BufferRead : public IFX_ReadStream {
156 public: 156 public:
157 // IFX_ReadStream: 157 // IFX_ReadStream:
158 void Release() override = 0; 158 void Release() override = 0;
159 FX_BOOL IsEOF() override = 0; 159 bool IsEOF() override = 0;
160 FX_FILESIZE GetPosition() override = 0; 160 FX_FILESIZE GetPosition() override = 0;
161 size_t ReadBlock(void* buffer, size_t size) override = 0; 161 size_t ReadBlock(void* buffer, size_t size) override = 0;
162 162
163 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; 163 virtual bool ReadNextBlock(bool bRestart = FALSE) = 0;
164 virtual const uint8_t* GetBlockBuffer() = 0; 164 virtual const uint8_t* GetBlockBuffer() = 0;
165 virtual size_t GetBlockSize() = 0; 165 virtual size_t GetBlockSize() = 0;
166 virtual FX_FILESIZE GetBlockOffset() = 0; 166 virtual FX_FILESIZE GetBlockOffset() = 0;
167 }; 167 };
168 168
169 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 169 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
170 class CFindFileData { 170 class CFindFileData {
171 public: 171 public:
172 virtual ~CFindFileData() {} 172 virtual ~CFindFileData() {}
173 HANDLE m_Handle; 173 HANDLE m_Handle;
174 bool m_bEnd; 174 bool m_bEnd;
175 }; 175 };
176 176
177 class CFindFileDataA : public CFindFileData { 177 class CFindFileDataA : public CFindFileData {
178 public: 178 public:
179 ~CFindFileDataA() override {} 179 ~CFindFileDataA() override {}
180 WIN32_FIND_DATAA m_FindData; 180 WIN32_FIND_DATAA m_FindData;
181 }; 181 };
182 182
183 class CFindFileDataW : public CFindFileData { 183 class CFindFileDataW : public CFindFileData {
184 public: 184 public:
185 ~CFindFileDataW() override {} 185 ~CFindFileDataW() override {}
186 WIN32_FIND_DATAW m_FindData; 186 WIN32_FIND_DATAW m_FindData;
187 }; 187 };
188 #endif 188 #endif
189 189
190 #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_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698