Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation
CZipAddNewFileInfo Struct Reference

#include <ZipArchive.h>

Public Member Functions

 CZipAddNewFileInfo (LPCTSTR lpszFilePath, bool bFullPath=true)
 
 CZipAddNewFileInfo (LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip)
 
 CZipAddNewFileInfo (CZipAbstractFile *pFile, LPCTSTR lpszFileNameInZip)
 
void Defaults ()
 

Public Attributes

bool m_bFullPath
 
int m_iComprLevel
 
ZipArchiveLib::CBitFlag m_iSmartLevel
 
unsigned long m_nBufSize
 
CZipAbstractFile * m_pFile
 
CZipString m_szFileNameInZip
 
CZipString m_szFilePath
 
ZIP_INDEX_TYPE m_uReplaceIndex
 

Detailed Description

The structure used as a parameter in the CZipArchive::AddNewFile(CZipAddNewFileInfo& ) method. Use one of the provided constructors and then adjust the member variables as needed.

See Also
Compressing Data

Constructor & Destructor Documentation

CZipAddNewFileInfo::CZipAddNewFileInfo ( LPCTSTR  lpszFilePath,
bool  bFullPath = true 
)
inline

Initializes a new instance of the CZipAddNewFileInfo class.

Parameters
lpszFilePathSets m_szFilePath.
bFullPathSets m_bFullPath.
CZipAddNewFileInfo::CZipAddNewFileInfo ( LPCTSTR  lpszFilePath,
LPCTSTR  lpszFileNameInZip 
)
inline

Initializes a new instance of the CZipAddNewFileInfo class.

Parameters
lpszFilePathSets m_szFilePath.
lpszFileNameInZipSets m_szFileNameInZip.
CZipAddNewFileInfo::CZipAddNewFileInfo ( CZipAbstractFile *  pFile,
LPCTSTR  lpszFileNameInZip 
)
inline

Initializes a new instance of the CZipAddNewFileInfo class.

Parameters
pFileSets m_pFile.
lpszFileNameInZipSets m_szFileNameInZip.

Member Function Documentation

void CZipAddNewFileInfo::Defaults ( )

Sets the default values for m_iSmartLevel, m_uReplaceIndex, m_nBufSize and m_iComprLevel. Examine the source code for the current values.

Member Data Documentation

bool CZipAddNewFileInfo::m_bFullPath

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

int CZipAddNewFileInfo::m_iComprLevel

The level of compression. You can use values from 0 to 9 and -1 (meaning the default compression) or one of the CZipCompressor::CompressionLevel values.

ZipArchiveLib::CBitFlag CZipAddNewFileInfo::m_iSmartLevel

The smartness level of the file adding process. It can be one or more of the CZipArchive::Smartness values (you can use the logical OR).

unsigned long CZipAddNewFileInfo::m_nBufSize

The size of the buffer used while file operations.

CZipAbstractFile* CZipAddNewFileInfo::m_pFile

Initialize this field to set the source data for compression to be taken from the CZipAbstractFile object (such as CZipMemFile) instead of from a physical file.

Note
  • You have to leave m_szFilePath empty if you set m_pFile to not NULL.
  • The time of a file in zip will be set to the current time, and the attributes to the default file attributes (depending on the system).
  • You cannot add directories this way.
CZipString CZipAddNewFileInfo::m_szFileNameInZip

The file name that will be stored in the archive. If the file is a directory, there will be a path separator automatically appended. The CZipArchive::SetRootPath method has no effect on this parameter.

CZipString CZipAddNewFileInfo::m_szFilePath

The full path to the file to be added. If it is empty, you need to initialize m_pFile. If m_bFullPath is true and the path contains a drive letter, the drive letter is removed unless CZipArchive::m_bSafePaths is set to false.

ZIP_INDEX_TYPE CZipAddNewFileInfo::m_uReplaceIndex

The index of an existing file in the archive to be replaced by the file being added. See Modification of Archives: Replacing, Renaming, Deleting and Changing Data for more information. The meaning of its values is as follows:

  • >= 0 : the index of the file to be replaced.
  • ZIP_FILE_INDEX_UNSPECIFIED : do not replace any file and add the new file at the end of the archive (default). Use this value in segmented archives.
Note
  • If you use an invalid index, the action will fail.
  • If you specify the last file in the archive to be replaced, it'll be removed and the usual action will be taken.
See Also
CZipArchive::SetAdvanced
CZipArchive::WillBeDuplicated

The documentation for this struct was generated from the following file:
Back To Top Up