CZipAddNewFileInfo Struct Reference

Structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& ); Use one of constructors provided and then adjust the member variables that are set to default values by Defaults method. More...

#include <ZipArchive.h>

List of all members.

Public Member Functions

 CZipAddNewFileInfo (LPCTSTR lpszFilePath, bool bFullPath=true)
 CZipAddNewFileInfo (LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip)
 CZipAddNewFileInfo (CZipAbstractFile *pFile, LPCTSTR lpszFileNameInZip)
void Defaults ()
 Set default values for m_iSmartLevel, m_iReplaceIndex, m_nBufSize and m_iComprLevel.

Public Attributes

CZipString m_szFilePath
 the full path to the file to be added; if it is empty you need to set m_pFile
CZipString m_szFileNameInZip
 the file name that will be stored in the archive (if the file is a directory, there is a path separator automatically added at the end); CZipArchive::SetRootPath function has no effect on this parameter
bool m_bFullPath
 It has only the meaning when m_szFileNameInZip is not specified and m_szFilePath is not empty.
int m_iComprLevel
 the compression level, see CZipArchive::OpenNewFile
int m_iSmartLevel
 the smartness level of of the library; can be one or more CZipArchive::Smartness values (you can OR them);
if zipsmCheckForEff is specified and due to it the file needs to be reinserted into the archive without a compression and the callback object is specified, the callback object's method Callback is called with the first argument set to DWORD (-1) (you need to remember the last argument if you need the size of the file)
int m_iReplaceIndex
 the index of the existing file in the archive to be replaced by the file being added (the new file goes into the same physical place as the old file - the archive may of course grow or shrink as a result)
unsigned long m_nBufSize
 the size of the buffer used while file operations
CZipAbstractFile * m_pFile
 instead of from a physical file, the data for compression is taken from the CZipAbstractFile object (e.g.


Detailed Description

Structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& ); Use one of constructors provided and then adjust the member variables that are set to default values by Defaults method.

Definition at line 100 of file ZipArchive.h.


Member Data Documentation

bool CZipAddNewFileInfo::m_bFullPath
 

It has only the meaning when m_szFileNameInZip is not specified and m_szFilePath is not empty.

  • if false only the filename without a path is stored in the archive

in this case if CZipArchive::m_szRootPath is set previously with CZipArchive::SetRootPath and if the beginning of m_szFilePath equals CZipArchive::m_szRootPath then the filename is set to the remaining part of m_szFilePath (you can say to m_szFilePath minus CZipArchive::m_szRootPath)

Definition at line 143 of file ZipArchive.h.

int CZipAddNewFileInfo::m_iReplaceIndex
 

the index of the existing file in the archive to be replaced by the file being added (the new file goes into the same physical place as the old file - the archive may of course grow or shrink as a result)

  • >= 0 the index of the file to be replaced
  • -1 do not replace any file and add the new file at the end of the archive (default)
  • -2 if the new file has the same name as a file already in the archive then replace it or add at the end of the archive if it's filename is unique; it uses CZipArchive::FindFile with the arguments iCaseSensitive and bFileNameOnly set to default values

Note:
  • you replace files in disk-spanning archives (i.e. use a value different from -1)
  • if the space size taken by the old file is different from the space size needed by the new file, the callback is called while moving data (see CZipArchive::cbReplace)
  • this replaces the file physically, so no information from the file being replaced is retained (such as attributes, modification time, etc.)
  • if you use an invalid index, the function will fail; if you specify the last file in the archive to be replaced, it'll be removed and the usual action taken
  • the new file encryption does not depend on the old file encryption but only on the current password settings (see CZipArchive::SetPassword)
  • if m_iComprLevel is not 0 then a temporary archive is created in the temporary directory (see CZipArchive::SetTempPath) or in the memory (if you use CZipArchive::zipsmMemoryFlag in m_iSmartLevel)
  • the most complicated scenario is when you try to replace the file and use CZipArchive::zipsmCheckForEff flag in m_iSmartLevel and the file compression proves to be inefficient (you can use the sample application ZipArc to observe the following process):
    • first you get CZipArchive::cbAdd callback - the file is being compressed to a temporary archive,
    • then the file compression proves to be inefficient and the file needs to be stored instead of compressed, but first the space inside archive must be adjusted to fit the file being added in the place of file being replaced - you get CZipArchive::cbReplace,
    • then, at the end, the file is being stored - you get CZipArchive::cbAddStore callback
See also:
SetAdvanced

CZipArchive::WillBeDuplicated

Definition at line 187 of file ZipArchive.h.

CZipAbstractFile* CZipAddNewFileInfo::m_pFile
 

instead of from a physical file, the data for compression is taken from the CZipAbstractFile object (e.g.

from CZipMemFile)

Note:
  • you have to leave m_szFilePath empty if you set m_pFile to not NULL
  • the time of the file in zip is set to the current time, and the attributes to the default file attributes (depending on the system)
  • you cannot add directories this way

Definition at line 203 of file ZipArchive.h.


The documentation for this struct was generated from the following file:
ZipArchive Copyright © 2000 - 2006 Tadeusz Dracz . Generated at Fri Apr 7 13:55:24 2006.