#include <ZipCentralDir.h>
Classes | |
struct | CInfo |
struct | CZipFindFast |
Public Member Functions | |
CZipFileHeader * | AddNewFile (const CZipFileHeader &header, ZIP_INDEX_TYPE uReplaceIndex, int iLevel, bool bRichHeaderTemplateCopy=false) |
void | Close () |
void | CloseFile (bool skipCheckingDataDescriptor=false) |
void | CloseNewFile () |
void | EnableFindFast (bool bEnable, bool bCaseSensitive) |
ZIP_INDEX_TYPE | FindFile (LPCTSTR lpszFileName, bool bCaseSensitive, bool bSporadically, bool bFileNameOnly) |
ZIP_INDEX_TYPE | FindFileNameIndex (LPCTSTR lpszFileName) const |
CZipArchive * | GetArchive () |
void | GetComment (CZipString &szComment) const |
ZIP_ARRAY_SIZE_TYPE | GetCount () const |
ZIP_INDEX_TYPE | GetFindFastIndex (ZIP_INDEX_TYPE uFindFastIndex) const |
void | GetInfo (CInfo &info) const |
ZIP_SIZE_TYPE | GetSize (bool bWhole=false) const |
CZipStorage * | GetStorage () |
const CZipStringStoreSettings & | GetStringStoreSettings () const |
int | GetUnicodeMode () const |
void | Init (CZipCentralDir *pSource=NULL) |
void | InitOnCreate (CZipArchive *pArchive) |
bool | IsAnyFileModified () const |
bool | IsConsistencyCheckOn (int iLevel) |
bool | IsFindFastEnabled () |
bool | IsValidIndex (ZIP_INDEX_TYPE uIndex) const |
ZIP_FILE_USIZE | LocateSignature () |
bool | OnFileCentralChange () |
bool | OnFileNameChange (CZipFileHeader *pHeader) |
void | OpenFile (ZIP_INDEX_TYPE uIndex) |
const CZipFileHeader * | operator[] (ZIP_INDEX_TYPE uIndex) const |
CZipFileHeader * | operator[] (ZIP_INDEX_TYPE uIndex) |
void | Read (bool bExhaustiveRead) |
void | RebuildFindFastArray () |
void | RemoveAll () |
void | RemoveFile (CZipFileHeader *pHeader, ZIP_INDEX_TYPE uIndex=ZIP_FILE_INDEX_UNSPECIFIED, bool bShift=true) |
void | RemoveFromDisk () |
void | RemoveLastFile (CZipFileHeader *pHeader=NULL, ZIP_INDEX_TYPE uIndex=ZIP_FILE_INDEX_UNSPECIFIED) |
void | SetComment (LPCTSTR lpszComment, UINT codePage) |
void | SetUnicodeMode (int iMode) |
void | ThrowError (int err) const |
void | Write () |
Public Attributes | |
int | m_iIgnoredChecks |
CZipFileHeader * | m_pOpenedFile |
It points to the currently opened file or it is NULL , if no file is opened. | |
Static Public Attributes | |
static char | m_gszSignature [] |
The End of Central Directory Record signature. | |
static char | m_gszSignature64Locator [] |
The Zip64 End of Central Directory Locator signature. | |
Protected Member Functions | |
void | BuildFindFastArray (bool bCaseSensitive) |
void | ClearFindFastArray () |
int | CompareElement (LPCTSTR lpszFileName, ZIP_INDEX_TYPE uIndex) const |
void | CreateSharedData () |
void | DestroySharedData () |
ZIP_INDEX_TYPE | InsertFindFastElement (CZipFileHeader *pHeader, ZIP_INDEX_TYPE uIndex) |
void | ReadHeaders (bool bExhaustiveRead) |
bool | RemoveDataDescr (bool bFromBuffer) |
ZIP_INDEX_TYPE | RemoveFindFastElement (CZipFileHeader *pHeader, bool bShift) |
void | RemoveHeaders () |
void | WriteCentralEnd () |
void | WriteHeaders (bool bOneDisk) |
Static Protected Member Functions | |
static int | CompareFindFastCollate (const void *pArg1, const void *pArg2) |
static int | CompareFindFastCollateNoCase (const void *pArg1, const void *pArg2) |
static int | CompareHeaders (const void *pArg1, const void *pArg2) |
Protected Attributes | |
int | m_iUnicodeMode |
CZipArchive * | m_pArchive |
CZipArray< CZipFindFast * > * | m_pFindArray |
CZipArray< CZipFileHeader * > * | m_pHeaders |
CInfo * | m_pInfo |
CZipStorage * | m_pStorage |
Definition at line 48 of file ZipCentralDir.h.
CZipFileHeader* CZipCentralDir::AddNewFile | ( | const CZipFileHeader & | header, | |
ZIP_INDEX_TYPE | uReplaceIndex, | |||
int | iLevel, | |||
bool | bRichHeaderTemplateCopy = false | |||
) |
Adds a new file to the central directory.
header | Used as a template for the data stored inside the archive. | |
uReplaceIndex | The index of the file to be replaced or ZIP_FILE_INDEX_UNSPECIFIED , if the index is unknown. | |
iLevel | The compression level. | |
bRichHeaderTemplateCopy | true , if copy crc and sizes values from header; false otherwise. |
void CZipCentralDir::BuildFindFastArray | ( | bool | bCaseSensitive | ) | [protected] |
Builds the CZipCentralDir::m_pFindArray array.
void CZipCentralDir::Close | ( | ) |
Closes the central directory.
void CZipCentralDir::CloseFile | ( | bool | skipCheckingDataDescriptor = false |
) |
Closes a file opened for reading inside the archive.
skipCheckingDataDescriptor | If true , the data descriptor that is located after the compressed data in the archive is checked for validity. Set this value to false after closing the file after an exception was thrown. |
void CZipCentralDir::CloseNewFile | ( | ) |
Closes a file opened for reading inside the archive.
int CZipCentralDir::CompareElement | ( | LPCTSTR | lpszFileName, | |
ZIP_INDEX_TYPE | uIndex | |||
) | const [inline, protected] |
The method used in comparison involving the Find Fast feature.
lpszFileName | The name of the file. | |
uIndex | The index from the CZipCentralDir::m_pFindArray array. |
Definition at line 699 of file ZipCentralDir.h.
static int CZipCentralDir::CompareHeaders | ( | const void * | pArg1, | |
const void * | pArg2 | |||
) | [inline, static, protected] |
The method used in comparison when sorting headers.
Definition at line 605 of file ZipCentralDir.h.
void CZipCentralDir::CreateSharedData | ( | ) | [protected] |
void CZipCentralDir::DestroySharedData | ( | ) | [protected] |
Destroys data shared between different archive objects, if the usage reference count of the data is zero.
void CZipCentralDir::EnableFindFast | ( | bool | bEnable, | |
bool | bCaseSensitive | |||
) |
ZIP_INDEX_TYPE CZipCentralDir::FindFile | ( | LPCTSTR | lpszFileName, | |
bool | bCaseSensitive, | |||
bool | bSporadically, | |||
bool | bFileNameOnly | |||
) |
ZIP_INDEX_TYPE CZipCentralDir::FindFileNameIndex | ( | LPCTSTR | lpszFileName | ) | const |
Finds the index of the file with the given name.
lpszFileName | The name of the file to find. |
ZIP_FILE_INDEX_NOT_FOUND
, if there is no such file with the given name.void CZipCentralDir::GetComment | ( | CZipString & | szComment | ) | const |
ZIP_ARRAY_SIZE_TYPE CZipCentralDir::GetCount | ( | ) | const [inline] |
Returns the number of files in the archive.
Definition at line 418 of file ZipCentralDir.h.
ZIP_INDEX_TYPE CZipCentralDir::GetFindFastIndex | ( | ZIP_INDEX_TYPE | uFindFastIndex | ) | const [inline] |
Returns the Find Fast index.
Definition at line 380 of file ZipCentralDir.h.
void CZipCentralDir::GetInfo | ( | CInfo & | info | ) | const [inline] |
Returns the information about the central directory.
Definition at line 462 of file ZipCentralDir.h.
ZIP_SIZE_TYPE CZipCentralDir::GetSize | ( | bool | bWhole = false |
) | const |
Returns the central directory size.
bWhole | If true , include the size of the file headers. If false , the size of the file headers is not included. |
CZipStorage* CZipCentralDir::GetStorage | ( | ) | [inline] |
Returns the current storage.
Definition at line 513 of file ZipCentralDir.h.
const CZipStringStoreSettings& CZipCentralDir::GetStringStoreSettings | ( | ) | const |
int CZipCentralDir::GetUnicodeMode | ( | ) | const [inline] |
Returns the current Unicode mode.
Definition at line 555 of file ZipCentralDir.h.
void CZipCentralDir::Init | ( | CZipCentralDir * | pSource = NULL |
) |
Initializes the object.
pSource | If not NULL , it specifies the central directory for sharing. |
void CZipCentralDir::InitOnCreate | ( | CZipArchive * | pArchive | ) |
Initializes the central directory during construction.
pArchive | The archive that creates the object. |
ZIP_INDEX_TYPE CZipCentralDir::InsertFindFastElement | ( | CZipFileHeader * | pHeader, | |
ZIP_INDEX_TYPE | uIndex | |||
) | [protected] |
Inserts a new CZipFindFast element to the CZipCentralDir::m_pFindArray array. Initializes the CZipFindFast object with pHeader and uIndex values.
pHeader | The element to insert. | |
uIndex | The original index of pHeader in the central directory. If set to ZIP_FILE_INDEX_UNSPECIFIED , it is assumed to be the last element. |
bool CZipCentralDir::IsAnyFileModified | ( | ) | const |
Examines whether any file is modified.
true
, if there are modified files; false
otherwise.bool CZipCentralDir::IsConsistencyCheckOn | ( | int | iLevel | ) | [inline] |
Returns the value indicating whether the specified consistency check should be performed.
iLevel | The level to check. It can be one or more of the CZipArchive::ConsistencyCheck values. |
true
, if the specified check should be performed; false
otherwise.Definition at line 501 of file ZipCentralDir.h.
bool CZipCentralDir::IsFindFastEnabled | ( | ) | [inline] |
Returns the value indicating whether the Find Fast feature is enabled.
Definition at line 470 of file ZipCentralDir.h.
bool CZipCentralDir::IsValidIndex | ( | ZIP_INDEX_TYPE | uIndex | ) | const |
Tests if the given file index is valid.
uIndex | A zero-based index to test. |
true
, if the file with the given index exists inside the archive; false
otherwise. bool CZipCentralDir::OnFileCentralChange | ( | ) |
Called when data of a file changes in a central directory file header.
true
, if the change is permitted; false
otherwise. bool CZipCentralDir::OnFileNameChange | ( | CZipFileHeader * | pHeader | ) |
Called when a filename of a file in the archive changes.
true
, if the change is permitted; false
otherwise. void CZipCentralDir::OpenFile | ( | ZIP_INDEX_TYPE | uIndex | ) |
Opens the file with the given index.
uIndex | A zero-based index of the file to open. |
const CZipFileHeader* CZipCentralDir::operator[] | ( | ZIP_INDEX_TYPE | uIndex | ) | const [inline] |
Returns the information about the file with the given index.
Definition at line 406 of file ZipCentralDir.h.
CZipFileHeader* CZipCentralDir::operator[] | ( | ZIP_INDEX_TYPE | uIndex | ) | [inline] |
Returns the information about the file with the given index.
Definition at line 395 of file ZipCentralDir.h.
void CZipCentralDir::Read | ( | bool | bExhaustiveRead | ) |
Reads the central directory from the archive.
bExhaustiveRead | true , if the exhaustive read should be performed, false otherwise. |
void CZipCentralDir::ReadHeaders | ( | bool | bExhaustiveRead | ) | [protected] |
Reads file headers from the archive.
bExhaustiveRead | true , if the exhaustive read should be performed, false otherwise. |
void CZipCentralDir::RebuildFindFastArray | ( | ) | [inline] |
Rebuilds the CZipCentralDir::m_pFindArray array.
Definition at line 475 of file ZipCentralDir.h.
void CZipCentralDir::RemoveAll | ( | ) |
Removes all files.
bool CZipCentralDir::RemoveDataDescr | ( | bool | bFromBuffer | ) | [protected] |
Removes data descriptors from a segmented archive that turned out to be single-segment only. It is not called for encrypted files.
bFromBuffer | If true , removes the descriptors from the write buffer in memory otherwise from the file on the disk. |
false
, if the file mapping to memory was not successful (can happen only when bFromBuffer is false
); true
otherwise. void CZipCentralDir::RemoveFile | ( | CZipFileHeader * | pHeader, | |
ZIP_INDEX_TYPE | uIndex = ZIP_FILE_INDEX_UNSPECIFIED , |
|||
bool | bShift = true | |||
) |
Removes a file header from the central directory.
pHeader | The header to remove. | |
uIndex | The index of the header to remove. Use ZIP_FILE_INDEX_UNSPECIFIED , if the index is unknown. | |
bShift | If true , the data inside the archive is moved over the hole created after removing the file. If false , the unused area inside the archive remains. |
ZIP_INDEX_TYPE CZipCentralDir::RemoveFindFastElement | ( | CZipFileHeader * | pHeader, | |
bool | bShift | |||
) | [protected] |
Removes a CZipFindFast element from the CZipCentralDir::m_pFindArray array.
pHeader | The element associated with this object will be removed. | |
bShift | If true , the affected indexes will be shifted; false otherwise. |
void CZipCentralDir::RemoveFromDisk | ( | ) |
Removes physically the central directory from the archive.
void CZipCentralDir::RemoveHeaders | ( | ) | [protected] |
Frees the memory allocated for the CZipFileHeader structures.
void CZipCentralDir::RemoveLastFile | ( | CZipFileHeader * | pHeader = NULL , |
|
ZIP_INDEX_TYPE | uIndex = ZIP_FILE_INDEX_UNSPECIFIED | |||
) |
Removes last file from the central directory.
pHeader | The header to remove. | |
uIndex | The index of the header to remove. Use ZIP_FILE_INDEX_UNSPECIFIED , if the index is unknown. |
void CZipCentralDir::SetComment | ( | LPCTSTR | lpszComment, | |
UINT | codePage | |||
) |
void CZipCentralDir::SetUnicodeMode | ( | int | iMode | ) | [inline] |
Sets the current Unicode mode.
Definition at line 547 of file ZipCentralDir.h.
void CZipCentralDir::ThrowError | ( | int | err | ) | const |
Throws an exception with the given code.
void CZipCentralDir::Write | ( | ) |
Writes the central directory to the archive.
void CZipCentralDir::WriteCentralEnd | ( | ) | [protected] |
Writes the End of Central Directory Record.
void CZipCentralDir::WriteHeaders | ( | bool | bOneDisk | ) | [protected] |
Writes the file headers to the archive.
char CZipCentralDir::m_gszSignature[] [static] |
char CZipCentralDir::m_gszSignature64Locator[] [static] |
The Zip64 End of Central Directory Locator signature.
Definition at line 201 of file ZipCentralDir.h.
Consistency checks to ignore. It can be one or more of the CZipArchive::ConsistencyCheck values.
Definition at line 487 of file ZipCentralDir.h.
int CZipCentralDir::m_iUnicodeMode [protected] |
The current Unicode mode.
Definition at line 600 of file ZipCentralDir.h.
CZipArchive* CZipCentralDir::m_pArchive [protected] |
The reference to the main CZipArchive object.
Definition at line 584 of file ZipCentralDir.h.
CZipArray<CZipFindFast*>* CZipCentralDir::m_pFindArray [protected] |
The Find Fast array.
CInfo::m_bFindFastEnabled
Definition at line 681 of file ZipCentralDir.h.
CZipArray<CZipFileHeader*>* CZipCentralDir::m_pHeaders [protected] |
Holds the information about all files inside the archive.
Definition at line 655 of file ZipCentralDir.h.
CInfo* CZipCentralDir::m_pInfo [protected] |
It points to the currently opened file or it is NULL
, if no file is opened.
Definition at line 202 of file ZipCentralDir.h.
CZipStorage* CZipCentralDir::m_pStorage [protected] |
Points to CZipArchive::m_storage.
Definition at line 589 of file ZipCentralDir.h.