Vidalia 0.3.1
Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
ZlibByteArray Class Reference

#include <ZlibByteArray.h>

Inheritance diagram for ZlibByteArray:

Public Types

enum  CompressionMethod { None , Gzip , Zlib }
 

Public Member Functions

 ZlibByteArray (QByteArray data)
 
QByteArray compress (const CompressionMethod method=Zlib, QString *errmsg=0) const
 
QByteArray uncompress (CompressionMethod method=Zlib, QString *errmsg=0) const
 

Static Public Member Functions

static QByteArray compress (const QByteArray in, const CompressionMethod method=Zlib, QString *errmsg=0)
 
static QByteArray uncompress (const QByteArray in, const CompressionMethod method=Zlib, QString *errmsg=0)
 
static bool isZlibAvailable ()
 
static bool isGzipSupported ()
 

Static Private Member Functions

static int methodBits (CompressionMethod method)
 
static QString methodString (CompressionMethod method)
 

Detailed Description

Definition at line 59 of file ZlibByteArray.h.

Member Enumeration Documentation

◆ CompressionMethod

Available compression methods.

Enumerator
None 

No compression method.

Gzip 

Gzip compression method.

Zlib 

Zlib compression method.

Definition at line 63 of file ZlibByteArray.h.

Constructor & Destructor Documentation

◆ ZlibByteArray()

ZlibByteArray::ZlibByteArray ( QByteArray  data)

Constructor.

Constructor

Definition at line 81 of file ZlibByteArray.cpp.

Member Function Documentation

◆ compress() [1/2]

QByteArray ZlibByteArray::compress ( const CompressionMethod  method = Zlib,
QString *  errmsg = 0 
) const

Compresses the current contents of this object using method.

Compresses the current contents of this object using method. Returns the compressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 154 of file ZlibByteArray.cpp.

References compress().

Referenced by compress().

◆ compress() [2/2]

QByteArray ZlibByteArray::compress ( const QByteArray  in,
const CompressionMethod  method = Zlib,
QString *  errmsg = 0 
)
static

Compreses the contents of in using method.

Compresses in using method. Returns the compressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 164 of file ZlibByteArray.cpp.

References err(), Gzip, isGzipSupported(), methodBits(), methodString(), and None.

◆ isGzipSupported()

bool ZlibByteArray::isGzipSupported ( )
static

Returns true iff we support gzip-based compression. Otherwise, we need to use zlib.

Definition at line 132 of file ZlibByteArray.cpp.

References isGzipSupported().

Referenced by compress(), isGzipSupported(), and uncompress().

◆ isZlibAvailable()

bool ZlibByteArray::isZlibAvailable ( )
static

Returns true if the Zlib compression library is available and usable.

Definition at line 108 of file ZlibByteArray.cpp.

References isZlibAvailable().

Referenced by isZlibAvailable().

◆ methodBits()

int ZlibByteArray::methodBits ( CompressionMethod  method)
staticprivate

Return the 'bits' value to tell zlib to use method.

Definition at line 88 of file ZlibByteArray.cpp.

References Gzip.

Referenced by compress(), and uncompress().

◆ methodString()

QString ZlibByteArray::methodString ( CompressionMethod  method)
staticprivate

Returns a string description of method.

Definition at line 96 of file ZlibByteArray.cpp.

References Gzip, None, and Zlib.

Referenced by compress(), and uncompress().

◆ uncompress() [1/2]

QByteArray ZlibByteArray::uncompress ( CompressionMethod  method = Zlib,
QString *  errmsg = 0 
) const

Uncompresses the current contents of this object using method.

Uncompresses the current contents of this object using method. Returns the uncompressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 261 of file ZlibByteArray.cpp.

References uncompress().

Referenced by uncompress().

◆ uncompress() [2/2]

QByteArray ZlibByteArray::uncompress ( const QByteArray  in,
const CompressionMethod  method = Zlib,
QString *  errmsg = 0 
)
static

Uncompresses the contents of in using method.

Uncompresses in using method. Returns the uncompressed data if successful. If an error occurs, this will return an empty QByteArray and set the optional errmsg to a string describing the failure.

Definition at line 271 of file ZlibByteArray.cpp.

References err(), Gzip, isGzipSupported(), methodBits(), methodString(), and None.


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