UltraScan III
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
US_Tar Class Reference

#include "us_tar.h"

Collaboration diagram for US_Tar:
Collaboration graph
[legend]

Classes

struct  posix_header
 

Public Member Functions

 US_Tar ()
 
int create (const QString &, const QString &, QStringList *=0)
 
int create (const QString &, const QStringList &, QStringList *=0)
 
int extract (const QString &, QStringList *=0)
 
int list (const QString &, QStringList &)
 
QString explain (const int)
 

Private Types

typedef struct US_Tar::posix_header posix_header
 

Private Member Functions

void process_dir (const QString &, QStringList &)
 
void write_file (const QString &)
 
void write_long_filename (const QString &)
 
void flush_buffer (void)
 
void archive_end (void)
 
bool validate_header (void)
 
void read_block (void)
 
QString get_long_filename (void)
 
QString format_permissions (const unsigned int, const bool)
 
QString format_datetime (const unsigned int)
 

Private Attributes

int ofd
 
int ifd
 
union {
   posix_header   header
 
   unsigned char   h [BLOCK_SIZE]
 
tar_header
 
unsigned char buffer [BLOCK_SIZE *BLOCKING_FACTOR]
 
int blocks_written
 
int blocks_read
 
int archive_size
 

Detailed Description

A class to provide tar functions internally to a routine. The functions provided are create, extract, and list.

Definition at line 22 of file us_tar.h.

Member Typedef Documentation

Constructor & Destructor Documentation

US_Tar::US_Tar ( )

Definition at line 51 of file us_tar.cpp.

Member Function Documentation

void US_Tar::archive_end ( void  )
private

Definition at line 444 of file us_tar.cpp.

int US_Tar::create ( const QString &  archive,
const QString &  directory,
QStringList *  list = 0 
)

Create a tar file from a directory

Parameters
archiveThe name of the tar file to be created.
directoryThe name of the directory to archive.
listThe optional output list of archived files.
Returns
An error code. Zero for no error (see explain method)

Definition at line 55 of file us_tar.cpp.

int US_Tar::create ( const QString &  archive,
const QStringList &  files,
QStringList *  list = 0 
)

Create a tar file from a list of files (including directories)

Parameters
archiveThe name of the tar file to be created.
filesA list of names of files/directories to archive.
listThe optional output list of archived files.
Returns
An error code. Zero for no error (see explain method).

Definition at line 64 of file us_tar.cpp.

QString US_Tar::explain ( const int  error)

Explain in a message string the tar function error that occurred.

Parameters
errorThe error code to be explained.
Returns
A string documenting the nature of the error.

Definition at line 896 of file us_tar.cpp.

int US_Tar::extract ( const QString &  archive,
QStringList *  list = 0 
)

Extract from a tar file the files archived.

Parameters
archiveThe name of the tar file from which to extract.
listThe optional output list of extracted files.
Returns
An error code. Zero for no error (see explain method).

Definition at line 480 of file us_tar.cpp.

void US_Tar::flush_buffer ( void  )
private

Definition at line 461 of file us_tar.cpp.

QString US_Tar::format_datetime ( const unsigned int  mtime)
private

Definition at line 811 of file us_tar.cpp.

QString US_Tar::format_permissions ( const unsigned int  mode,
const bool  dir 
)
private

Definition at line 794 of file us_tar.cpp.

QString US_Tar::get_long_filename ( void  )
private

Definition at line 867 of file us_tar.cpp.

int US_Tar::list ( const QString &  archive,
QStringList &  files 
)

List the files archived in a tar file.

Parameters
archiveThe name of the tar file whose content is to be listed.
filesThe output list of archived files.
Returns
An error code. Zero for no error (see explain method).

Definition at line 694 of file us_tar.cpp.

void US_Tar::process_dir ( const QString &  path,
QStringList &  all 
)
private

Definition at line 150 of file us_tar.cpp.

void US_Tar::read_block ( void  )
private

Definition at line 889 of file us_tar.cpp.

bool US_Tar::validate_header ( void  )
private

Definition at line 823 of file us_tar.cpp.

void US_Tar::write_file ( const QString &  file)
private

Definition at line 193 of file us_tar.cpp.

void US_Tar::write_long_filename ( const QString &  filename)
private

Definition at line 333 of file us_tar.cpp.

Member Data Documentation

int US_Tar::archive_size
private

Definition at line 104 of file us_tar.h.

int US_Tar::blocks_read
private

Definition at line 103 of file us_tar.h.

int US_Tar::blocks_written
private

Definition at line 102 of file us_tar.h.

unsigned char US_Tar::buffer[BLOCK_SIZE *BLOCKING_FACTOR]
private

Definition at line 100 of file us_tar.h.

unsigned char US_Tar::h[BLOCK_SIZE]

Definition at line 97 of file us_tar.h.

posix_header US_Tar::header

Definition at line 96 of file us_tar.h.

int US_Tar::ifd
private

Definition at line 68 of file us_tar.h.

int US_Tar::ofd
private

Definition at line 67 of file us_tar.h.

union { ... } US_Tar::tar_header

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