File indexing completed on 2025-02-16 13:00:36
0001 /* This file is part of the KDE libraries 0002 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef __kbzip2filter__h 0008 #define __kbzip2filter__h 0009 0010 #include <config-compression.h> 0011 0012 #if HAVE_BZIP2_SUPPORT 0013 0014 #include "kfilterbase.h" 0015 0016 /** 0017 * Internal class used by KCompressionDevice 0018 * @internal 0019 */ 0020 class KBzip2Filter : public KFilterBase 0021 { 0022 public: 0023 KBzip2Filter(); 0024 ~KBzip2Filter() override; 0025 0026 bool init(int) override; 0027 int mode() const override; 0028 bool terminate() override; 0029 void reset() override; 0030 bool readHeader() override 0031 { 0032 return true; // bzip2 handles it by itself ! Cool ! 0033 } 0034 bool writeHeader(const QByteArray &) override 0035 { 0036 return true; 0037 } 0038 void setOutBuffer(char *data, uint maxlen) override; 0039 void setInBuffer(const char *data, uint size) override; 0040 int inBufferAvailable() const override; 0041 int outBufferAvailable() const override; 0042 Result uncompress() override; 0043 Result compress(bool finish) override; 0044 0045 private: 0046 class Private; 0047 Private *const d; 0048 }; 0049 0050 #endif 0051 0052 #endif