1 // LzmaEncoder.h
2 
3 #ifndef __LZMA_ENCODER_H
4 #define __LZMA_ENCODER_H
5 
6 #include "../../../C/LzmaEnc.h"
7 
8 #include "../../Common/MyCom.h"
9 
10 #include "../ICoder.h"
11 
12 namespace NCompress {
13 namespace NLzma {
14 
15 class CEncoder:
16   public ICompressCoder,
17   public ICompressSetCoderProperties,
18   public ICompressWriteCoderProperties,
19   public ICompressSetCoderPropertiesOpt,
20   public CMyUnknownImp
21 {
22   CLzmaEncHandle _encoder;
23   UInt64 _inputProcessed;
24 public:
25   MY_UNKNOWN_IMP4(
26       ICompressCoder,
27       ICompressSetCoderProperties,
28       ICompressWriteCoderProperties,
29       ICompressSetCoderPropertiesOpt)
30 
31   STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
32       const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
33   STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
34   STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
35   STDMETHOD(SetCoderPropertiesOpt)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
36 
37   CEncoder();
38   virtual ~CEncoder();
39 
GetInputProcessedSize()40   UInt64 GetInputProcessedSize() const { return _inputProcessed; }
IsWriteEndMark()41   bool IsWriteEndMark() const { return LzmaEnc_IsWriteEndMark(_encoder) != 0; }
42 };
43 
44 }}
45 
46 #endif
47