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 {
40
/** This field holds file name inside archive, including path relative
45
/** This is the last file modification date and time. Will be stored
46
* in the archive central directory. It is a good practice to set it
47
* to the source file timestamp instead of archive creating time. Use
48
* setFileDateTime() or QuaZipNewInfo(const QString&, const QString&).
51
/// File internal attributes.
53
/// File external attributes.
56
/** Will be encoded using QuaZip::getCommentCodec().
59
/// File local extra field.
60
QByteArray extraLocal;
61
/// File global extra field.
62
QByteArray extraGlobal;
63
/// Uncompressed file size.
64
/** This is only needed if you are using raw file zipping mode, i. e.
65
* adding precompressed file in the zip archive.
67
ulong uncompressedSize;
68
/// Constructs QuaZipNewInfo instance.
69
/** Initializes name with \a name, dateTime with current date and
70
* time. Attributes are initialized with zeros, comment and extra
71
* field with null values.
73
QuaZipNewInfo(const QString& name);
74
/// Constructs QuaZipNewInfo instance.
75
/** Initializes name with \a name and dateTime with timestamp of the
76
* file named \a file. If the \a file does not exists or its timestamp
77
* is inaccessible (e. g. you do not have read permission for the
78
* directory file in), uses current date and time. Attributes are
79
* initialized with zeros, comment and extra field with null values.
81
* \sa setFileDateTime()
83
QuaZipNewInfo(const QString& name, const QString& file);
84
/// Sets the file timestamp from the existing file.
85
/** Use this function to set the file timestamp from the existing
86
* file. Use it like this:
88
* QuaZipFile zipFile(&zip);
89
* QFile file("file-to-add");
90
* file.open(QIODevice::ReadOnly);
91
* QuaZipNewInfo info("file-name-in-archive");
92
* info.setFileDateTime("file-to-add"); // take the timestamp from file
93
* zipFile.open(QIODevice::WriteOnly, info);
96
* This function does not change dateTime if some error occured (e. g.
97
* file is inaccessible).
99
void setFileDateTime(const QString& file);