Canorus  0.0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CAArchive Class Reference

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

#include <archive.h>

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

◆ CAArchive() [1/2]

CAArchive::CAArchive ( )

Creates and empty archive

References _tar.

◆ CAArchive() [2/2]

CAArchive::CAArchive ( QIODevice &  arch)

Read an existing archive.

References parse().

Here is the call graph for this function:

◆ ~CAArchive()

CAArchive::~CAArchive ( )
virtual

Destory the archive

References _tar.

Member Function Documentation

◆ addFile() [1/2]

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

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

Here is the call graph for this function:

◆ addFile() [2/2]

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:

◆ error()

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:

◆ file()

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:

◆ getOS()

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:

◆ parse()

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(), inflate, inflateEnd, 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:

◆ removeFile()

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

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

Here is the call graph for this function:

◆ version()

const QString& CAArchive::version ( )
inline

References _version.

◆ write()

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, deflate, deflateEnd, 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

◆ _err

bool CAArchive::_err
protected

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

◆ _tar

CATar* CAArchive::_tar
protected

◆ _version

QString CAArchive::_version
protected

Referenced by parse(), and version().

◆ CHUNK

const int CAArchive::CHUNK = 16384
staticprotected

Referenced by parse(), and write().

◆ COMMENT

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

Referenced by write().


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