Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Compressor Class Reference

#include </tmp/quassel/src/common/compressor.h>

Public Types

enum  CompressionLevel { NoCompression, DefaultCompression, BestCompression, BestSpeed }
enum  Error { NoError, StreamError, DeviceError }
enum  WriteBufferHint { NoFlush, Flush }

Signals

void readyRead ()
void error (Compressor::Error errorCode=StreamError)

Public Member Functions

 Compressor (QTcpSocket *socket, CompressionLevel level, QObject *parent=0)
 ~Compressor ()
CompressionLevel compressionLevel () const
qint64 bytesAvailable () const
qint64 read (char *data, qint64 maxSize)
qint64 write (const char *data, qint64 count, WriteBufferHint flush=Flush)
void flush ()

Private Slots

void readData ()

Private Member Functions

bool initStreams ()
void writeData ()

Private Attributes

QTcpSocket * _socket
CompressionLevel _level
QByteArray _readBuffer
QByteArray _writeBuffer
QByteArray _inputBuffer
QByteArray _outputBuffer
z_streamp _inflater
z_streamp _deflater

Detailed Description

Definition at line 34 of file compressor.h.

Member Enumeration Documentation

Enumerator:
NoCompression 
DefaultCompression 
BestCompression 
BestSpeed 

Definition at line 39 of file compressor.h.

enum Error
Enumerator:
NoError 
StreamError 
DeviceError 

Definition at line 46 of file compressor.h.

Enumerator:
NoFlush 
Flush 

Definition at line 52 of file compressor.h.

Constructor & Destructor Documentation

Compressor ( QTcpSocket *  socket,
Compressor::CompressionLevel  level,
QObject *  parent = 0 
)

Definition at line 36 of file compressor.cpp.

References error(), initStreams(), NoCompression, readData(), and readyRead().

~Compressor ( )

Definition at line 62 of file compressor.cpp.

References _deflater, and _inflater.

Member Function Documentation

CompressionLevel compressionLevel ( ) const
inline

Definition at line 60 of file compressor.h.

References _level.

Referenced by flush(), initStreams(), readData(), and writeData().

qint64 bytesAvailable ( ) const

Definition at line 114 of file compressor.cpp.

References _readBuffer.

Referenced by RemotePeer::readMessage().

qint64 read ( char *  data,
qint64  maxSize 
)

Definition at line 120 of file compressor.cpp.

References _readBuffer, _socket, and readData().

Referenced by RemotePeer::readMessage().

qint64 write ( const char *  data,
qint64  count,
WriteBufferHint  flush = Flush 
)

Definition at line 145 of file compressor.cpp.

References _writeBuffer, NoFlush, and writeData().

Referenced by RemotePeer::writeMessage().

void flush ( )

Definition at line 267 of file compressor.cpp.

References _socket, compressionLevel(), and NoCompression.

void readyRead ( )
signal

Referenced by Compressor(), and readData().

void error ( Compressor::Error  errorCode = StreamError)
signal

Referenced by Compressor(), readData(), and writeData().

void readData ( )
privateslot
bool initStreams ( )
private
void writeData ( )
private

Member Data Documentation

QTcpSocket* _socket
private

Definition at line 81 of file compressor.h.

Referenced by flush(), read(), readData(), and writeData().

CompressionLevel _level
private

Definition at line 82 of file compressor.h.

Referenced by compressionLevel().

QByteArray _readBuffer
private

Definition at line 84 of file compressor.h.

Referenced by bytesAvailable(), read(), and readData().

QByteArray _writeBuffer
private

Definition at line 85 of file compressor.h.

Referenced by write(), and writeData().

QByteArray _inputBuffer
private

Definition at line 87 of file compressor.h.

Referenced by initStreams(), and readData().

QByteArray _outputBuffer
private

Definition at line 88 of file compressor.h.

Referenced by initStreams(), and writeData().

z_streamp _inflater
private

Definition at line 90 of file compressor.h.

Referenced by initStreams(), readData(), and ~Compressor().

z_streamp _deflater
private

Definition at line 91 of file compressor.h.

Referenced by initStreams(), writeData(), and ~Compressor().


The documentation for this class was generated from the following files: