Mercurial > vba-clojure
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Common/InOutTempBuffer.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,55 @@ 1.4 +// Util/InOutTempBuffer.h 1.5 + 1.6 +#ifndef __IN_OUT_TEMP_BUFFER_H 1.7 +#define __IN_OUT_TEMP_BUFFER_H 1.8 + 1.9 +#include "../../Windows/FileIO.h" 1.10 +#include "../../Windows/FileDir.h" 1.11 +#include "../../Common/MyCom.h" 1.12 + 1.13 +#include "../IStream.h" 1.14 + 1.15 +class CInOutTempBuffer 1.16 +{ 1.17 + NWindows::NFile::NDirectory::CTempFile _tempFile; 1.18 + NWindows::NFile::NIO::COutFile _outFile; 1.19 + NWindows::NFile::NIO::CInFile _inFile; 1.20 + Byte *_buffer; 1.21 + UInt32 _bufferPosition; 1.22 + UInt32 _currentPositionInBuffer; 1.23 + CSysString _tmpFileName; 1.24 + bool _tmpFileCreated; 1.25 + 1.26 + UInt64 _fileSize; 1.27 + 1.28 + bool WriteToFile(const void *data, UInt32 size); 1.29 +public: 1.30 + CInOutTempBuffer(); 1.31 + ~CInOutTempBuffer(); 1.32 + void Create(); 1.33 + 1.34 + void InitWriting(); 1.35 + bool Write(const void *data, UInt32 size); 1.36 + UInt64 GetDataSize() const { return _fileSize; } 1.37 + bool FlushWrite(); 1.38 + bool InitReading(); 1.39 + HRESULT WriteToStream(ISequentialOutStream *stream); 1.40 +}; 1.41 + 1.42 +class CSequentialOutTempBufferImp: 1.43 + public ISequentialOutStream, 1.44 + public CMyUnknownImp 1.45 +{ 1.46 + CInOutTempBuffer *_buffer; 1.47 +public: 1.48 + // CSequentialOutStreamImp(): _size(0) {} 1.49 + // UInt32 _size; 1.50 + void Init(CInOutTempBuffer *buffer) { _buffer = buffer; } 1.51 + // UInt32 GetSize() const { return _size; } 1.52 + 1.53 + MY_UNKNOWN_IMP 1.54 + 1.55 + STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 1.56 +}; 1.57 + 1.58 +#endif