|
1 // FileStreams.h |
|
2 |
|
3 #ifndef __FILESTREAMS_H |
|
4 #define __FILESTREAMS_H |
|
5 |
|
6 #ifdef _WIN32 |
|
7 #include "../../Windows/FileIO.h" |
|
8 #else |
|
9 #include "../../Common/C_FileIO.h" |
|
10 #endif |
|
11 |
|
12 #include "../IStream.h" |
|
13 #include "../../Common/MyCom.h" |
|
14 |
|
15 class CInFileStream: |
|
16 public IInStream, |
|
17 public IStreamGetSize, |
|
18 public CMyUnknownImp |
|
19 { |
|
20 public: |
|
21 #ifdef _WIN32 |
|
22 NWindows::NFile::NIO::CInFile File; |
|
23 #else |
|
24 NC::NFile::NIO::CInFile File; |
|
25 #endif |
|
26 CInFileStream() {} |
|
27 virtual ~CInFileStream() {} |
|
28 |
|
29 bool Open(LPCTSTR fileName); |
|
30 #ifdef _WIN32 |
|
31 #ifndef _UNICODE |
|
32 bool Open(LPCWSTR fileName); |
|
33 #endif |
|
34 #endif |
|
35 |
|
36 MY_UNKNOWN_IMP2(IInStream, IStreamGetSize) |
|
37 |
|
38 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); |
|
39 STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); |
|
40 |
|
41 STDMETHOD(GetSize)(UInt64 *size); |
|
42 }; |
|
43 |
|
44 #ifndef _WIN32_WCE |
|
45 class CStdInFileStream: |
|
46 public ISequentialInStream, |
|
47 public CMyUnknownImp |
|
48 { |
|
49 public: |
|
50 // HANDLE File; |
|
51 // CStdInFileStream() File(INVALID_HANDLE_VALUE): {} |
|
52 // void Open() { File = GetStdHandle(STD_INPUT_HANDLE); }; |
|
53 MY_UNKNOWN_IMP |
|
54 |
|
55 virtual ~CStdInFileStream() {} |
|
56 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); |
|
57 }; |
|
58 #endif |
|
59 |
|
60 class COutFileStream: |
|
61 public IOutStream, |
|
62 public CMyUnknownImp |
|
63 { |
|
64 public: |
|
65 #ifdef _WIN32 |
|
66 NWindows::NFile::NIO::COutFile File; |
|
67 #else |
|
68 NC::NFile::NIO::COutFile File; |
|
69 #endif |
|
70 virtual ~COutFileStream() {} |
|
71 bool Create(LPCTSTR fileName, bool createAlways); |
|
72 #ifdef _WIN32 |
|
73 #ifndef _UNICODE |
|
74 bool Create(LPCWSTR fileName, bool createAlways); |
|
75 #endif |
|
76 #endif |
|
77 |
|
78 MY_UNKNOWN_IMP1(IOutStream) |
|
79 |
|
80 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); |
|
81 STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); |
|
82 STDMETHOD(SetSize)(Int64 newSize); |
|
83 }; |
|
84 |
|
85 #ifndef _WIN32_WCE |
|
86 class CStdOutFileStream: |
|
87 public ISequentialOutStream, |
|
88 public CMyUnknownImp |
|
89 { |
|
90 public: |
|
91 MY_UNKNOWN_IMP |
|
92 |
|
93 virtual ~CStdOutFileStream() {} |
|
94 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); |
|
95 }; |
|
96 #endif |
|
97 |
|
98 #endif |