| 1 | #cxx . . $ `<file>/quazip/quazipnewinfo.h`/ifndef QUA_ZIPNEWINFO_H |
| 2 | #define QUA_ZIPNEWINFO_Hcxx . . $ `quazip/quazipnewinfo.h:2:9`! |
| 3 | |
| 4 | /* |
| 5 | Copyright (C) 2005-2014 Sergey A. Tachenov |
| 6 | |
| 7 | This file is part of QuaZip. |
| 8 | |
| 9 | QuaZip is free software: you can redistribute it and/or modify |
| 10 | it under the terms of the GNU Lesser General Public License as published by |
| 11 | the Free Software Foundation, either version 2.1 of the License, or |
| 12 | (at your option) any later version. |
| 13 | |
| 14 | QuaZip is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | GNU Lesser General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU Lesser General Public License |
| 20 | along with QuaZip. If not, see <http://www.gnu.org/licenses/>. |
| 21 | |
| 22 | See COPYING file for the full LGPL text. |
| 23 | |
| 24 | Original ZIP package is copyrighted by Gilles Vollant, see |
| 25 | quazip/(un)zip.h files for details, basically it's zlib license. |
| 26 | **/ |
| 27 | |
| 28 | #include <QtCore/QDateTime> |
| 29 | #include <QtCore/QFile> |
| 30 | #include <QtCore/QString> |
| 31 | |
| 32 | #include "quazip_global.h"cxx . . $ `<file>/quazip/quazip_global.h`/ |
| 33 | |
| 34 | #include "quazipfileinfo.h"cxx . . $ `<file>/quazip/quazipfileinfo.h`/ |
| 35 | |
| 36 | /// Information about a file to be created. |
| 37 | /** This structure holds information about a file to be created inside |
| 38 | * ZIP archive. At least name should be set to something correct before |
| 39 | * passing this structure to |
| 40 | * QuaZipFile::open(OpenMode,const QuaZipNewInfo&,int,int,bool). |
| 41 | * |
| 42 | * Zip64 support of this structure is slightly limited: in the raw mode (when |
| 43 | * a pre-compressed file is written into a ZIP file as-is), it is necessary |
| 44 | * to specify the uncompressed file size and the appropriate field is 32 bit. |
| 45 | * Since the raw mode is used extremely rare, there is no real need to have |
| 46 | * a separate QuaZipNewInfo64 structure like QuaZipFileInfo64. It may be added |
| 47 | * in the future though, if there is a demand for the raw mode with zip64 |
| 48 | * archives. |
| 49 | **/ |
| 50 | struct QUAZIP_EXPORTcxx . . $ `quazip/quazip_global.h:44:10`! QuaZipNewInfocxx . . $ QuaZipNewInfo# { |
| 51 | /// File name. |
| 52 | /** This field holds file name inside archive, including path relative |
| 53 | * to archive root. |
| 54 | **/ |
| 55 | QStringcxx . . $ QString# namecxx . . $ QuaZipNewInfo#name.; |
| 56 | /// File timestamp. |
| 57 | /** This is the last file modification date and time. Will be stored |
| 58 | * in the archive central directory. It is a good practice to set it |
| 59 | * to the source file timestamp instead of archive creating time. Use |
| 60 | * setFileDateTime() or QuaZipNewInfo(const QString&, const QString&). |
| 61 | **/ |
| 62 | QDateTimecxx . . $ QDateTime# dateTimecxx . . $ QuaZipNewInfo#dateTime.{cxx . . $ QDateTime#QDateTime(ced63f7c635d850d).}; |
| 63 | /// File internal attributes. |
| 64 | quint16cxx . . $ quint16# internalAttrcxx . . $ QuaZipNewInfo#internalAttr.{}; |
| 65 | /// File external attributes. |
| 66 | /** |
| 67 | The highest 16 bits contain Unix file permissions and type (dir or |
| 68 | file). The constructor QuaZipNewInfo(const QString&, const QString&) |
| 69 | takes permissions from the provided file. |
| 70 | */ |
| 71 | quint32cxx . . $ quint32# externalAttrcxx . . $ QuaZipNewInfo#externalAttr.{}; |
| 72 | /// File comment. |
| 73 | /** Will be encoded in UTF-8 encoding. |
| 74 | **/ |
| 75 | QStringcxx . . $ QString# commentcxx . . $ QuaZipNewInfo#comment.; |
| 76 | /// File local extra field. |
| 77 | QByteArraycxx . . $ QByteArray# extraLocalcxx . . $ QuaZipNewInfo#extraLocal.; |
| 78 | /// File global extra field. |
| 79 | QByteArraycxx . . $ QByteArray# extraGlobalcxx . . $ QuaZipNewInfo#extraGlobal.; |
| 80 | /// Uncompressed file size. |
| 81 | /** This is only needed if you are using raw file zipping mode, i. e. |
| 82 | * adding precompressed file in the zip archive. |
| 83 | **/ |
| 84 | ulongcxx . . $ ulong# uncompressedSizecxx . . $ QuaZipNewInfo#uncompressedSize.{}; |
| 85 | /// Constructs QuaZipNewInfo instance. |
| 86 | /** Initializes name with \a name, dateTime with current date and |
| 87 | * time. Attributes are initialized with zeros, comment and extra |
| 88 | * field with null values. |
| 89 | **/ |
| 90 | QuaZipNewInfocxx . . $ QuaZipNewInfo#QuaZipNewInfo(3520e46b33348bf6).(const QStringcxx . . $ QString#& name); |
| 91 | /// Constructs QuaZipNewInfo instance. |
| 92 | /** Initializes name with \a name. Timestamp and permissions are taken |
| 93 | * from the specified file. If the \a file does not exists or its timestamp |
| 94 | * is inaccessible (e. g. you do not have read permission for the |
| 95 | * directory file in), uses current time and zero permissions. Other attributes are |
| 96 | * initialized with zeros, comment and extra field with null values. |
| 97 | * \sa setFileDateTime() |
| 98 | **/ |
| 99 | QuaZipNewInfocxx . . $ QuaZipNewInfo#QuaZipNewInfo(c1427772cd1877b0).(const QStringcxx . . $ QString#& name, const QStringcxx . . $ QString#& file); |
| 100 | /// Constructs QuaZipNewInfo instance. |
| 101 | /** Initializes name with \a name and provided timestamp. Permissions are taken |
| 102 | * from the specified file. If the \a file does not exists or |
| 103 | * is inaccessible (e. g. you do not have read permission for the |
| 104 | * directory file in), uses zero permissions. Other attributes are |
| 105 | * initialized with zeros, comment and extra field with null values. |
| 106 | * \sa setFileDateTime() |
| 107 | **/ |
| 108 | QuaZipNewInfocxx . . $ QuaZipNewInfo#QuaZipNewInfo(bbbc7d840a9d1ce1).(const QStringcxx . . $ QString#& name, const QStringcxx . . $ QString#& file, const QDateTimecxx . . $ QDateTime#& dateTime); |
| 109 | /// Initializes the new instance from existing file info. |
| 110 | /** Mainly used when copying files between archives. |
| 111 | * |
| 112 | * Both extra fields are initialized to existing.extra. |
| 113 | * @brief QuaZipNewInfo |
| 114 | * @param existing |
| 115 | */ |
| 116 | QuaZipNewInfocxx . . $ QuaZipNewInfo#QuaZipNewInfo(d5e4688a80b1b0b2).(const QuaZipFileInfocxx . . $ QuaZipFileInfo# &existing); |
| 117 | /// Initializes the new instance from existing file info. |
| 118 | /** Mainly used when copying files between archives. |
| 119 | * |
| 120 | * Both extra fields are initialized to existing.extra. |
| 121 | * @brief QuaZipNewInfo |
| 122 | * @param existing |
| 123 | */ |
| 124 | QuaZipNewInfocxx . . $ QuaZipNewInfo#QuaZipNewInfo(4da10542eea36edf).(const QuaZipFileInfo64cxx . . $ QuaZipFileInfo64# &existing); |
| 125 | /// Sets the file timestamp from the existing file. |
| 126 | /** Use this function to set the file timestamp from the existing |
| 127 | * file. Use it like this: |
| 128 | * \code |
| 129 | * QuaZipFile zipFile(&zip); |
| 130 | * QFile file("file-to-add"); |
| 131 | * file.open(QIODevice::ReadOnly); |
| 132 | * QuaZipNewInfo info("file-name-in-archive"); |
| 133 | * info.setFileDateTime("file-to-add"); // take the timestamp from file |
| 134 | * zipFile.open(QIODevice::WriteOnly, info); |
| 135 | * \endcode |
| 136 | * |
| 137 | * This function does not change dateTime if some error occured (e. g. |
| 138 | * file is inaccessible). |
| 139 | **/ |
| 140 | void setFileDateTimecxx . . $ QuaZipNewInfo#setFileDateTime(3520e46b33348bf6).(const QStringcxx . . $ QString#& file); |
| 141 | /// Sets the file permissions from the existing file. |
| 142 | /** |
| 143 | Takes permissions from the file and sets the high 16 bits of |
| 144 | external attributes. Uses QFileInfo to get permissions on all |
| 145 | platforms. |
| 146 | */ |
| 147 | void setFilePermissionscxx . . $ QuaZipNewInfo#setFilePermissions(3520e46b33348bf6).(const QStringcxx . . $ QString# &file); |
| 148 | /// Sets the file permissions. |
| 149 | /** |
| 150 | Modifies the highest 16 bits of external attributes. The type part |
| 151 | is set to dir if the name ends with a slash, and to regular file |
| 152 | otherwise. |
| 153 | */ |
| 154 | void setPermissionscxx . . $ QuaZipNewInfo#setPermissions(d5bf81c2433bf2a2).(QFilecxx . . $ QFile#::Permissionscxx . . $ QFileDevice#Permissions# permissions); |
| 155 | /// Sets the NTFS times from an existing file. |
| 156 | /** |
| 157 | * If the file doesn't exist, a warning is printed to the stderr and nothing |
| 158 | * is done. Otherwise, all three times, as reported by |
| 159 | * QFileInfo::lastModified(), QFileInfo::lastRead() and |
| 160 | * QFileInfo::birthTime() (>=Qt5.10) or QFileInfo::created(), are written to |
| 161 | * the NTFS extra field record. |
| 162 | * |
| 163 | * The NTFS record is written to |
| 164 | * both the local and the global extra fields, updating the existing record |
| 165 | * if there is one, or creating a new one and appending it to the end |
| 166 | * of each extra field. |
| 167 | * |
| 168 | * The microseconds will be zero, as they aren't reported by QFileInfo. |
| 169 | * @param fileName |
| 170 | */ |
| 171 | void setFileNTFSTimescxx . . $ QuaZipNewInfo#setFileNTFSTimes(3520e46b33348bf6).(const QStringcxx . . $ QString# &fileName); |
| 172 | /// Sets the NTFS modification time. |
| 173 | /** |
| 174 | * The time is written into the NTFS record in |
| 175 | * both the local and the global extra fields, updating the existing record |
| 176 | * if there is one, or creating a new one and appending it to the end |
| 177 | * of each extra field. When updating an existing record, all other fields |
| 178 | * are left intact. |
| 179 | * @param mTime The new modification time. |
| 180 | * @param fineTicks The fractional part of milliseconds, in 100-nanosecond |
| 181 | * ticks (i. e. 9999 ticks = 999.9 microsecond). Values greater than |
| 182 | * 9999 will add milliseconds or even seconds, but this can be |
| 183 | * confusing and therefore is discouraged. |
| 184 | */ |
| 185 | void setFileNTFSmTimecxx . . $ QuaZipNewInfo#setFileNTFSmTime(12af77bc9000d1bf).(const QDateTimecxx . . $ QDateTime# &mTime, int fineTicks = 0); |
| 186 | /// Sets the NTFS access time. |
| 187 | /** |
| 188 | * The time is written into the NTFS record in |
| 189 | * both the local and the global extra fields, updating the existing record |
| 190 | * if there is one, or creating a new one and appending it to the end |
| 191 | * of each extra field. When updating an existing record, all other fields |
| 192 | * are left intact. |
| 193 | * @param aTime The new access time. |
| 194 | * @param fineTicks The fractional part of milliseconds, in 100-nanosecond |
| 195 | * ticks (i. e. 9999 ticks = 999.9 microsecond). Values greater than |
| 196 | * 9999 will add milliseconds or even seconds, but this can be |
| 197 | * confusing and therefore is discouraged. |
| 198 | */ |
| 199 | void setFileNTFSaTimecxx . . $ QuaZipNewInfo#setFileNTFSaTime(12af77bc9000d1bf).(const QDateTimecxx . . $ QDateTime# &aTime, int fineTicks = 0); |
| 200 | /// Sets the NTFS creation time. |
| 201 | /** |
| 202 | * The time is written into the NTFS record in |
| 203 | * both the local and the global extra fields, updating the existing record |
| 204 | * if there is one, or creating a new one and appending it to the end |
| 205 | * of each extra field. When updating an existing record, all other fields |
| 206 | * are left intact. |
| 207 | * @param cTime The new creation time. |
| 208 | * @param fineTicks The fractional part of milliseconds, in 100-nanosecond |
| 209 | * ticks (i. e. 9999 ticks = 999.9 microsecond). Values greater than |
| 210 | * 9999 will add milliseconds or even seconds, but this can be |
| 211 | * confusing and therefore is discouraged. |
| 212 | */ |
| 213 | void setFileNTFScTimecxx . . $ QuaZipNewInfo#setFileNTFScTime(12af77bc9000d1bf).(const QDateTimecxx . . $ QDateTime# &cTime, int fineTicks = 0); |
| 214 | }; |
| 215 | |
| 216 | #endif |