Lzma2Decoder.h revision baa3858d3f5d128a5c8466b700098109edcad5f2
1// Lzma2Decoder.h
2
3#ifndef __LZMA2_DECODER_H
4#define __LZMA2_DECODER_H
5
6#include "../../../C/Lzma2Dec.h"
7
8#include "../../Common/MyCom.h"
9
10#include "../ICoder.h"
11
12namespace NCompress {
13namespace NLzma2 {
14
15class CDecoder:
16  public ICompressCoder,
17  public ICompressSetDecoderProperties2,
18  public ICompressGetInStreamProcessedSize,
19  #ifndef NO_READ_FROM_CODER
20  public ICompressSetInStream,
21  public ICompressSetOutStreamSize,
22  public ISequentialInStream,
23  #endif
24  public CMyUnknownImp
25{
26  CMyComPtr<ISequentialInStream> _inStream;
27  Byte *_inBuf;
28  UInt32 _inPos;
29  UInt32 _inSize;
30  CLzma2Dec _state;
31  bool _outSizeDefined;
32  UInt64 _outSize;
33  UInt64 _inSizeProcessed;
34  UInt64 _outSizeProcessed;
35public:
36
37  #ifndef NO_READ_FROM_CODER
38  MY_UNKNOWN_IMP5(
39      ICompressSetDecoderProperties2,
40      ICompressGetInStreamProcessedSize,
41      ICompressSetInStream,
42      ICompressSetOutStreamSize,
43      ISequentialInStream)
44  #else
45  MY_UNKNOWN_IMP2(
46      ICompressSetDecoderProperties2,
47      ICompressGetInStreamProcessedSize)
48  #endif
49
50  STDMETHOD(Code)(ISequentialInStream *inStream,
51      ISequentialOutStream *outStream, const UInt64 *_inSize, const UInt64 *outSize,
52      ICompressProgressInfo *progress);
53
54  STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
55
56  STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
57
58  STDMETHOD(SetInStream)(ISequentialInStream *inStream);
59  STDMETHOD(ReleaseInStream)();
60  STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
61
62  #ifndef NO_READ_FROM_CODER
63  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
64  #endif
65
66  CDecoder();
67  virtual ~CDecoder();
68
69};
70
71}}
72
73#endif
74