annotate src/win32/7zip/7z/CPP/7zip/Common/InOutTempBuffer.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
rev   line source
rlm@1 1 // Util/InOutTempBuffer.h
rlm@1 2
rlm@1 3 #ifndef __IN_OUT_TEMP_BUFFER_H
rlm@1 4 #define __IN_OUT_TEMP_BUFFER_H
rlm@1 5
rlm@1 6 #include "../../Windows/FileIO.h"
rlm@1 7 #include "../../Windows/FileDir.h"
rlm@1 8 #include "../../Common/MyCom.h"
rlm@1 9
rlm@1 10 #include "../IStream.h"
rlm@1 11
rlm@1 12 class CInOutTempBuffer
rlm@1 13 {
rlm@1 14 NWindows::NFile::NDirectory::CTempFile _tempFile;
rlm@1 15 NWindows::NFile::NIO::COutFile _outFile;
rlm@1 16 NWindows::NFile::NIO::CInFile _inFile;
rlm@1 17 Byte *_buffer;
rlm@1 18 UInt32 _bufferPosition;
rlm@1 19 UInt32 _currentPositionInBuffer;
rlm@1 20 CSysString _tmpFileName;
rlm@1 21 bool _tmpFileCreated;
rlm@1 22
rlm@1 23 UInt64 _fileSize;
rlm@1 24
rlm@1 25 bool WriteToFile(const void *data, UInt32 size);
rlm@1 26 public:
rlm@1 27 CInOutTempBuffer();
rlm@1 28 ~CInOutTempBuffer();
rlm@1 29 void Create();
rlm@1 30
rlm@1 31 void InitWriting();
rlm@1 32 bool Write(const void *data, UInt32 size);
rlm@1 33 UInt64 GetDataSize() const { return _fileSize; }
rlm@1 34 bool FlushWrite();
rlm@1 35 bool InitReading();
rlm@1 36 HRESULT WriteToStream(ISequentialOutStream *stream);
rlm@1 37 };
rlm@1 38
rlm@1 39 class CSequentialOutTempBufferImp:
rlm@1 40 public ISequentialOutStream,
rlm@1 41 public CMyUnknownImp
rlm@1 42 {
rlm@1 43 CInOutTempBuffer *_buffer;
rlm@1 44 public:
rlm@1 45 // CSequentialOutStreamImp(): _size(0) {}
rlm@1 46 // UInt32 _size;
rlm@1 47 void Init(CInOutTempBuffer *buffer) { _buffer = buffer; }
rlm@1 48 // UInt32 GetSize() const { return _size; }
rlm@1 49
rlm@1 50 MY_UNKNOWN_IMP
rlm@1 51
rlm@1 52 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
rlm@1 53 };
rlm@1 54
rlm@1 55 #endif