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_string.h" | 10 #include "fx_string.h" |
11 | 11 |
12 void* FX_OpenFolder(const FX_CHAR* path); | 12 void* FX_OpenFolder(const FX_CHAR* path); |
13 void* FX_OpenFolder(const FX_WCHAR* path); | 13 void* FX_OpenFolder(const FX_WCHAR* path); |
14 FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder)
; | 14 FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder)
; |
15 FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder)
; | 15 FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder)
; |
16 void FX_CloseFolder(void* handle); | 16 void FX_CloseFolder(void* handle); |
17 FX_WCHAR FX_GetFolderSeparator(); | 17 FX_WCHAR FX_GetFolderSeparator(); |
18 typedef struct FX_HFILE_ { | |
19 void* pData; | |
20 }* FX_HFILE; | |
21 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 18 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
22 #define FX_FILESIZE int32_t | 19 #define FX_FILESIZE int32_t |
23 #else | 20 #else |
24 #include <fcntl.h> | 21 #include <fcntl.h> |
25 #include <unistd.h> | 22 #include <unistd.h> |
26 #include <sys/stat.h> | 23 #include <sys/stat.h> |
27 #ifndef O_BINARY | 24 #ifndef O_BINARY |
28 #define O_BINARY 0 | 25 #define O_BINARY 0 |
29 #endif | 26 #endif |
30 #ifndef O_LARGEFILE | 27 #ifndef O_LARGEFILE |
31 #define O_LARGEFILE 0 | 28 #define O_LARGEFILE 0 |
32 #endif | 29 #endif |
33 #define FX_FILESIZE off_t | 30 #define FX_FILESIZE off_t |
34 #endif | 31 #endif |
35 #define FX_GETBYTEOFFSET32(a) 0 | 32 #define FX_GETBYTEOFFSET32(a) 0 |
36 #define FX_GETBYTEOFFSET40(a) 0 | 33 #define FX_GETBYTEOFFSET40(a) 0 |
37 #define FX_GETBYTEOFFSET48(a) 0 | 34 #define FX_GETBYTEOFFSET48(a) 0 |
38 #define FX_GETBYTEOFFSET56(a) 0 | 35 #define FX_GETBYTEOFFSET56(a) 0 |
39 #define FX_GETBYTEOFFSET24(a) ((uint8_t)(a>>24)) | 36 #define FX_GETBYTEOFFSET24(a) ((uint8_t)(a>>24)) |
40 #define FX_GETBYTEOFFSET16(a) ((uint8_t)(a>>16)) | 37 #define FX_GETBYTEOFFSET16(a) ((uint8_t)(a>>16)) |
41 #define FX_GETBYTEOFFSET8(a) ((uint8_t)(a>>8)) | 38 #define FX_GETBYTEOFFSET8(a) ((uint8_t)(a>>8)) |
42 #define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) | 39 #define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) |
43 #define FX_FILEMODE_Write 0 | 40 #define FX_FILEMODE_Write 0 |
44 #define FX_FILEMODE_ReadOnly 1 | 41 #define FX_FILEMODE_ReadOnly 1 |
45 #define FX_FILEMODE_Truncate 2 | 42 #define FX_FILEMODE_Truncate 2 |
46 FX_HFILE FX_File_Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); | |
47 FX_HFILE FX_File_Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); | |
48 void FX_File_Close(FX_HFILE hFile); | |
49 FX_FILESIZE FX_File_GetSize(FX_HFILE hFile); | |
50 FX_FILESIZE FX_File_GetPosition(FX_HFILE hFile); | |
51 FX_FILESIZE FX_File_SetPosition(FX_HFILE hFile, FX_FILESIZE pos); | |
52 size_t FX_File_Read(FX_HFILE hFile, void* pBuffer, size_t szBuffer); | |
53 size_t FX_File_ReadPos(FX_HFILE hFile, void* pBuffer, size_t szBuffer,
FX_FILESIZE pos); | |
54 size_t FX_File_Write(FX_HFILE hFile, const void* pBuffer, size_t szBuff
er); | |
55 size_t FX_File_WritePos(FX_HFILE hFile, const void* pBuffer, size_t szB
uffer, FX_FILESIZE pos); | |
56 FX_BOOL FX_File_Flush(FX_HFILE hFile); | |
57 FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile); | |
58 FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName); | 43 FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName); |
59 FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName); | 44 FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName); |
60 FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName); | 45 FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName); |
61 FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName); | 46 FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName); |
62 FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteS
tringC& fileNameDst); | 47 FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteS
tringC& fileNameDst); |
63 FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideS
tringC& fileNameDst); | 48 FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideS
tringC& fileNameDst); |
64 FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteS
tringC& fileNameDst); | 49 FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteS
tringC& fileNameDst); |
65 FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideS
tringC& fileNameDst); | 50 FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideS
tringC& fileNameDst); |
66 class IFX_StreamWrite | 51 class IFX_StreamWrite |
67 { | 52 { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE)
= 0; | 188 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE)
= 0; |
204 | 189 |
205 virtual const uint8_t* GetBlockBuffer() = 0; | 190 virtual const uint8_t* GetBlockBuffer() = 0; |
206 | 191 |
207 virtual size_t GetBlockSize() = 0; | 192 virtual size_t GetBlockSize() = 0; |
208 | 193 |
209 virtual FX_FILESIZE GetBlockOffset() = 0; | 194 virtual FX_FILESIZE GetBlockOffset() = 0; |
210 }; | 195 }; |
211 | 196 |
212 #endif // CORE_INCLUDE_FXCRT_FX_STREAM_H_ | 197 #endif // CORE_INCLUDE_FXCRT_FX_STREAM_H_ |
OLD | NEW |