#include <ZipFileHeader.h>
|
class | CZipArchive |
|
class | CZipCentralDir |
|
Represents a single file stored in a zip archive.
Definition at line 44 of file ZipFileHeader.h.
File header state flags.
- See Also
- CZipArchive::UnicodeMode
- Enumerator:
sfNone |
No special flags set.
|
sfCustomUnicode |
The header uses custom Unicode functionality.
|
sfModified |
The file has been modified.
|
Definition at line 57 of file ZipFileHeader.h.
void CZipFileHeader::AdjustLocalComprSize |
( |
| ) |
|
|
inlineprotected |
void CZipFileHeader::AdjustLocalComprSize |
( |
ZIP_SIZE_TYPE & |
uLocalComprSize | ) |
|
|
inlineprotected |
Adjusts the local compressed size.
- Parameters
-
uLocalComprSize | The value to adjust. |
Definition at line 878 of file ZipFileHeader.h.
bool CZipFileHeader::CheckDataDescriptor |
( |
CZipStorage * |
pStorage | ) |
const |
|
protected |
Validates an existing data descriptor after file decompression.
- Parameters
-
pStorage | The storage to read the data descriptor from. |
- Returns
true
, if the data descriptor is valid; false
otherwise.
bool CZipFileHeader::CheckLengths |
( |
bool |
local | ) |
const |
|
inlineprotected |
Validates the member fields lengths. The tested fields are: filename, extra fields and comment.
- Returns
false
, if any of the lengths exceeds the allowed value.
Definition at line 794 of file ZipFileHeader.h.
bool CZipFileHeader::CompressionEfficient |
( |
| ) |
|
|
inline |
Returns the value indicating whether the compression is efficient.
- Returns
true
if the compression is efficient; false
if the file should be stored without the compression instead.
Definition at line 359 of file ZipFileHeader.h.
const CZipString& CZipFileHeader::GetComment |
( |
bool |
bClearBuffer = false | ) |
|
Returns the file comment.
- Parameters
-
bClearBuffer | If true , releases the internal buffer after performing the comment conversion. If false , the internal buffer is not released and both representations of the comment are kept in memory (converted and not converted). This takes more memory, but the conversion does not take place again when the central directory is written back to the archive. |
- Returns
- The file comment.
- See Also
- Modification of Archives: Replacing, Renaming, Deleting and Changing Data
-
SetComment
int CZipFileHeader::GetCompressionLevel |
( |
| ) |
const |
Returns an approximate file compression level.
- Returns
- The compression level. May not be the real value used when compressing the file.
float CZipFileHeader::GetCompressionRatio |
( |
| ) |
|
|
inline |
Returns the compression ratio.
- Returns
- The compression ratio of the file.
Definition at line 373 of file ZipFileHeader.h.
time_t CZipFileHeader::GetCreationTime |
( |
| ) |
const |
|
inline |
WORD CZipFileHeader::GetDataDescriptorSize |
( |
const CZipStorage * |
pStorage | ) |
const |
|
inline |
Returns the data descriptor size as it is required for the current file. Takes into account various factors, such as the archive segmentation type, encryption and the need for the Zip64 format.
- Parameters
-
pStorage | The storage to test for the segmentation type. |
- Returns
- The required data descriptor size in bytes.
Definition at line 283 of file ZipFileHeader.h.
WORD CZipFileHeader::GetDataDescriptorSize |
( |
bool |
bConsiderSignature = false | ) |
const |
Returns the data descriptor size as it is required for the current file. Takes into account various factors, such as the need for the data descriptor signature or for the Zip64 format.
- Parameters
-
bConsiderSignature | true , if the data descriptor signature is needed; false otherwise. |
- Returns
- The required data descriptor size in bytes.
ZIP_SIZE_TYPE CZipFileHeader::GetDataSize |
( |
bool |
bReal | ) |
const |
|
inline |
Returns the size of the compressed data.
- Parameters
-
bReal | Set to true when calling for a file already in an archive. Set to false when the header is not a part of the archive. |
- Returns
- The compressed data size in bytes.
- See Also
- GetEncryptedInfoSize
Definition at line 314 of file ZipFileHeader.h.
DWORD CZipFileHeader::GetEncryptedInfoSize |
( |
| ) |
const |
|
inline |
Returns the encrypted information size. The returned value depends on the used encryption method.
- Returns
- The encrypted information size in bytes.
Definition at line 326 of file ZipFileHeader.h.
int CZipFileHeader::GetEncryptionMethod |
( |
| ) |
const |
|
inline |
CZipString CZipFileHeader::GetFileExtension |
( |
bool |
bLowerCase = false , |
|
|
bool |
bClearBuffer = true |
|
) |
| |
const CZipString& CZipFileHeader::GetFileName |
( |
bool |
bClearBuffer = true | ) |
|
CZipString CZipFileHeader::GetFileTitle |
( |
bool |
bLowerCase = false , |
|
|
bool |
bClearBuffer = true |
|
) |
| |
time_t CZipFileHeader::GetLastAccessTime |
( |
| ) |
const |
|
inline |
DWORD CZipFileHeader::GetLocalSize |
( |
bool |
bReal | ) |
const |
Returns the local header size. Before calling this method, the local information must be up-to-date (see Requesting Information, Predicting Names and Sizes for more information).
- Parameters
-
bReal | If true , uses the real local filename size. If false , predicts the filename size. |
- Returns
- The local header size in bytes.
time_t CZipFileHeader::GetModificationTime |
( |
| ) |
const |
DWORD CZipFileHeader::GetOriginalAttributes |
( |
| ) |
const |
|
inline |
Returns the file attributes exactly as they are stored in the archive.
- Returns
- The file attributes as they are stored in the archive. No conversion is performed.
- Note
- The attributes for Linux are stored shifted left by 16 bits in this field.
- See Also
- GetSystemAttr
Definition at line 528 of file ZipFileHeader.h.
DWORD CZipFileHeader::GetSize |
( |
| ) |
const |
Returns the total size of this structure in the central directory.
- Returns
- The total size in bytes.
DWORD CZipFileHeader::GetSystemAttr |
( |
| ) |
|
Returns the file attributes.
- Returns
- The file attributes, converted if necessary to be compatible with the current system.
- Note
- Throws an exception, if the archive system or the current system is not supported by the ZipArchive Library.
- See Also
- GetOriginalAttributes
int CZipFileHeader::GetSystemCompatibility |
( |
| ) |
const |
|
inline |
Returns the file system compatibility. External software can use this information e.g. to determine end-of-line format for text files etc. The ZipArchive Library uses it to perform a proper file attributes conversion.
- Returns
- The file system compatibility. It can be one of the ZipCompatibility::ZipPlatforms values.
- See Also
- CZipArchive::GetSystemComatibility
-
ZipPlatform::GetSystemID
Definition at line 481 of file ZipFileHeader.h.
bool CZipFileHeader::HasTime |
( |
| ) |
const |
|
inline |
Returns the value indicating whether the current CZipFileHeader object has the time set.
- Returns
true
, if the time is set; false
otherwise.
Definition at line 606 of file ZipFileHeader.h.
bool CZipFileHeader::IsDataDescriptor |
( |
| ) |
const |
|
inline |
Returns the value indicating whether the data descriptor is present.
- Returns
true
, if the data descriptor is present; false
otherwise.
Definition at line 270 of file ZipFileHeader.h.
bool CZipFileHeader::IsDirectory |
( |
| ) |
|
Returns the value indicating whether the file represents a directory. This method checks the file attributes. If the attributes value is zero, the method checks for the presence of a path separator at the end of the filename. If the path separator is present, the file is assumed to be a directory.
- Returns
true
, if the file represents a directory; false
otherwise.
bool CZipFileHeader::IsEncrypted |
( |
| ) |
const |
|
inline |
bool CZipFileHeader::IsModified |
( |
| ) |
const |
|
inline |
bool CZipFileHeader::IsWinZipAesEncryption |
( |
| ) |
const |
|
inline |
Returns the value indicating whether the file is encrypted using WinZip AES encryption method.
- Returns
true
, if the file is encrypted using WinZip AES encryption method; false
otherwise.
Definition at line 587 of file ZipFileHeader.h.
bool CZipFileHeader::NeedsDataDescriptor |
( |
| ) |
const |
|
protected |
Returns the value indicating whether the file needs the data descriptor. The data descriptor is needed when a file is encrypted or the Zip64 format needs to be used.
- Returns
true
, if the data descriptor is needed; false
otherwise.
bool CZipFileHeader::NeedsSignatureInDataDescriptor |
( |
const CZipStorage * |
pStorage | ) |
const |
|
inlineprotected |
Returns the value indicating whether the signature in the data descriptor is needed.
- Parameters
-
pStorage | The current storage. |
- Returns
true
, if the signature is needed; false
otherwise.
Definition at line 851 of file ZipFileHeader.h.
int CZipFileHeader::PredictCommentSize |
( |
| ) |
const |
|
inline |
Predicts a file comment size.
- Returns
- The number of characters in the comment not including a terminating
NULL
character.
Definition at line 98 of file ZipFileHeader.h.
int CZipFileHeader::PredictFileNameSize |
( |
| ) |
const |
|
inline |
Predicts the filename size after conversion using the current filename code page.
- Returns
- The number of characters not including a terminating
NULL
character.
Definition at line 81 of file ZipFileHeader.h.
void CZipFileHeader::PrepareData |
( |
int |
iLevel, |
|
|
bool |
bSegm |
|
) |
| |
|
protected |
Prepares the data for writing when adding a new file. When Zip64 extensions are required for this file, this method adds Zip64 extra data to m_aLocalExtraData.
- Parameters
-
iLevel | The compression level. |
bSegm | Set to true , if the archive is segmented; false otherwise. |
void CZipFileHeader::PrepareStringBuffers |
( |
| ) |
|
|
inlineprotected |
Prepares the filename for writing to the archive.
Definition at line 700 of file ZipFileHeader.h.
bool CZipFileHeader::Read |
( |
bool |
bReadSignature | ) |
|
|
protected |
Reads the central file header from pStorage and validates the read data.
- Parameters
-
bReadSignature | true , if the the central header signature should be read; false otherwise. |
- Returns
true
, if the read data is consistent; false
otherwise.
Reads the local file header from the archive and validates the read data.
- Parameters
-
pCentralDir | Used when the archive was opened with CZipArchive::OpenFrom method. Points to the original central directory. |
- Returns
true
, if the data read is consistent; false
otherwise.
- See Also
- CZipArchive::SetIgnoredConsistencyChecks
bool CZipFileHeader::SetComment |
( |
LPCTSTR |
lpszComment | ) |
|
void CZipFileHeader::SetCreationTime |
( |
const time_t & |
ttime | ) |
|
|
inline |
bool CZipFileHeader::SetFileName |
( |
LPCTSTR |
lpszFileName, |
|
|
bool |
bInCentralOnly = false |
|
) |
| |
Sets the filename.
The actual renaming of the file inside of the archive depends on the current commit mode.
- Parameters
-
lpszFileName | The filename to set. |
bInCentralOnly | If set to true , rename the file in the central directory only. The local header will not be changed. This way a file can be renamed quickly and safer. Most of the software (excluding XCeed) usually doesn't pay an attention to the information in the local header. |
- Returns
true
, if the method succeeded; false
, if the current state of the archive is invalid for this method to be called.
- Note
- Leading path separators are removed from the filename unless the header is a directory and the filename contains of only one path separator (indicating a root path).
- See Also
- Modification of Archives: Replacing, Renaming, Deleting and Changing Data
-
GetFileName
-
GetFileTitle
-
GetFileExtension
-
CZipArchive::CommitChanges
void CZipFileHeader::SetLastAccessTime |
( |
const time_t & |
ttime | ) |
|
|
inline |
void CZipFileHeader::SetModificationTime |
( |
const time_t & |
ttime, |
|
|
bool |
bFullResolution = false , |
|
|
bool |
bUseUtcTime = false |
|
) |
| |
Sets the file modification time.
- Parameters
-
ttime | The time to set. |
bFullResolution | If true , file time will be additionally stored as 64-bit Windows file time in a dedicated extra header. Regular PKZIP format will be preserved allowing proper extraction of the archive by software that do not support this extension. If false , the extra header will not be used and creation and last access time will be cleared. |
bUseUtcTime | If true , UTC time will be used. If false , local time will be used. |
- See Also
- CZipArchive::SetFullFileTimes
-
GetModificationTime
-
Modification of Archives: Replacing, Renaming, Deleting and Changing Data
bool CZipFileHeader::SetSystemAttr |
( |
DWORD |
uAttr | ) |
|
Sets the file attributes.
- Parameters
-
uAttr | The attributes to set. The high-word should no be set in attributes, it will be overwritten by Unix attributes, which are stored in high-word. |
- Note
- Throws an exception, if the archive system or the current system is not supported by the ZipArchive Library.
- See Also
- GetSystemAttr
void CZipFileHeader::SetSystemCompatibility |
( |
int |
iSystemID, |
|
|
bool |
bUpdateAttr = false |
|
) |
| |
|
inlineprotected |
void CZipFileHeader::UpdateFlag |
( |
bool |
bSegm | ) |
|
|
inlineprotected |
Updates the general purpose bit flag.
- Parameters
-
bSegm | true , if the current archive is a segmented archive; false otherwise. |
Definition at line 903 of file ZipFileHeader.h.
void CZipFileHeader::UpdateLocalHeader |
( |
CZipStorage * |
pStorage | ) |
|
|
protected |
Updates the local header in the archive after is has already been written.
- Parameters
-
pStorage | The storage to update the data descriptor in. |
static bool CZipFileHeader::VerifySignature |
( |
CZipAutoBuffer & |
buf | ) |
|
|
inlinestaticprotected |
Verifies the central header signature.
- Parameters
-
buf | The buffer that contains the signature to verify. |
- Returns
true
, if the signature is valid; false
otherwise.
Definition at line 892 of file ZipFileHeader.h.
Writes the central file header to pStorage.
- Parameters
-
pCentralDir | The central directory the header belongs to. |
- Returns
- The size of the file header.
void CZipFileHeader::WriteCrc32 |
( |
char * |
pBuf | ) |
const |
|
protected |
Writes the Crc32 to pBuf.
- Parameters
-
pBuf | The buffer to write the Crc32 to. Must have be of at least 4 bytes size. |
void CZipFileHeader::WriteDataDescriptor |
( |
CZipStorage * |
pStorage | ) |
|
|
protected |
Writes the data descriptor taking into account the Zip64 format.
- Parameters
-
pStorage | The storage to write the data descriptor to. |
void CZipFileHeader::WriteLocal |
( |
CZipStorage * |
pStorage | ) |
|
|
protected |
Writes the local file header to the pStorage. The filename and extra field are the same as those that will be stored in the central directory.
- Parameters
-
pStorage | The storage to write the local file header to. |
void CZipFileHeader::WriteSmallDataDescriptor |
( |
char * |
pDest, |
|
|
bool |
bLocal = true |
|
) |
| |
|
protected |
Writes the data descriptor.
- Parameters
-
pDest | The buffer to receive the data. |
bLocal | Set to true , if the local sizes are used; false otherwise. |
The local extra field. Do not modify it after you started compressing the file.
Definition at line 653 of file ZipFileHeader.h.
bool CZipFileHeader::m_bIgnoreCrc32 |
|
protected |
The value indicating whether to ignore Crc32 checking.
Definition at line 663 of file ZipFileHeader.h.
char CZipFileHeader::m_gszLocalSignature[] |
|
static |
char CZipFileHeader::m_gszSignature[] |
|
static |
The parent central directory. It can be NULL
when the header is not a part of central directory.
Definition at line 666 of file ZipFileHeader.h.
time_t CZipFileHeader::m_tCreationTime |
|
protected |
The file creation time (stored in the NTFS extra field).
Definition at line 657 of file ZipFileHeader.h.
time_t CZipFileHeader::m_tLastAccessTime |
|
protected |
The file last access time (stored in the NTFS extra field).
Definition at line 658 of file ZipFileHeader.h.
time_t CZipFileHeader::m_tModificationTime |
|
protected |
The file modification time (stored in the NTFS extra field).
Definition at line 656 of file ZipFileHeader.h.
ZIP_SIZE_TYPE CZipFileHeader::m_uComprSize |
DWORD CZipFileHeader::m_uCrc32 |
BYTE CZipFileHeader::m_uEncryptionMethod |
|
protected |
DWORD CZipFileHeader::m_uExternalAttr |
|
protected |
WORD CZipFileHeader::m_uFlag |
WORD CZipFileHeader::m_uInternalAttr |
ZIP_SIZE_TYPE CZipFileHeader::m_uLocalComprSize |
The compressed size written in the local header.
Definition at line 650 of file ZipFileHeader.h.
WORD CZipFileHeader::m_uLocalFileNameSize |
|
protected |
ZIP_SIZE_TYPE CZipFileHeader::m_uLocalUncomprSize |
The uncompressed size written in the local header.
Definition at line 651 of file ZipFileHeader.h.
WORD CZipFileHeader::m_uMethod |
WORD CZipFileHeader::m_uModDate |
WORD CZipFileHeader::m_uModTime |
ZIP_SIZE_TYPE CZipFileHeader::m_uOffset |
ZIP_SIZE_TYPE CZipFileHeader::m_uUncomprSize |
unsigned char CZipFileHeader::m_uVersionMadeBy |
The version of the software that created the archive.
Definition at line 639 of file ZipFileHeader.h.
WORD CZipFileHeader::m_uVersionNeeded |
ZIP_VOLUME_TYPE CZipFileHeader::m_uVolumeStart |
The volume number at which the compressed file starts.
Definition at line 648 of file ZipFileHeader.h.
The documentation for this class was generated from the following file: