1370b324cSopenharmony_ci// InOutTempBuffer.h 2370b324cSopenharmony_ci 3370b324cSopenharmony_ci#ifndef ZIP7_INC_IN_OUT_TEMP_BUFFER_H 4370b324cSopenharmony_ci#define ZIP7_INC_IN_OUT_TEMP_BUFFER_H 5370b324cSopenharmony_ci 6370b324cSopenharmony_ci// #ifdef _WIN32 7370b324cSopenharmony_ci#define USE_InOutTempBuffer_FILE 8370b324cSopenharmony_ci// #endif 9370b324cSopenharmony_ci 10370b324cSopenharmony_ci#ifdef USE_InOutTempBuffer_FILE 11370b324cSopenharmony_ci#include "../../Windows/FileDir.h" 12370b324cSopenharmony_ci#endif 13370b324cSopenharmony_ci 14370b324cSopenharmony_ci#include "../IStream.h" 15370b324cSopenharmony_ci 16370b324cSopenharmony_ciclass CInOutTempBuffer 17370b324cSopenharmony_ci{ 18370b324cSopenharmony_ci UInt64 _size; 19370b324cSopenharmony_ci void **_bufs; 20370b324cSopenharmony_ci size_t _numBufs; 21370b324cSopenharmony_ci size_t _numFilled; 22370b324cSopenharmony_ci 23370b324cSopenharmony_ci #ifdef USE_InOutTempBuffer_FILE 24370b324cSopenharmony_ci 25370b324cSopenharmony_ci bool _tempFile_Created; 26370b324cSopenharmony_ci bool _useMemOnly; 27370b324cSopenharmony_ci UInt32 _crc; 28370b324cSopenharmony_ci // COutFile object must be declared after CTempFile object for correct destructor order 29370b324cSopenharmony_ci NWindows::NFile::NDir::CTempFile _tempFile; 30370b324cSopenharmony_ci NWindows::NFile::NIO::COutFile _outFile; 31370b324cSopenharmony_ci 32370b324cSopenharmony_ci #endif 33370b324cSopenharmony_ci 34370b324cSopenharmony_ci void *GetBuf(size_t index); 35370b324cSopenharmony_ci 36370b324cSopenharmony_ci Z7_CLASS_NO_COPY(CInOutTempBuffer) 37370b324cSopenharmony_cipublic: 38370b324cSopenharmony_ci CInOutTempBuffer(); 39370b324cSopenharmony_ci ~CInOutTempBuffer(); 40370b324cSopenharmony_ci HRESULT Write_HRESULT(const void *data, UInt32 size); 41370b324cSopenharmony_ci HRESULT WriteToStream(ISequentialOutStream *stream); 42370b324cSopenharmony_ci UInt64 GetDataSize() const { return _size; } 43370b324cSopenharmony_ci}; 44370b324cSopenharmony_ci 45370b324cSopenharmony_ci#endif 46