1
#ifndef QUA_ZIPNEWINFO_H
2
#define QUA_ZIPNEWINFO_H
5
Copyright (C) 2005-2011 Sergey A. Tachenov
7
This program is free software; you can redistribute it and/or modify it
8
under the terms of the GNU Lesser General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or (at
10
your option) any later version.
12
This program is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15
General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public License
18
along with this program; if not, write to the Free Software Foundation,
19
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
See COPYING file for the full LGPL text.
23
Original ZIP package is copyrighted by Gilles Vollant, see
24
quazip/(un)zip.h files for details, basically it's zlib license.
30
#include "quazip_global.h"
32
/// Information about a file to be created.
33
/** This structure holds information about a file to be created inside
34
* ZIP archive. At least name should be set to something correct before
35
* passing this structure to
36
* QuaZipFile::open(OpenMode,const QuaZipNewInfo&,int,int,bool).
38
struct QUAZIP_EXPORT QuaZipNewInfo
41
/** This field holds file name inside archive, including path relative
46
/** This is the last file modification date and time. Will be stored
47
* in the archive central directory. It is a good practice to set it
48
* to the source file timestamp instead of archive creating time. Use
49
* setFileDateTime() or QuaZipNewInfo(const QString&, const QString&).
52
/// File internal attributes.
54
/// File external attributes.
57
/** Will be encoded using QuaZip::getCommentCodec().
60
/// File local extra field.
61
QByteArray extraLocal;
62
/// File global extra field.
63
QByteArray extraGlobal;
64
/// Uncompressed file size.
65
/** This is only needed if you are using raw file zipping mode, i. e.
66
* adding precompressed file in the zip archive.
68
ulong uncompressedSize;
69
/// Constructs QuaZipNewInfo instance.
70
/** Initializes name with \a name, dateTime with current date and
71
* time. Attributes are initialized with zeros, comment and extra
72
* field with null values.
74
QuaZipNewInfo(const QString& name);
75
/// Constructs QuaZipNewInfo instance.
76
/** Initializes name with \a name and dateTime with timestamp of the
77
* file named \a file. If the \a file does not exists or its timestamp
78
* is inaccessible (e. g. you do not have read permission for the
79
* directory file in), uses current date and time. Attributes are
80
* initialized with zeros, comment and extra field with null values.
82
* \sa setFileDateTime()
84
QuaZipNewInfo(const QString& name, const QString& file);
85
/// Sets the file timestamp from the existing file.
86
/** Use this function to set the file timestamp from the existing
87
* file. Use it like this:
89
* QuaZipFile zipFile(&zip);
90
* QFile file("file-to-add");
91
* file.open(QIODevice::ReadOnly);
92
* QuaZipNewInfo info("file-name-in-archive");
93
* info.setFileDateTime("file-to-add"); // take the timestamp from file
94
* zipFile.open(QIODevice::WriteOnly, info);
97
* This function does not change dateTime if some error occured (e. g.
98
* file is inaccessible).
100
void setFileDateTime(const QString& file);