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

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

Issue 2419433004: Clean up fx_basic_util a little (Closed)
Patch Set: Comments Created 4 years, 2 months 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_basic_util.cpp ('k') | core/fxge/android/fpf_skiafontmgr.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"
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 <direct.h>
15 FX_BOOL FX_GetNextFile(void* handle,
16 CFX_ByteString& filename,
17 FX_BOOL& bFolder);
18 FX_BOOL FX_GetNextFile(void* handle,
19 CFX_WideString& filename,
20 FX_BOOL& bFolder);
21 void FX_CloseFolder(void* handle);
22 FX_WCHAR FX_GetFolderSeparator();
23 15
24 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 16 class CFindFileDataA;
17
18 typedef CFindFileDataA FX_FileHandle;
25 #define FX_FILESIZE int32_t 19 #define FX_FILESIZE int32_t
26 #else 20 #else
21 #include <dirent.h>
27 #include <fcntl.h> 22 #include <fcntl.h>
28 #include <sys/stat.h> 23 #include <sys/stat.h>
24 #include <sys/types.h>
29 #include <unistd.h> 25 #include <unistd.h>
30 26
31 #ifndef O_BINARY 27 #ifndef O_BINARY
32 #define O_BINARY 0 28 #define O_BINARY 0
33 #endif // O_BINARY 29 #endif // O_BINARY
34 30
35 #ifndef O_LARGEFILE 31 #ifndef O_LARGEFILE
36 #define O_LARGEFILE 0 32 #define O_LARGEFILE 0
37 #endif // O_LARGEFILE 33 #endif // O_LARGEFILE
38 34
35 typedef DIR FX_FileHandle;
39 #define FX_FILESIZE off_t 36 #define FX_FILESIZE off_t
40 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 37 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
41 38
39 FX_FileHandle* FX_OpenFolder(const FX_CHAR* path);
40 bool FX_GetNextFile(FX_FileHandle* handle,
41 CFX_ByteString* filename,
42 bool* bFolder);
43 void FX_CloseFolder(FX_FileHandle* handle);
44 FX_WCHAR FX_GetFolderSeparator();
45
42 #define FX_GETBYTEOFFSET32(a) 0 46 #define FX_GETBYTEOFFSET32(a) 0
43 #define FX_GETBYTEOFFSET40(a) 0 47 #define FX_GETBYTEOFFSET40(a) 0
44 #define FX_GETBYTEOFFSET48(a) 0 48 #define FX_GETBYTEOFFSET48(a) 0
45 #define FX_GETBYTEOFFSET56(a) 0 49 #define FX_GETBYTEOFFSET56(a) 0
46 #define FX_GETBYTEOFFSET24(a) ((uint8_t)(a >> 24)) 50 #define FX_GETBYTEOFFSET24(a) ((uint8_t)(a >> 24))
47 #define FX_GETBYTEOFFSET16(a) ((uint8_t)(a >> 16)) 51 #define FX_GETBYTEOFFSET16(a) ((uint8_t)(a >> 16))
48 #define FX_GETBYTEOFFSET8(a) ((uint8_t)(a >> 8)) 52 #define FX_GETBYTEOFFSET8(a) ((uint8_t)(a >> 8))
49 #define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) 53 #define FX_GETBYTEOFFSET0(a) ((uint8_t)(a))
50 #define FX_FILEMODE_Write 0 54 #define FX_FILEMODE_Write 0
51 #define FX_FILEMODE_ReadOnly 1 55 #define FX_FILEMODE_ReadOnly 1
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 FX_BOOL IsEOF() override = 0; 156 FX_BOOL IsEOF() override = 0;
153 FX_FILESIZE GetPosition() override = 0; 157 FX_FILESIZE GetPosition() override = 0;
154 size_t ReadBlock(void* buffer, size_t size) override = 0; 158 size_t ReadBlock(void* buffer, size_t size) override = 0;
155 159
156 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; 160 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0;
157 virtual const uint8_t* GetBlockBuffer() = 0; 161 virtual const uint8_t* GetBlockBuffer() = 0;
158 virtual size_t GetBlockSize() = 0; 162 virtual size_t GetBlockSize() = 0;
159 virtual FX_FILESIZE GetBlockOffset() = 0; 163 virtual FX_FILESIZE GetBlockOffset() = 0;
160 }; 164 };
161 165
166 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
167 class CFindFileData {
168 public:
169 virtual ~CFindFileData() {}
170 HANDLE m_Handle;
171 bool m_bEnd;
172 };
173
174 class CFindFileDataA : public CFindFileData {
175 public:
176 ~CFindFileDataA() override {}
177 WIN32_FIND_DATAA m_FindData;
178 };
179
180 class CFindFileDataW : public CFindFileData {
181 public:
182 ~CFindFileDataW() override {}
183 WIN32_FIND_DATAW m_FindData;
184 };
185 #endif
186
162 #endif // CORE_FXCRT_FX_STREAM_H_ 187 #endif // CORE_FXCRT_FX_STREAM_H_
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_util.cpp ('k') | core/fxge/android/fpf_skiafontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698