1 | /* This file is part of the KDE libraries |
2 | SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #ifndef __kbzip2filter__h |
8 | #define __kbzip2filter__h |
9 | |
10 | #include <config-compression.h> |
11 | |
12 | #if HAVE_BZIP2_SUPPORT |
13 | |
14 | #include "kfilterbase.h" |
15 | |
16 | /** |
17 | * Internal class used by KCompressionDevice |
18 | * @internal |
19 | */ |
20 | class KBzip2Filter : public KFilterBase |
21 | { |
22 | public: |
23 | KBzip2Filter(); |
24 | ~KBzip2Filter() override; |
25 | |
26 | bool init(int) override; |
27 | int mode() const override; |
28 | bool terminate() override; |
29 | void reset() override; |
30 | bool () override |
31 | { |
32 | return true; // bzip2 handles it by itself ! Cool ! |
33 | } |
34 | bool (const QByteArray &) override |
35 | { |
36 | return true; |
37 | } |
38 | void setOutBuffer(char *data, uint maxlen) override; |
39 | void setInBuffer(const char *data, uint size) override; |
40 | int inBufferAvailable() const override; |
41 | int outBufferAvailable() const override; |
42 | Result uncompress() override; |
43 | Result compress(bool finish) override; |
44 | |
45 | private: |
46 | class Private; |
47 | Private *const d; |
48 | }; |
49 | |
50 | #endif |
51 | |
52 | #endif |
53 | |