QuaZip quazip-1-4
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
QuaZipFileInfo64 Struct Reference

Information about a file inside archive (with zip64 support). More...

#include <quazipfileinfo.h>

Collaboration diagram for QuaZipFileInfo64:
Collaboration graph
[legend]

Public Member Functions

QFile::Permissions getPermissions () const
 Get the file permissions.
 
bool isSymbolicLink () const
 Checks whether the file is a symbolic link.
 
bool toQuaZipFileInfo (QuaZipFileInfo &info) const
 Converts to QuaZipFileInfo.
 
QDateTime getNTFSmTime (int *fineTicks=nullptr) const
 Returns the NTFS modification time.
 
QDateTime getNTFSaTime (int *fineTicks=nullptr) const
 Returns the NTFS access time.
 
QDateTime getNTFScTime (int *fineTicks=nullptr) const
 Returns the NTFS creation time.
 
QDateTime getExtModTime () const
 Returns the extended modification timestamp.
 
bool isEncrypted () const
 Checks whether the file is encrypted.
 

Static Public Member Functions

static QuaExtraFieldHash parseExtraField (const QByteArray &extraField)
 Parses extra field.
 
static QDateTime getExtTime (const QByteArray &extra, int flag)
 Extracts extended time from the extra field.
 

Public Attributes

QString name
 File name.
 
quint16 versionCreated
 Version created by.
 
quint16 versionNeeded
 Version needed to extract.
 
quint16 flags
 General purpose flags.
 
quint16 method
 Compression method.
 
QDateTime dateTime
 Last modification date and time.
 
quint32 crc
 CRC.
 
quint64 compressedSize
 Compressed file size.
 
quint64 uncompressedSize
 Uncompressed file size.
 
quint16 diskNumberStart
 Disk number start.
 
quint16 internalAttr
 Internal file attributes.
 
quint32 externalAttr
 External file attributes.
 
QString comment
 Comment.
 
QByteArray extra
 Extra field.
 

Detailed Description

Information about a file inside archive (with zip64 support).

Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to fill this structure.

Member Function Documentation

◆ getPermissions()

QFile::Permissions QuaZipFileInfo64::getPermissions ( ) const

Get the file permissions.

Returns the high 16 bits of external attributes converted to QFile::Permissions.

References externalAttr.

Referenced by JlCompress::extractFile().

◆ isSymbolicLink()

bool QuaZipFileInfo64::isSymbolicLink ( ) const

Checks whether the file is a symbolic link.

Returns true iff the highest 16 bits of the external attributes indicate that the file is a symbolic link according to Unix file mode.

References externalAttr.

Referenced by JlCompress::extractFile().

◆ toQuaZipFileInfo()

bool QuaZipFileInfo64::toQuaZipFileInfo ( QuaZipFileInfo info) const

Converts to QuaZipFileInfo.

If any of the fields are greater than 0xFFFFFFFFu, they are set to 0xFFFFFFFFu exactly, not just truncated. This function should be mainly used for compatibility with the old code expecting QuaZipFileInfo, in the cases when it's impossible or otherwise unadvisable (due to ABI compatibility reasons, for example) to modify that old code to use QuaZipFileInfo64.

Returns
true if all fields converted correctly, false if an overflow occured.

References QuaZipFileInfo::comment, comment, QuaZipFileInfo::compressedSize, compressedSize, QuaZipFileInfo::crc, crc, QuaZipFileInfo::dateTime, dateTime, QuaZipFileInfo::diskNumberStart, diskNumberStart, QuaZipFileInfo::externalAttr, externalAttr, QuaZipFileInfo::extra, extra, QuaZipFileInfo::flags, flags, QuaZipFileInfo::internalAttr, internalAttr, QuaZipFileInfo::method, method, QuaZipFileInfo::name, name, QuaZipFileInfo::uncompressedSize, uncompressedSize, QuaZipFileInfo::versionCreated, versionCreated, QuaZipFileInfo::versionNeeded, and versionNeeded.

Referenced by QuaZip::getCurrentFileInfo(), and QuaZipFile::getFileInfo().

◆ getNTFSmTime()

QDateTime QuaZipFileInfo64::getNTFSmTime ( int *  fineTicks = nullptr) const

Returns the NTFS modification time.

The getNTFS*Time() functions only work if there is an NTFS extra field present. Otherwise, they all return invalid null timestamps.

