This repository has been archived on 2025-12-24. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
yachat/iris-legacy/iris/xmpp-core/compress.h

55 lines
748 B
C
Raw Permalink Normal View History

2025-12-25 01:37:49 +05:00
#ifndef COMPRESS_H
#define COMPRESS_H
#include <QObject>
#include "zlib.h"
class QIODevice;
class Compressor : public QObject
{
Q_OBJECT
public:
Compressor(QIODevice* device, int compression = Z_DEFAULT_COMPRESSION);
~Compressor();
int write(const QByteArray&);
protected slots:
void flush();
protected:
int write(const QByteArray&, bool flush);
private:
QIODevice* device_;
z_stream* zlib_stream_;
bool flushed_;
};
class Decompressor : public QObject
{
Q_OBJECT
public:
Decompressor(QIODevice* device);
~Decompressor();
int write(const QByteArray&);
protected slots:
void flush();
protected:
int write(const QByteArray&, bool flush);
private:
QIODevice* device_;
z_stream* zlib_stream_;
bool flushed_;
};
#endif