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 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" |
11 #include "core/fxcrt/fx_system.h" | 11 #include "core/fxcrt/fx_system.h" |
12 | 12 |
13 void* FX_OpenFolder(const FX_CHAR* path); | 13 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
14 void* FX_OpenFolder(const FX_WCHAR* path); | 14 #include <dirent.h> |
15 FX_BOOL FX_GetNextFile(void* handle, | 15 #include <sys/types.h> |
16 CFX_ByteString& filename, | 16 #else |
17 FX_BOOL& bFolder); | 17 #include <direct.h> |
18 FX_BOOL FX_GetNextFile(void* handle, | 18 #endif |
19 CFX_WideString& filename, | 19 |
20 FX_BOOL& bFolder); | 20 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
21 void FX_CloseFolder(void* handle); | 21 class CFindFileDataA; |
22 | |
23 typedef CFindFileDataA FX_FileHandle; | |
24 #else | |
25 typedef DIR FX_FileHandle; | |
dsinclair
2016/10/13 13:45:47
Can this if/else move into the if/else above?
npm
2016/10/13 17:49:01
Done.
| |
26 #endif | |
27 | |
28 FX_FileHandle* FX_OpenFolder(const FX_CHAR* path); | |
29 bool FX_GetNextFile(FX_FileHandle* handle, | |
30 CFX_ByteString* filename, | |
31 bool* bFolder); | |
32 void FX_CloseFolder(FX_FileHandle* handle); | |
22 FX_WCHAR FX_GetFolderSeparator(); | 33 FX_WCHAR FX_GetFolderSeparator(); |
23 | 34 |
24 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 35 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
dsinclair
2016/10/13 13:45:47
Combine with this as well?
npm
2016/10/13 17:49:01
Done.
| |
25 #define FX_FILESIZE int32_t | 36 #define FX_FILESIZE int32_t |
26 #else | 37 #else |
27 #include <fcntl.h> | 38 #include <fcntl.h> |
28 #include <sys/stat.h> | 39 #include <sys/stat.h> |
29 #include <unistd.h> | 40 #include <unistd.h> |
30 | 41 |
31 #ifndef O_BINARY | 42 #ifndef O_BINARY |
32 #define O_BINARY 0 | 43 #define O_BINARY 0 |
33 #endif // O_BINARY | 44 #endif // O_BINARY |
34 | 45 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 FX_BOOL IsEOF() override = 0; | 163 FX_BOOL IsEOF() override = 0; |
153 FX_FILESIZE GetPosition() override = 0; | 164 FX_FILESIZE GetPosition() override = 0; |
154 size_t ReadBlock(void* buffer, size_t size) override = 0; | 165 size_t ReadBlock(void* buffer, size_t size) override = 0; |
155 | 166 |
156 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; | 167 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; |
157 virtual const uint8_t* GetBlockBuffer() = 0; | 168 virtual const uint8_t* GetBlockBuffer() = 0; |
158 virtual size_t GetBlockSize() = 0; | 169 virtual size_t GetBlockSize() = 0; |
159 virtual FX_FILESIZE GetBlockOffset() = 0; | 170 virtual FX_FILESIZE GetBlockOffset() = 0; |
160 }; | 171 }; |
161 | 172 |
173 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | |
174 class CFindFileData { | |
175 public: | |
176 virtual ~CFindFileData() {} | |
177 HANDLE m_Handle; | |
178 bool m_bEnd; | |
179 }; | |
180 | |
181 class CFindFileDataA : public CFindFileData { | |
182 public: | |
183 ~CFindFileDataA() override {} | |
184 WIN32_FIND_DATAA m_FindData; | |
185 }; | |
186 | |
187 class CFindFileDataW : public CFindFileData { | |
188 public: | |
189 ~CFindFileDataW() override {} | |
190 WIN32_FIND_DATAW m_FindData; | |
191 }; | |
192 #endif | |
193 | |
162 #endif // CORE_FXCRT_FX_STREAM_H_ | 194 #endif // CORE_FXCRT_FX_STREAM_H_ |
OLD | NEW |