| 1 | /* This file is part of the KDE libraries |
| 2 | SPDX-FileCopyrightText: 2025 Azhar Momin <azhar.momin@kdemail.net> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KLZFILTER_H |
| 8 | #define KLZFILTER_H |
| 9 | |
| 10 | #include <config-compression.h> |
| 11 | |
| 12 | #if HAVE_XZ_SUPPORT |
| 13 | |
| 14 | #include "kfilterbase.h" |
| 15 | |
| 16 | /** |
| 17 | * Internal class used by KCompressionDevice |
| 18 | * @internal |
| 19 | */ |
| 20 | class KLzFilter : public KFilterBase |
| 21 | { |
| 22 | public: |
| 23 | KLzFilter(); |
| 24 | ~KLzFilter() override; |
| 25 | |
| 26 | bool init(int mode) override; |
| 27 | int mode() const override; |
| 28 | bool terminate() override; |
| 29 | void reset() override; |
| 30 | bool () override; |
| 31 | bool readTrailer(); |
| 32 | bool (const QByteArray &) override; |
| 33 | bool writeTrailer(); |
| 34 | void setOutBuffer(char *data, uint maxlen) override; |
| 35 | void setInBuffer(const char *data, uint size) override; |
| 36 | int inBufferAvailable() const override; |
| 37 | int outBufferAvailable() const override; |
| 38 | Result uncompress() override; |
| 39 | Result compress(bool finish) override; |
| 40 | |
| 41 | private: |
| 42 | class Private; |
| 43 | const std::unique_ptr<Private> d; |
| 44 | }; |
| 45 | |
| 46 | #endif // HAVE_XZ_SUPPORT |
| 47 | |
| 48 | #endif // KLZFILTER_H |
| 49 | |