KArchive

kgzipfilter.h
1 /* This file is part of the KDE libraries
2  SPDX-FileCopyrightText: 2000, 2009 David Faure <[email protected]>
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  */
19 class KGzipFilter : public KFilterBase
20 {
21 public:
22  KGzipFilter();
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 http://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 
53 private:
54  Result uncompress_noop();
55  class Private;
56  Private *const d;
57 };
58 
59 #endif
bool readHeader() override
int outBufferAvailable() const override
bool terminate() override
Result uncompress() override
int mode() const override
Internal class used by KCompressionDevice.
Definition: kgzipfilter.h:19
Result compress(bool finish) override
bool init(int mode) override
Definition: kgzipfilter.cpp:56
void setInBuffer(const char *data, uint size) override
void reset() override
void setOutBuffer(char *data, uint maxlen) override
int inBufferAvailable() const override
bool writeHeader(const QByteArray &fileName) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 8 2022 04:01:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.