Coverage Report

Created: 2025-07-14 06:14

/src/qpdf/libqpdf/qpdf/SF_FlateLzwDecode.hh
Line
Count
Source (jump to first uncovered line)
1
#include <qpdf/QPDFStreamFilter.hh>
2
#include <memory>
3
#include <vector>
4
5
#ifndef SF_FLATELZWDECODE_HH
6
# define SF_FLATELZWDECODE_HH
7
8
class SF_FlateLzwDecode final: public QPDFStreamFilter
9
{
10
  public:
11
    SF_FlateLzwDecode(bool lzw) :
12
0
        lzw(lzw)
13
0
    {
14
0
    }
15
0
    ~SF_FlateLzwDecode() final = default;
16
17
    bool setDecodeParms(QPDFObjectHandle decode_parms) final;
18
    Pipeline* getDecodePipeline(Pipeline* next) final;
19
20
    static std::shared_ptr<QPDFStreamFilter>
21
    flate_factory()
22
0
    {
23
0
        return std::make_shared<SF_FlateLzwDecode>(false);
24
0
    }
25
    static std::shared_ptr<QPDFStreamFilter>
26
    lzw_factory()
27
0
    {
28
0
        return std::make_shared<SF_FlateLzwDecode>(true);
29
0
    }
30
31
  private:
32
    bool lzw{};
33
    // Defaults as per the PDF spec
34
    int predictor{1};
35
    int columns{1};
36
    int colors{1};
37
    int bits_per_component{8};
38
    bool early_code_change{true};
39
    std::vector<std::unique_ptr<Pipeline>> pipelines;
40
};
41
42
#endif // SF_FLATELZWDECODE_HH