Mercurial > vba-linux
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // OutStreamWithCRC.h | |
2 | |
3 #ifndef __OUT_STREAM_WITH_CRC_H | |
4 #define __OUT_STREAM_WITH_CRC_H | |
5 | |
6 #include "../../../Common/MyCom.h" | |
7 #include "../../IStream.h" | |
8 | |
9 extern "C" | |
10 { | |
11 #include "../../../../C/7zCrc.h" | |
12 } | |
13 | |
14 class COutStreamWithCRC: | |
15 public ISequentialOutStream, | |
16 public CMyUnknownImp | |
17 { | |
18 CMyComPtr<ISequentialOutStream> _stream; | |
19 UInt64 _size; | |
20 UInt32 _crc; | |
21 bool _calculate; | |
22 public: | |
23 MY_UNKNOWN_IMP | |
24 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); | |
25 void SetStream(ISequentialOutStream *stream) { _stream = stream; } | |
26 void ReleaseStream() { _stream.Release(); } | |
27 void Init(bool calculate = true) | |
28 { | |
29 _size = 0; | |
30 _calculate = calculate; | |
31 _crc = CRC_INIT_VAL; | |
32 } | |
33 void InitCRC() { _crc = CRC_INIT_VAL; } | |
34 UInt64 GetSize() const { return _size; } | |
35 UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); } | |
36 }; | |
37 | |
38 #endif |