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 ()

Protected Member Functions

void parse (QIODevice &)
int getOS ()

Protected Attributes

bool _err
CATar_tar

Static Protected Attributes

static const int CHUNK = 16384
static const char * VERSION = "Canorus Archive v0.5"


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.

Definition at line 17 of file archive.h.


Constructor & Destructor Documentation

CAArchive::CAArchive (  ) 

Creates and empty archive

Definition at line 36 of file archive.cpp.

References _tar.

CAArchive::CAArchive ( QIODevice &  arch  ) 

Read an existing archive.

Definition at line 45 of file archive.cpp.

References parse().

Here is the call graph for this function:

CAArchive::~CAArchive (  )  [virtual]

Destory the archive

Definition at line 54 of file archive.cpp.

References _tar.


Member Function Documentation

qint64 CAArchive::write ( QIODevice &  dest  ) 

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

Definition at line 145 of file archive.cpp.

References _err, _tar, z_stream_s::avail_in, z_stream_s::avail_out, CHUNK, gz_header_s::comment, deflateInit2, CATar::eof(), error(), getOS(), z_stream_s::next_in, z_stream_s::next_out, z_stream_s::opaque, gz_header_s::os, VERSION, 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:

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

Definition at line 25 of file archive.h.

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]

Definition at line 26 of file archive.h.

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

Here is the call graph for this function:

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

Definition at line 27 of file archive.h.

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

Here is the call graph for this function:

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

Definition at line 28 of file archive.h.

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:

bool CAArchive::error (  )  [inline]

Definition at line 29 of file archive.h.

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:

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

Parse/decompress an existing archive

Definition at line 62 of file archive.cpp.

References _err, _tar, 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:

int CAArchive::getOS (  )  [protected]

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

Definition at line 238 of file archive.cpp.

Referenced by parse(), and write().

Here is the caller graph for this function:


Member Data Documentation

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

Definition at line 31 of file archive.h.

Referenced by parse(), and write().

const char * CAArchive::VERSION = "Canorus Archive v0.5" [static, protected]

Definition at line 32 of file archive.h.

Referenced by write().

bool CAArchive::_err [protected]

Definition at line 33 of file archive.h.

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

CATar* CAArchive::_tar [protected]

Definition at line 37 of file archive.h.

Referenced by addFile(), CAArchive(), error(), file(), parse(), removeFile(), write(), and ~CAArchive().


The documentation for this class was generated from the following files:
Generated on Sat Feb 9 13:10:57 2008 for Canorus by  doxygen 1.5.3