KArchive

kgzipfilter.h
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2000, 2009 David Faure <faure@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef __kgzipfilter__h
8#define __kgzipfilter__h
9
10#include "kfilterbase.h"
11
12/**
13 * Internal class used by KCompressionDevice
14 *
15 * This header is not installed.
16 *
17 * @internal
18 */
20{
21public:
23 ~KGzipFilter() override;
24
25 bool init(int mode) override;
26
27 // The top of zlib.h explains it: there are three cases.
28 // - Raw deflate, no header (e.g. inside a ZIP file)
29 // - Thin zlib header (1) (which is normally what HTTP calls "deflate" (2))
30 // - Gzip header, implemented here by readHeader
31 //
32 // (1) as written out by compress()/compress2()
33 // (2) see https://www.zlib.net/zlib_faq.html#faq39
34 enum Flag {
35 RawDeflate = 0, // raw deflate data
36 ZlibHeader = 1, // zlib headers (HTTP deflate)
37 GZipHeader = 2,
38 };
39 bool init(int mode, Flag flag); // for direct users of KGzipFilter
40 int mode() const override;
41 bool terminate() override;
42 void reset() override;
43 bool readHeader() override; // this is about the GZIP header
44 bool writeHeader(const QByteArray &fileName) override;
45 void writeFooter();
46 void setOutBuffer(char *data, uint maxlen) override;
47 void setInBuffer(const char *data, uint size) override;
48 int inBufferAvailable() const override;
49 int outBufferAvailable() const override;
50 Result uncompress() override;
51 Result compress(bool finish) override;
52
53private:
54 Result uncompress_noop();
55 class Private;
56 Private *const d;
57};
58
59#endif
This is the base class for compression filters such as gzip and bzip2.
Definition kfilterbase.h:27
Internal class used by KCompressionDevice.
Definition kgzipfilter.h:20
bool writeHeader(const QByteArray &fileName) override
void setInBuffer(const char *data, uint size) override
void reset() override
Result compress(bool finish) override
int inBufferAvailable() const override
void setOutBuffer(char *data, uint maxlen) override
int outBufferAvailable() const override
bool readHeader() override
int mode() const override
bool terminate() override
bool init(int mode) override
Result uncompress() override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 12 2024 11:53:46 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.