summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/quazip/quazipnewinfo.h
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2015-03-08 19:07:42 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2015-05-02 16:52:14 +0200
commitb230cf3aa24f3883b8b165bd5fd56620a9a95e47 (patch)
tree19e46e3697c98c3e51f7f4e91e3879f95bd0bc43 /rbutil/rbutilqt/quazip/quazipnewinfo.h
parentd4fee369712f006785fd3a8904a5e2b5c529598b (diff)
downloadrockbox-b230cf3aa24f3883b8b165bd5fd56620a9a95e47.tar.gz
rockbox-b230cf3aa24f3883b8b165bd5fd56620a9a95e47.zip
Update quazip to release 0.7.1.
Update to latest quazip release. Note that quazip is now LGPL and not GPL / LGPL dual licensed anymore. Change-Id: Ie1e975b5b546dd31218eef9df472527493fe81e0
Diffstat (limited to 'rbutil/rbutilqt/quazip/quazipnewinfo.h')
-rw-r--r--rbutil/rbutilqt/quazip/quazipnewinfo.h152
1 files changed, 125 insertions, 27 deletions
diff --git a/rbutil/rbutilqt/quazip/quazipnewinfo.h b/rbutil/rbutilqt/quazip/quazipnewinfo.h
index 93ff1a2fc0..bfd498682f 100644
--- a/rbutil/rbutilqt/quazip/quazipnewinfo.h
+++ b/rbutil/rbutilqt/quazip/quazipnewinfo.h
@@ -2,47 +2,52 @@
#define QUA_ZIPNEWINFO_H
/*
--- A kind of "standard" GPL license statement --
-QuaZIP - a Qt/C++ wrapper for the ZIP/UNZIP package
-Copyright (C) 2005-2007 Sergey A. Tachenov
+Copyright (C) 2005-2014 Sergey A. Tachenov
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2 of the License, or (at your
-option) any later version.
+This file is part of QuaZIP.
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-Public License for more details.
+QuaZIP is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 of the License, or
+(at your option) any later version.
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+QuaZIP is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
--- A kind of "standard" GPL license statement ends here --
+You should have received a copy of the GNU Lesser General Public License
+along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
-See COPYING file for GPL.
+See COPYING file for the full LGPL text.
-You are also permitted to use QuaZIP under the terms of LGPL (see
-COPYING.LGPL). You are free to choose either license, but please note
-that QuaZIP makes use of Qt, which is not licensed under LGPL. So if
-you are using Open Source edition of Qt, you therefore MUST use GPL for
-your code based on QuaZIP, since it would be also based on Qt in this
-case. If you are Qt commercial license owner, then you are free to use
-QuaZIP as long as you respect either GPL or LGPL for QuaZIP code.
+Original ZIP package is copyrighted by Gilles Vollant, see
+quazip/(un)zip.h files for details, basically it's zlib license.
**/
#include <QDateTime>
+#include <QFile>
#include <QString>
+#include "quazip_global.h"
+
+#include "quazipfileinfo.h"
+
/// 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).
+ *
+ * Zip64 support of this structure is slightly limited: in the raw mode (when
+ * a pre-compressed file is written into a ZIP file as-is), it is necessary
+ * to specify the uncompressed file size and the appropriate field is 32 bit.
+ * Since the raw mode is used extremely rare, there is no real need to have
+ * a separate QuaZipNewInfo64 structure like QuaZipFileInfo64. It may be added
+ * in the future though, if there is a demand for the raw mode with zip64
+ * archives.
**/
-struct QuaZipNewInfo {
+struct QUAZIP_EXPORT QuaZipNewInfo {
/// File name.
/** This field holds file name inside archive, including path relative
* to archive root.
@@ -58,6 +63,11 @@ struct QuaZipNewInfo {
/// File internal attributes.
quint16 internalAttr;
/// File external attributes.
+ /**
+ The highest 16 bits contain Unix file permissions and type (dir or
+ file). The constructor QuaZipNewInfo(const QString&, const QString&)
+ takes permissions from the provided file.
+ */
quint32 externalAttr;
/// File comment.
/** Will be encoded using QuaZip::getCommentCodec().
@@ -79,15 +89,31 @@ struct QuaZipNewInfo {
**/
QuaZipNewInfo(const QString& name);
/// Constructs QuaZipNewInfo instance.
- /** Initializes name with \a name and dateTime with timestamp of the
- * file named \a file. If the \a file does not exists or its timestamp
+ /** Initializes name with \a name. Timestamp and permissions are taken
+ * from the specified file. If the \a 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
+ * directory file in), uses current time and zero permissions. Other attributes are
* initialized with zeros, comment and extra field with null values.
*
* \sa setFileDateTime()
**/
QuaZipNewInfo(const QString& name, const QString& file);
+ /// Initializes the new instance from existing file info.
+ /** Mainly used when copying files between archives.
+ *
+ * Both extra fields are initialized to existing.extra.
+ * @brief QuaZipNewInfo
+ * @param existing
+ */
+ QuaZipNewInfo(const QuaZipFileInfo &existing);
+ /// Initializes the new instance from existing file info.
+ /** Mainly used when copying files between archives.
+ *
+ * Both extra fields are initialized to existing.extra.
+ * @brief QuaZipNewInfo
+ * @param existing
+ */
+ QuaZipNewInfo(const QuaZipFileInfo64 &existing);
/// Sets the file timestamp from the existing file.
/** Use this function to set the file timestamp from the existing
* file. Use it like this:
@@ -104,6 +130,78 @@ struct QuaZipNewInfo {
* file is inaccessible).
**/
void setFileDateTime(const QString& file);
+ /// Sets the file permissions from the existing file.
+ /**
+ Takes permissions from the file and sets the high 16 bits of
+ external attributes. Uses QFileInfo to get permissions on all
+ platforms.
+ */
+ void setFilePermissions(const QString &file);
+ /// Sets the file permissions.
+ /**
+ Modifies the highest 16 bits of external attributes. The type part
+ is set to dir if the name ends with a slash, and to regular file
+ otherwise.
+ */
+ void setPermissions(QFile::Permissions permissions);
+ /// Sets the NTFS times from an existing file.
+ /**
+ * If the file doesn't exist, a warning is printed to the stderr and nothing
+ * is done. Otherwise, all three times, as reported by
+ * QFileInfo::lastModified(), QFileInfo::lastRead() and QFileInfo::created(),
+ * are written to the NTFS extra field record.
+ *
+ * The NTFS record is written to
+ * both the local and the global extra fields, updating the existing record
+ * if there is one, or creating a new one and appending it to the end
+ * of each extra field.
+ *
+ * The microseconds will be zero, as they aren't reported by QFileInfo.
+ * @param fileName
+ */
+ void setFileNTFSTimes(const QString &fileName);
+ /// Sets the NTFS modification time.
+ /**
+ * The time is written into the NTFS record in
+ * both the local and the global extra fields, updating the existing record
+ * if there is one, or creating a new one and appending it to the end
+ * of each extra field. When updating an existing record, all other fields
+ * are left intact.
+ * @param mTime The new modification time.
+ * @param fineTicks The fractional part of milliseconds, in 100-nanosecond
+ * ticks (i. e. 9999 ticks = 999.9 microsecond). Values greater than
+ * 9999 will add milliseconds or even seconds, but this can be
+ * confusing and therefore is discouraged.
+ */
+ void setFileNTFSmTime(const QDateTime &mTime, int fineTicks = 0);
+ /// Sets the NTFS access time.
+ /**
+ * The time is written into the NTFS record in
+ * both the local and the global extra fields, updating the existing record
+ * if there is one, or creating a new one and appending it to the end
+ * of each extra field. When updating an existing record, all other fields
+ * are left intact.
+ * @param aTime The new access time.
+ * @param fineTicks The fractional part of milliseconds, in 100-nanosecond
+ * ticks (i. e. 9999 ticks = 999.9 microsecond). Values greater than
+ * 9999 will add milliseconds or even seconds, but this can be
+ * confusing and therefore is discouraged.
+ */
+ void setFileNTFSaTime(const QDateTime &aTime, int fineTicks = 0);
+ /// Sets the NTFS creation time.
+ /**
+ * The time is written into the NTFS record in
+ * both the local and the global extra fields, updating the existing record
+ * if there is one, or creating a new one and appending it to the end
+ * of each extra field. When updating an existing record, all other fields
+ * are left intact.
+ * @param cTime The new creation time.
+ * @param fineTicks The fractional part of milliseconds, in 100-nanosecond
+ * ticks (i. e. 9999 ticks = 999.9 microsecond). Values greater than
+ * 9999 will add milliseconds or even seconds, but this can be
+ * confusing and therefore is discouraged.
+ */
+ void setFileNTFScTime(const QDateTime &cTime, int fineTicks = 0);
};
#endif