]>
Commit | Line | Data |
---|---|---|
30fdf114 | 1 | /* 7zFile.h -- File IO\r |
5ec5a236 | 2 | 2017-04-03 : Igor Pavlov : Public domain */\r |
30fdf114 LG |
3 | \r |
4 | #ifndef __7Z_FILE_H\r | |
5 | #define __7Z_FILE_H\r | |
6 | \r | |
7 | #ifdef _WIN32\r | |
8 | #define USE_WINDOWS_FILE\r | |
9 | #endif\r | |
10 | \r | |
11 | #ifdef USE_WINDOWS_FILE\r | |
12 | #include <windows.h>\r | |
13 | #else\r | |
14 | #include <stdio.h>\r | |
15 | #endif\r | |
16 | \r | |
c4ab09ef | 17 | #include "7zTypes.h"\r |
30fdf114 | 18 | \r |
c4ab09ef | 19 | EXTERN_C_BEGIN\r |
30fdf114 LG |
20 | \r |
21 | /* ---------- File ---------- */\r | |
22 | \r | |
23 | typedef struct\r | |
24 | {\r | |
25 | #ifdef USE_WINDOWS_FILE\r | |
26 | HANDLE handle;\r | |
27 | #else\r | |
28 | FILE *file;\r | |
29 | #endif\r | |
30 | } CSzFile;\r | |
31 | \r | |
32 | void File_Construct(CSzFile *p);\r | |
c4ab09ef | 33 | #if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)\r |
30fdf114 LG |
34 | WRes InFile_Open(CSzFile *p, const char *name);\r |
35 | WRes OutFile_Open(CSzFile *p, const char *name);\r | |
c4ab09ef LG |
36 | #endif\r |
37 | #ifdef USE_WINDOWS_FILE\r | |
38 | WRes InFile_OpenW(CSzFile *p, const WCHAR *name);\r | |
39 | WRes OutFile_OpenW(CSzFile *p, const WCHAR *name);\r | |
40 | #endif\r | |
30fdf114 LG |
41 | WRes File_Close(CSzFile *p);\r |
42 | \r | |
43 | /* reads max(*size, remain file's size) bytes */\r | |
44 | WRes File_Read(CSzFile *p, void *data, size_t *size);\r | |
45 | \r | |
46 | /* writes *size bytes */\r | |
47 | WRes File_Write(CSzFile *p, const void *data, size_t *size);\r | |
48 | \r | |
49 | WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);\r | |
50 | WRes File_GetLength(CSzFile *p, UInt64 *length);\r | |
51 | \r | |
52 | \r | |
53 | /* ---------- FileInStream ---------- */\r | |
54 | \r | |
55 | typedef struct\r | |
56 | {\r | |
5ec5a236 | 57 | ISeqInStream vt;\r |
30fdf114 LG |
58 | CSzFile file;\r |
59 | } CFileSeqInStream;\r | |
60 | \r | |
61 | void FileSeqInStream_CreateVTable(CFileSeqInStream *p);\r | |
62 | \r | |
63 | \r | |
64 | typedef struct\r | |
65 | {\r | |
5ec5a236 | 66 | ISeekInStream vt;\r |
30fdf114 LG |
67 | CSzFile file;\r |
68 | } CFileInStream;\r | |
69 | \r | |
70 | void FileInStream_CreateVTable(CFileInStream *p);\r | |
71 | \r | |
72 | \r | |
73 | typedef struct\r | |
74 | {\r | |
5ec5a236 | 75 | ISeqOutStream vt;\r |
30fdf114 LG |
76 | CSzFile file;\r |
77 | } CFileOutStream;\r | |
78 | \r | |
79 | void FileOutStream_CreateVTable(CFileOutStream *p);\r | |
80 | \r | |
c4ab09ef LG |
81 | EXTERN_C_END\r |
82 | \r | |
30fdf114 | 83 | #endif\r |