• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // InOutTempBuffer.h
2 
3 #ifndef ZIP7_INC_IN_OUT_TEMP_BUFFER_H
4 #define ZIP7_INC_IN_OUT_TEMP_BUFFER_H
5 
6 // #ifdef _WIN32
7 #define USE_InOutTempBuffer_FILE
8 // #endif
9 
10 #ifdef USE_InOutTempBuffer_FILE
11 #include "../../Windows/FileDir.h"
12 #endif
13 
14 #include "../IStream.h"
15 
16 class CInOutTempBuffer
17 {
18   UInt64 _size;
19   void **_bufs;
20   size_t _numBufs;
21   size_t _numFilled;
22 
23  #ifdef USE_InOutTempBuffer_FILE
24 
25   bool _tempFile_Created;
26   bool _useMemOnly;
27   UInt32 _crc;
28   // COutFile object must be declared after CTempFile object for correct destructor order
29   NWindows::NFile::NDir::CTempFile _tempFile;
30   NWindows::NFile::NIO::COutFile _outFile;
31 
32  #endif
33 
34   void *GetBuf(size_t index);
35 
36   Z7_CLASS_NO_COPY(CInOutTempBuffer)
37 public:
38   CInOutTempBuffer();
39   ~CInOutTempBuffer();
40   HRESULT Write_HRESULT(const void *data, UInt32 size);
41   HRESULT WriteToStream(ISequentialOutStream *stream);
GetDataSize()42   UInt64 GetDataSize() const { return _size; }
43 };
44 
45 #endif
46