1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// InOutTempBuffer.h 2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __IN_OUT_TEMP_BUFFER_H 4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __IN_OUT_TEMP_BUFFER_H 5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Common/MyCom.h" 7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Windows/FileDir.h" 8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 9baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../IStream.h" 10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 11baa3858d3f5d128a5c8466b700098109edcad5f2repo syncclass CInOutTempBuffer 12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 13cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky NWindows::NFile::NDir::CTempFile _tempFile; 14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync NWindows::NFile::NIO::COutFile _outFile; 15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync Byte *_buf; 16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 _bufPos; 17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool _tempFileCreated; 18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt64 _size; 19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 _crc; 20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool WriteToFile(const void *data, UInt32 size); 22baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic: 23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CInOutTempBuffer(); 24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ~CInOutTempBuffer(); 25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync void Create(); 26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync void InitWriting(); 28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool Write(const void *data, UInt32 size); 29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync HRESULT WriteToStream(ISequentialOutStream *stream); 31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt64 GetDataSize() const { return _size; } 32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}; 33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 34baa3858d3f5d128a5c8466b700098109edcad5f2repo syncclass CSequentialOutTempBufferImp: 35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync public ISequentialOutStream, 36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync public CMyUnknownImp 37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CInOutTempBuffer *_buf; 39baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic: 40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync void Init(CInOutTempBuffer *buffer) { _buf = buffer; } 41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync MY_UNKNOWN_IMP 42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}; 45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 47