From b230cf3aa24f3883b8b165bd5fd56620a9a95e47 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 8 Mar 2015 19:07:42 +0100 Subject: 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 --- rbutil/rbutilqt/quazip/quazipfileinfo.h | 157 ++++++++++++++++++++++++++------ 1 file changed, 131 insertions(+), 26 deletions(-) (limited to 'rbutil/rbutilqt/quazip/quazipfileinfo.h') diff --git a/rbutil/rbutilqt/quazip/quazipfileinfo.h b/rbutil/rbutilqt/quazip/quazipfileinfo.h index 3216d776d5..4e142a4eb5 100644 --- a/rbutil/rbutilqt/quazip/quazipfileinfo.h +++ b/rbutil/rbutilqt/quazip/quazipfileinfo.h @@ -2,44 +2,43 @@ #define QUA_ZIPFILEINFO_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 . -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 and contributors, +see quazip/(un)zip.h files for details. Basically it's the zlib license. +*/ #include #include +#include + +#include "quazip_global.h" /// Information about a file inside archive. -/** Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to +/** + * \deprecated Use QuaZipFileInfo64 instead. Not only it supports large files, + * but also more convenience methods as well. + * + * Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to * fill this structure. */ -struct QuaZipFileInfo { +struct QUAZIP_EXPORT QuaZipFileInfo { /// File name. QString name; /// Version created by. @@ -68,6 +67,112 @@ struct QuaZipFileInfo { QString comment; /// Extra field. QByteArray extra; + /// Get the file permissions. + /** + Returns the high 16 bits of external attributes converted to + QFile::Permissions. + */ + QFile::Permissions getPermissions() const; +}; + +/// Information about a file inside archive (with zip64 support). +/** Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to + * fill this structure. */ +struct QUAZIP_EXPORT QuaZipFileInfo64 { + /// File name. + QString name; + /// Version created by. + quint16 versionCreated; + /// Version needed to extract. + quint16 versionNeeded; + /// General purpose flags. + quint16 flags; + /// Compression method. + quint16 method; + /// 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. + */ + QDateTime dateTime; + /// CRC. + quint32 crc; + /// Compressed file size. + quint64 compressedSize; + /// Uncompressed file size. + quint64 uncompressedSize; + /// Disk number start. + quint16 diskNumberStart; + /// Internal file attributes. + quint16 internalAttr; + /// External file attributes. + quint32 externalAttr; + /// Comment. + QString comment; + /// Extra field. + QByteArray extra; + /// Get the file permissions. + /** + Returns the high 16 bits of external attributes converted to + QFile::Permissions. + */ + QFile::Permissions getPermissions() 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. + + \return \c true if all fields converted correctly, \c false if an overflow + occured. + */ + bool toQuaZipFileInfo(QuaZipFileInfo &info) 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. + * @param fineTicks If 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. + * @sa dateTime + * @sa getNTFSaTime() + * @sa getNTFScTime() + * @return The NTFS modification time, UTC + */ + QDateTime getNTFSmTime(int *fineTicks = NULL) 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. + * @param fineTicks If 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. + * @sa dateTime + * @sa getNTFSmTime() + * @sa getNTFScTime() + * @return The NTFS access time, UTC + */ + QDateTime getNTFSaTime(int *fineTicks = NULL) 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. + * @param fineTicks If 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. + * @sa dateTime + * @sa getNTFSmTime() + * @sa getNTFSaTime() + * @return The NTFS creation time, UTC + */ + QDateTime getNTFScTime(int *fineTicks = NULL) const; + /// Checks whether the file is encrypted. + bool isEncrypted() const {return (flags & 1) != 0;} }; #endif -- cgit v1.2.3