Public Member Functions | Protected Member Functions

zeus::TZipFile Class Reference

#include <ZipFile.h>

Inheritance diagram for zeus::TZipFile:
zeus::TFile zeus::TZObject zeus::IZUnknown

List of all members.

Public Member Functions

 TZipFile (const TString &rFileName)
Retval addFileEntry (const IString &rEntryName, const IString &rFileName, bool bOverwriteIfExists, Int iZipLevel=4)
Retval deleteFileEntry (Int iIndex)
Retval getFileEntry (Int iIndex, TZippedFileEntry *&rpEntry) const
Retval getFileEntryByName (const IString &rEntryName, TZippedFileEntry *&rpEntry) const
Int getFileEntryCount () const
bool isValid () const
Retval removeFileEntry (const IString &rEntryName)
void createArchive ()
Retval saveArchive ()
void setPassword (const IString &rPassword)
Retval unzipAllFiles (const IString &rTargetDirectory, bool bOptUsePath=true, bool bOptOverwrite=false)
Retval unzipFiles (const IString &rTargetDirectory, const IStringList &lstEntries, bool bOptUsePath=true, bool bOptOverwrite=false)
Retval unzipSingleFile (const IString &rTargetDirectory, const IString &rFileEntry, bool bOptUsePath=true, bool bOptOverwrite=false)
Retval zipFiles (const IString &rSourceDirectory, bool bRecursive, bool bOverwriteIfExists, Int iZipLevel=4)
Retval zipFiles (const IString &rSourceDirectory, const IString &rFileFilter, bool bRecursive, bool bOverwriteIfExists, Int iZipLevel=4)

Protected Member Functions

virtual ~TZipFile ()
void checkOpen () const
void close ()

Detailed Description

This class represents a zip file. Reading and writing zip files can be done using the provided methods


Constructor & Destructor Documentation

TZipFile::TZipFile ( const TString rFileName )

Creates a ZipFile

TZipFile::~TZipFile (  ) [protected, virtual]

Destroys the ZipFile


Member Function Documentation

Retval TZipFile::addFileEntry ( const IString rEntryName,
const IString rFileName,
bool  bOverwriteIfExists,
Int  iZipLevel = 4 
)
void TZipFile::checkOpen (  ) const [protected]

Opens the Zip file if it is not open yet

void TZipFile::close (  ) [protected]

Closes the Zip file

void TZipFile::createArchive (  )

creates a new archive. Use saveArchive to store the new archive back to the HD

Retval TZipFile::deleteFileEntry ( Int  iIndex )
Retval TZipFile::getFileEntry ( Int  iIndex,
TZippedFileEntry *&  rpEntry 
) const
Retval TZipFile::getFileEntryByName ( const IString rEntryName,
TZippedFileEntry *&  rpEntry 
) const
Int TZipFile::getFileEntryCount (  ) const
bool TZipFile::isValid (  ) const
Retval TZipFile::removeFileEntry ( const IString rEntryName )
Retval TZipFile::saveArchive (  )

saves the archive

void zeus::TZipFile::setPassword ( const IString rPassword ) [inline]

sets the password of the zip file

Retval TZipFile::unzipAllFiles ( const IString rTargetDirectory,
bool  bOptUsePath = true,
bool  bOptOverwrite = false 
)

unzips a file without any password

Retval TZipFile::unzipFiles ( const IString rTargetDirectory,
const IStringList lstEntries,
bool  bOptUsePath = true,
bool  bOptOverwrite = false 
)

Unzips all files of the zip into a directory

Parameters:
rTargetDirectory,:target directory
lstEntries: list of file entries to extract
bOptUsePath: should the internal path be used for extraction
bOptOverwrite,:should already existing file be overwritten
Return values:
RET_NOERROR: File unzipped
RET_REQUEST_FAILED: error opening the zip file
RET_INVALID_DATA: Invalid directory
RET_ACCESS_DENIED: Could not create the directory

ptrEntry->isDirectory()

Retval zeus::TZipFile::unzipSingleFile ( const IString rTargetDirectory,
const IString rFileEntry,
bool  bOptUsePath = true,
bool  bOptOverwrite = false 
) [inline]
Retval TZipFile::zipFiles ( const IString rSourceDirectory,
const IString rFileFilter,
bool  bRecursive,
bool  bOverwriteIfExists,
Int  iZipLevel = 4 
)

Zips all files of a directory

Parameters:
rSourceDirectory: source directory
rFileFilter: File filter, can contain wildcards.
bRecursive: includes all sub directories if true
bOverwriteIfExists: if an entry already exists, it will be overwritten (=true)
iZipLevel: compression level (default is 4)
Return values:
RET_REQUEST_FAILED: Invalid directory
RET_NOERROR: zip created
Retval zeus::TZipFile::zipFiles ( const IString rSourceDirectory,
bool  bRecursive,
bool  bOverwriteIfExists,
Int  iZipLevel = 4 
) [inline]

Zips all files of a directory

Parameters:
rSourceDirectory: source directory
bRecursive: includes all sub directories if true
bOverwriteIfExists: if an entry already exists, it will be overwritten (=true)
iZipLevel: compression level (default is 4)
Return values:
RET_REQUEST_FAILED: Invalid directory
RET_NOERROR: zip created

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:43