Parameters
fineTicksIf not null, the fractional part of milliseconds returned there, measured in 100-nanosecond ticks. Will be set to zero if there is no NTFS extra field.
See also
dateTime
getNTFSaTime()
getNTFScTime()
Returns
The NTFS modification time, UTC

References extra.

◆ getNTFSaTime()

QDateTime QuaZipFileInfo64::getNTFSaTime ( int *  fineTicks = nullptr) const

Returns the NTFS access time.

The getNTFS*Time() functions only work if there is an NTFS extra field present. Otherwise, they all return invalid null timestamps.

Parameters
fineTicksIf not null, the fractional part of milliseconds returned there, measured in 100-nanosecond ticks. Will be set to zero if there is no NTFS extra field.
See also
dateTime
getNTFSmTime()
getNTFScTime()
Returns
The NTFS access time, UTC

References extra.

◆ getNTFScTime()

QDateTime QuaZipFileInfo64::getNTFScTime ( int *  fineTicks = nullptr) const

Returns the NTFS creation time.

The getNTFS*Time() functions only work if there is an NTFS extra field present. Otherwise, they all return invalid null timestamps.

Parameters
fineTicksIf not null, the fractional part of milliseconds returned there, measured in 100-nanosecond ticks. Will be set to zero if there is no NTFS extra field.
See also
dateTime
getNTFSmTime()
getNTFSaTime()
Returns
The NTFS creation time, UTC

References extra.

◆ getExtModTime()

QDateTime QuaZipFileInfo64::getExtModTime ( ) const

Returns the extended modification timestamp.

The getExt*Time() functions only work if there is an extended timestamp extra field (ID 0x5455) present. Otherwise, they all return invalid null timestamps.

QuaZipFileInfo64 only contains the modification time because it's extracted from extra, which contains the global extra field, and access and creation time are in the local header which can be accessed through QuaZipFile.

See also
dateTime
QuaZipFile::getExtModTime()
QuaZipFile::getExtAcTime()
QuaZipFile::getExtCrTime()
Returns
The extended modification time, UTC

References extra, and getExtTime().

◆ parseExtraField()

QuaExtraFieldHash QuaZipFileInfo64::parseExtraField ( const QByteArray extraField)
static

Parses extra field.

The returned hash table contains a list of data blocks for every header ID in the provided extra field. The number of data blocks in a hash table value equals to the number of occurrences of the appropriate header id. In most cases, a block with a specific header ID only occurs once, and therefore the returned hash table will contain a list consisting of a single element for that header ID.

Parameters
extraFieldextra field to parse
Returns
header id to list of data block hash

References QDataStream::atEnd(), QByteArray::data(), QDataStream::readRawData(), QByteArray::resize(), QDataStream::setByteOrder(), QByteArray::size(), and QDataStream::status().

Referenced by getExtTime().

◆ getExtTime()

QDateTime QuaZipFileInfo64::getExtTime ( const QByteArray extra,
int  flag 
)
static

Extracts extended time from the extra field.

Utility function used by various getExt*Time() functions, but can be used directly if the extra field is obtained elsewhere (from a third party library, for example).

Parameters
extrathe extra field for a file
flag1 - modification time, 2 - access time, 4 - creation time
Returns
the extracted time or null QDateTime if not present
See also
getExtModTime()
QuaZipFile::getExtModTime()
QuaZipFile::getExtAcTime()
QuaZipFile::getExtCrTime()

References QDateTime::addSecs(), QList::at(), QDataStream::atEnd(), dateTime, extra, flags, QList::isEmpty(), QByteArray::length(), parseExtraField(), and QDataStream::setByteOrder().

Referenced by QuaZipFile::getExtAcTime(), QuaZipFile::getExtCrTime(), QuaZipFile::getExtModTime(), and getExtModTime().

Member Data Documentation

◆ dateTime

QDateTime QuaZipFileInfo64::dateTime

Last modification date and time.

This is the time stored in the standard ZIP header. This format only allows to store time with 2-second precision, so the seconds will always be even and the milliseconds will always be zero. If you need more precise date and time, you can try to call the getNTFSmTime() function or its siblings, provided that the archive itself contains these NTFS times.

Referenced by QuaZip::getCurrentFileInfo(), getExtTime(), and toQuaZipFileInfo().


The documentation for this struct was generated from the following files: