xref: /aosp_15_r20/external/lzma/CPP/7zip/Compress/LzfseDecoder.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // LzfseDecoder.h
2 
3 #ifndef ZIP7_INC_LZFSE_DECODER_H
4 #define ZIP7_INC_LZFSE_DECODER_H
5 
6 #include "../../Common/MyBuffer.h"
7 #include "../../Common/MyCom.h"
8 
9 #include "../ICoder.h"
10 
11 #include "../Common/InBuffer.h"
12 
13 #include "LzOutWindow.h"
14 
15 namespace NCompress {
16 namespace NLzfse {
17 
18 Z7_CLASS_IMP_NOQIB_1(
19   CDecoder
20   , ICompressCoder
21 )
22   CLzOutWindow m_OutWindowStream;
23   CInBuffer m_InStream;
24   CByteBuffer _literals;
25   CByteBuffer _buffer;
26 
27   class CCoderReleaser
28   {
29     CDecoder *m_Coder;
30   public:
31     bool NeedFlush;
CCoderReleaser(CDecoder * coder)32     CCoderReleaser(CDecoder *coder): m_Coder(coder), NeedFlush(true) {}
~CCoderReleaser()33     ~CCoderReleaser()
34     {
35       if (NeedFlush)
36         m_Coder->m_OutWindowStream.Flush();
37     }
38   };
39   friend class CCoderReleaser;
40 
41   HRESULT GetUInt32(UInt32 &val);
42 
43   HRESULT DecodeUncompressed(UInt32 unpackSize);
44   HRESULT DecodeLzvn(UInt32 unpackSize, UInt32 packSize);
45   HRESULT DecodeLzfse(UInt32 unpackSize, Byte version);
46 
47   HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
48       const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
49 public:
50   bool LzvnMode;
51 
CDecoder()52   CDecoder():
53     LzvnMode(false)
54     {}
55 
56   // sizes are checked in Code()
57   // UInt64 GetInputProcessedSize() const { return m_InStream.GetProcessedSize(); }
58   // UInt64 GetOutputProcessedSize() const { return m_OutWindowStream.GetProcessedSize(); }
59 };
60 
61 }}
62 
63 #endif
64