FGx  1
Public Member Functions | Public Attributes | List of all members
QuaZipNewInfo Struct Reference

Information about a file to be created. More...

#include <quazipnewinfo.h>

Public Member Functions

 QuaZipNewInfo (const QString &name)
 Constructs QuaZipNewInfo instance. More...
 
 QuaZipNewInfo (const QString &name, const QString &file)
 Constructs QuaZipNewInfo instance. More...
 
void setFileDateTime (const QString &file)
 Sets the file timestamp from the existing file. More...
 

Public Attributes

QString name
 File name. More...
 
QDateTime dateTime
 File timestamp. More...
 
quint16 internalAttr
 File internal attributes.
 
quint32 externalAttr
 File external attributes.
 
QString comment
 File comment. More...
 
QByteArray extraLocal
 File local extra field.
 
QByteArray extraGlobal
 File global extra field.
 
ulong uncompressedSize
 Uncompressed file size. More...
 

Detailed Description

Information about a file to be created.

This structure holds information about a file to be created inside ZIP archive. At least name should be set to something correct before passing this structure to QuaZipFile::open(OpenMode,const QuaZipNewInfo&,int,int,bool).

Constructor & Destructor Documentation

◆ QuaZipNewInfo() [1/2]

QuaZipNewInfo::QuaZipNewInfo ( const QString &  name)

Constructs QuaZipNewInfo instance.

Initializes name with name, dateTime with current date and time. Attributes are initialized with zeros, comment and extra field with null values.

◆ QuaZipNewInfo() [2/2]

QuaZipNewInfo::QuaZipNewInfo ( const QString &  name,
const QString &  file 
)

Constructs QuaZipNewInfo instance.

Initializes name with name and dateTime with timestamp of the file named file. If the file does not exists or its timestamp is inaccessible (e. g. you do not have read permission for the directory file in), uses current date and time. Attributes are initialized with zeros, comment and extra field with null values.

See also
setFileDateTime()

Member Function Documentation

◆ setFileDateTime()

void QuaZipNewInfo::setFileDateTime ( const QString &  file)

Sets the file timestamp from the existing file.

Use this function to set the file timestamp from the existing file. Use it like this:

QuaZipFile zipFile(&zip);
QFile file("file-to-add");
file.open(QIODevice::ReadOnly);
QuaZipNewInfo info("file-name-in-archive");
info.setFileDateTime("file-to-add"); // take the timestamp from file
zipFile.open(QIODevice::WriteOnly, info);

This function does not change dateTime if some error occured (e. g. file is inaccessible).

Member Data Documentation

◆ comment

QString QuaZipNewInfo::comment

File comment.

Will be encoded using QuaZip::getCommentCodec().

◆ dateTime

QDateTime QuaZipNewInfo::dateTime

File timestamp.

This is the last file modification date and time. Will be stored in the archive central directory. It is a good practice to set it to the source file timestamp instead of archive creating time. Use setFileDateTime() or QuaZipNewInfo(const QString&, const QString&).

◆ name

QString QuaZipNewInfo::name

File name.

This field holds file name inside archive, including path relative to archive root.

◆ uncompressedSize

ulong QuaZipNewInfo::uncompressedSize

Uncompressed file size.

This is only needed if you are using raw file zipping mode, i. e. adding precompressed file in the zip archive.


The documentation for this struct was generated from the following files:
QuaZipFile
A file inside ZIP archive.
Definition: quazipfile.h:65
QuaZipNewInfo
Information about a file to be created.
Definition: quazipnewinfo.h:38