Mercurial > vba-linux
diff src/win32/7zip/7z/CPP/7zip/Archive/Common/OutStreamWithCRC.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/Archive/Common/OutStreamWithCRC.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,38 @@ 1.4 +// OutStreamWithCRC.h 1.5 + 1.6 +#ifndef __OUT_STREAM_WITH_CRC_H 1.7 +#define __OUT_STREAM_WITH_CRC_H 1.8 + 1.9 +#include "../../../Common/MyCom.h" 1.10 +#include "../../IStream.h" 1.11 + 1.12 +extern "C" 1.13 +{ 1.14 +#include "../../../../C/7zCrc.h" 1.15 +} 1.16 + 1.17 +class COutStreamWithCRC: 1.18 + public ISequentialOutStream, 1.19 + public CMyUnknownImp 1.20 +{ 1.21 + CMyComPtr<ISequentialOutStream> _stream; 1.22 + UInt64 _size; 1.23 + UInt32 _crc; 1.24 + bool _calculate; 1.25 +public: 1.26 + MY_UNKNOWN_IMP 1.27 + STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 1.28 + void SetStream(ISequentialOutStream *stream) { _stream = stream; } 1.29 + void ReleaseStream() { _stream.Release(); } 1.30 + void Init(bool calculate = true) 1.31 + { 1.32 + _size = 0; 1.33 + _calculate = calculate; 1.34 + _crc = CRC_INIT_VAL; 1.35 + } 1.36 + void InitCRC() { _crc = CRC_INIT_VAL; } 1.37 + UInt64 GetSize() const { return _size; } 1.38 + UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); } 1.39 +}; 1.40 + 1.41 +#endif