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