Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
CAArchive Class Reference

Class for the manipulation of a gzipped tar archive (tar.gz) More...

#include <archive.h>

List of all members.

Public Member Functions

 CAArchive ()
 CAArchive (QIODevice &arch)
qint64 write (QIODevice &dest)
virtual ~CAArchive ()
bool addFile (const QString &filename, QIODevice &data)
bool addFile (const QString &filename, QByteArray data)
void removeFile (const QString &filename)
CAIOPtr file (const QString &filename)
bool error ()
const QString & version ()

Protected Member Functions

void parse (QIODevice &)
int getOS ()

Protected Attributes

QString _version
bool _err
CATar_tar

Static Protected Attributes

static const int CHUNK = 16384
static const QString COMMENT = "Canorus Archive v"+QString(CANORUS_VERSION).remove(QRegExp("[a-z]*$"))

Detailed Description

Class for the manipulation of a gzipped tar archive (tar.gz)

Copyright (c) 2007, Itay Perl, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.

    This class allows read/write operations on tar.gz archives.
    \warning This is not a CATar subclass as it does not represent a tar file, but a gzipped file. The uncompressed content is a tar file. 

    See RFC 1952 for the GZIP specification.

Constructor & Destructor Documentation

Creates and empty archive

References _tar.

CAArchive::CAArchive ( QIODevice &  arch)

Read an existing archive.

References parse().

Here is the call graph for this function:

CAArchive::~CAArchive ( ) [virtual]

Destory the archive

References _tar.


Member Function Documentation

bool CAArchive::addFile ( const QString &  filename,
QIODevice &  data 
) [inline]

References _tar, CATar::addFile(), and error().

Referenced by CACanExport::exportDocumentImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CAArchive::addFile ( const QString &  filename,
QByteArray  data 
) [inline]

References _tar, CATar::addFile(), and error().

Here is the call graph for this function:

bool CAArchive::error ( ) [inline]

References _err, _tar, and CATar::error().

Referenced by addFile(), file(), CACanImport::importDocumentImpl(), removeFile(), and write().

Here is the call graph for this function:

Here is the caller graph for this function:

CAIOPtr CAArchive::file ( const QString &  filename) [inline]

References _tar, error(), and CATar::file().

Referenced by CACanImport::importDocumentImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

int CAArchive::getOS ( ) [protected]

Return an operating system ID for use in a GZip header. See RFC 1952.

Referenced by parse(), and write().

Here is the caller graph for this function:

void CAArchive::parse ( QIODevice &  arch) [protected]

Parse/decompress an existing archive

References _err, _tar, _version, z_stream_s::avail_in, z_stream_s::avail_out, CHUNK, gz_header_s::comm_max, gz_header_s::comment, getOS(), inflateInit2, z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, gz_header_s::os, Z_BUF_ERROR, Z_NO_FLUSH, Z_NULL, Z_OK, Z_STREAM_END, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by CAArchive().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAArchive::removeFile ( const QString &  filename) [inline]

References _tar, error(), and CATar::removeFile().

Here is the call graph for this function:

const QString& CAArchive::version ( ) [inline]

References _version.

qint64 CAArchive::write ( QIODevice &  dest)

Write the tar.gz archive into the given device. Returns the number of byte written, or -1 on error.

References _err, _tar, z_stream_s::avail_in, z_stream_s::avail_out, CHUNK, CATar::close(), COMMENT, gz_header_s::comment, deflateInit2, CATar::eof(), error(), getOS(), z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, CATar::open(), gz_header_s::os, CATar::write(), Z_DEFAULT_COMPRESSION, Z_DEFAULT_STRATEGY, Z_DEFLATED, Z_FINISH, Z_NO_FLUSH, Z_NULL, Z_OK, Z_STREAM_END, Z_STREAM_ERROR, z_stream_s::zalloc, and z_stream_s::zfree.

Referenced by CACanExport::exportDocumentImpl().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bool CAArchive::_err [protected]

Referenced by error(), parse(), and write().

CATar* CAArchive::_tar [protected]
QString CAArchive::_version [protected]

Referenced by parse(), and version().

const int CAArchive::CHUNK = 16384 [static, protected]

Referenced by parse(), and write().

const QString CAArchive::COMMENT = "Canorus Archive v"+QString(CANORUS_VERSION).remove(QRegExp("[a-z]*$")) [static, protected]

Referenced by write().


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