AbZip  1.0.0
ExtraFields.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 Andy Bray
4 **
5 ** This file is part of AbZip.
6 **
7 ** AbZip is free software: you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation, either version 3 of the License, or
10 ** (at your option) any later version.
11 **
12 ** AbZip is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with AbZip. If not, see <http://www.gnu.org/licenses/>.
19 **
20 ****************************************************************************/
21 
22 #ifndef EXTRAFIELDS_H
23 #define EXTRAFIELDS_H
24 
25 #include <QMap>
26 
27 #define ZIP_EXTRA_ZIP64 0x0001 // zip64
28 #define ZIP_EXTRA_WINZIP_AES 0x9901 // WinZip AES
29 #define ZIP_EXTRA_NTFS 0x000A // NTFS file dates
30 #define ZIP_EXTRA_UNIX 0x000D // UNIX file dates
31 #define ZIP_EXTRA_TIMESTAMP 0x5455 // extended timestamp
32 #define ZIP_EXTRA_UNICODE_PATH 0x7075 // Info-ZIP Unicode Path Extra Field
33 #define ZIP_EXTRA_UNICODE_COMMENT 0x6375 // Info-ZIP Unicode Comment Extra Field
34 
35 
37 {
38 public:
39  ExtraFields();
40  ExtraFields(const QByteArray& fields);
41  virtual ~ExtraFields(){}
42 
43  virtual ExtraFields& operator=( const ExtraFields& );
44 
45  bool read( const QByteArray& fields );
46  QByteArray write( );
47  bool add( quint16 headerID, const QByteArray& data );
48 
49  // Some of the extra fields we are interseted in
50  bool zip64( qint64* uncompressSize, qint64* compressSize = 0, qint64* offset = 0);
51  void setZip64( qint64 uncompressSize, qint64 compressSize = 0, qint64 offset = 0 );
52  bool ntfs( qint64* mtime = 0, qint64* atime = 0, qint64* ctime = 0);
53  void setNtfs( qint64 mtime, qint64 atime, qint64 ctime );
54  bool timestamp( qint64* mtime, qint64* atime = 0, qint64* ctime = 0);
55  void setTimeStamp( qint64 mtime, qint64 atime, qint64 ctime );
56  bool unix( qint64* mtime, qint64* atime = 0);
57  void setUnix( qint64 mtime, qint64 atime );
58  bool getWinZipAES( quint16& method, quint8& strength );
59  void setWinZipAES( quint16 method );
60 
61  bool unicode( QString& name, quint16 headerID );
62 
63 protected:
64  QMap<quint16, QByteArray> mapFields;
65 };
66 
67 #endif // EXTRAFIELDS_H
Definition: ExtraFields.h:36