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_INCLUDE_FXCRT_FX_STREAM_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_STREAM_H_ |
8 #define CORE_INCLUDE_FXCRT_FX_STREAM_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_STREAM_H_ |
9 | 9 |
10 #include "fx_memory.h" | 10 #include "fx_memory.h" |
11 #include "fx_string.h" | 11 #include "fx_string.h" |
12 | 12 |
13 void* FX_OpenFolder(FX_LPCSTR path); | 13 void* FX_OpenFolder(FX_LPCSTR path); |
14 void* FX_OpenFolder(FX_LPCWSTR path); | 14 void* FX_OpenFolder(FX_LPCWSTR path); |
15 FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder)
; | 15 FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder)
; |
16 FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder)
; | 16 FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder)
; |
17 void FX_CloseFolder(void* handle); | 17 void FX_CloseFolder(void* handle); |
18 FX_WCHAR FX_GetFolderSeparator(); | 18 FX_WCHAR FX_GetFolderSeparator(); |
19 typedef struct FX_HFILE_ { | 19 typedef struct FX_HFILE_ { |
20 FX_LPVOID pData; | 20 FX_LPVOID pData; |
21 }* FX_HFILE; | 21 }* FX_HFILE; |
22 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 22 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
23 #define FX_FILESIZE» » » FX_INT32 | 23 #define FX_FILESIZE» » » int32_t |
24 #else | 24 #else |
25 #include <fcntl.h> | 25 #include <fcntl.h> |
26 #include <unistd.h> | 26 #include <unistd.h> |
27 #include <sys/stat.h> | 27 #include <sys/stat.h> |
28 #ifndef O_BINARY | 28 #ifndef O_BINARY |
29 #define O_BINARY 0 | 29 #define O_BINARY 0 |
30 #endif | 30 #endif |
31 #ifndef O_LARGEFILE | 31 #ifndef O_LARGEFILE |
32 #define O_LARGEFILE 0 | 32 #define O_LARGEFILE 0 |
33 #endif | 33 #endif |
34 #define FX_FILESIZE off_t | 34 #define FX_FILESIZE off_t |
35 #endif | 35 #endif |
36 #define FX_GETBYTEOFFSET32(a) 0 | 36 #define FX_GETBYTEOFFSET32(a) 0 |
37 #define FX_GETBYTEOFFSET40(a) 0 | 37 #define FX_GETBYTEOFFSET40(a) 0 |
38 #define FX_GETBYTEOFFSET48(a) 0 | 38 #define FX_GETBYTEOFFSET48(a) 0 |
39 #define FX_GETBYTEOFFSET56(a) 0 | 39 #define FX_GETBYTEOFFSET56(a) 0 |
40 #define FX_GETBYTEOFFSET24(a) ((FX_BYTE)(a>>24)) | 40 #define FX_GETBYTEOFFSET24(a) ((uint8_t)(a>>24)) |
41 #define FX_GETBYTEOFFSET16(a) ((FX_BYTE)(a>>16)) | 41 #define FX_GETBYTEOFFSET16(a) ((uint8_t)(a>>16)) |
42 #define FX_GETBYTEOFFSET8(a) ((FX_BYTE)(a>>8)) | 42 #define FX_GETBYTEOFFSET8(a) ((uint8_t)(a>>8)) |
43 #define FX_GETBYTEOFFSET0(a) ((FX_BYTE)(a)) | 43 #define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) |
44 #define FX_FILEMODE_Write 0 | 44 #define FX_FILEMODE_Write 0 |
45 #define FX_FILEMODE_ReadOnly 1 | 45 #define FX_FILEMODE_ReadOnly 1 |
46 #define FX_FILEMODE_Truncate 2 | 46 #define FX_FILEMODE_Truncate 2 |
47 FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode); | 47 FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode); |
48 FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode); | 48 FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode); |
49 void FX_File_Close(FX_HFILE hFile); | 49 void FX_File_Close(FX_HFILE hFile); |
50 FX_FILESIZE FX_File_GetSize(FX_HFILE hFile); | 50 FX_FILESIZE FX_File_GetSize(FX_HFILE hFile); |
51 FX_FILESIZE FX_File_GetPosition(FX_HFILE hFile); | 51 FX_FILESIZE FX_File_GetPosition(FX_HFILE hFile); |
52 FX_FILESIZE FX_File_SetPosition(FX_HFILE hFile, FX_FILESIZE pos); | 52 FX_FILESIZE FX_File_SetPosition(FX_HFILE hFile, FX_FILESIZE pos); |
53 size_t FX_File_Read(FX_HFILE hFile, void* pBuffer, size_t szBuffer); | 53 size_t FX_File_Read(FX_HFILE hFile, void* pBuffer, size_t szBuffer); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE)
= 0; | 204 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE)
= 0; |
205 | 205 |
206 virtual FX_LPCBYTE GetBlockBuffer() = 0; | 206 virtual FX_LPCBYTE GetBlockBuffer() = 0; |
207 | 207 |
208 virtual size_t GetBlockSize() = 0; | 208 virtual size_t GetBlockSize() = 0; |
209 | 209 |
210 virtual FX_FILESIZE GetBlockOffset() = 0; | 210 virtual FX_FILESIZE GetBlockOffset() = 0; |
211 }; | 211 }; |
212 | 212 |
213 #endif // CORE_INCLUDE_FXCRT_FX_STREAM_H_ | 213 #endif // CORE_INCLUDE_FXCRT_FX_STREAM_H_ |
OLD | NEW |