1// OutStreamWithCRC.h 2 3#ifndef ZIP7_INC_OUT_STREAM_WITH_CRC_H 4#define ZIP7_INC_OUT_STREAM_WITH_CRC_H 5 6#include "../../../../C/7zCrc.h" 7 8#include "../../../Common/MyCom.h" 9 10#include "../../IStream.h" 11 12Z7_CLASS_IMP_NOQIB_1( 13 COutStreamWithCRC 14 , ISequentialOutStream 15) 16 CMyComPtr<ISequentialOutStream> _stream; 17 UInt64 _size; 18 UInt32 _crc; 19 bool _calculate; 20public: 21 void SetStream(ISequentialOutStream *stream) { _stream = stream; } 22 void ReleaseStream() { _stream.Release(); } 23 void Init(bool calculate = true) 24 { 25 _size = 0; 26 _calculate = calculate; 27 _crc = CRC_INIT_VAL; 28 } 29 void EnableCalc(bool calculate) { _calculate = calculate; } 30 void InitCRC() { _crc = CRC_INIT_VAL; } 31 UInt64 GetSize() const { return _size; } 32 UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); } 33}; 34 35#endif 36