1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/other-licenses/7zstub/src/7zip/Archive/Common/OutStreamWithCRC.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,33 @@ 1.4 +// OutStreamWithCRC.h 1.5 + 1.6 +#ifndef __OUTSTREAMWITHCRC_H 1.7 +#define __OUTSTREAMWITHCRC_H 1.8 + 1.9 +#include "../../../Common/CRC.h" 1.10 +#include "../../../Common/MyCom.h" 1.11 +#include "../../IStream.h" 1.12 + 1.13 +class COutStreamWithCRC: 1.14 + public ISequentialOutStream, 1.15 + public CMyUnknownImp 1.16 +{ 1.17 +public: 1.18 + MY_UNKNOWN_IMP 1.19 + 1.20 + STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 1.21 +private: 1.22 + CCRC _crc; 1.23 + CMyComPtr<ISequentialOutStream> _stream; 1.24 +public: 1.25 + void Init(ISequentialOutStream *stream) 1.26 + { 1.27 + _stream = stream; 1.28 + _crc.Init(); 1.29 + } 1.30 + void ReleaseStream() { _stream.Release(); } 1.31 + UInt32 GetCRC() const { return _crc.GetDigest(); } 1.32 + void InitCRC() { _crc.Init(); } 1.33 + 1.34 +}; 1.35 + 1.36 +#endif