zipentry_p.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Filename: ZipEntryP.h
00003 ** Last updated [dd/mm/yyyy]: 28/01/2007
00004 **
00005 ** Wrapper for a ZIP local header.
00006 **
00007 ** Some of the code has been inspired by other open source projects,
00008 ** (mainly Info-Zip and Gilles Vollant's minizip).
00009 ** Compression and decompression actually uses the zlib library.
00010 **
00011 ** Copyright (C) 2007 Angius Fabrizio. All rights reserved.
00012 **
00013 ** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
00014 **
00015 ** This file may be distributed and/or modified under the terms of the
00016 ** GNU General Public License version 2 as published by the Free Software
00017 ** Foundation and appearing in the file LICENSE.GPL included in the
00018 ** packaging of this file.
00019 **
00020 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00021 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00022 **
00023 ** See the file LICENSE.GPL that came with this software distribution or
00024 ** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
00025 **
00026 **********************************************************************/
00027 
00028 //
00029 //  W A R N I N G
00030 //  -------------
00031 //
00032 // This file is not part of the Zip/UnZip API.  It exists purely as an
00033 // implementation detail. This header file may change from version to
00034 // version without notice, or even be removed.
00035 //
00036 // We mean it.
00037 //
00038 
00039 #ifndef OSDAB_ZIPENTRY_P__H
00040 #define OSDAB_ZIPENTRY_P__H
00041 
00042 #include <QtGlobal>
00043 #include <QString>
00044 
00045 class ZipEntryP
00046 {
00047 public:
00048     ZipEntryP()
00049     {
00050         lhOffset = 0;
00051         dataOffset = 0;
00052         gpFlag[0] = gpFlag[1] = 0;
00053         compMethod = 0;
00054         modTime[0] = modTime[1] = 0;
00055         modDate[0] = modDate[1] = 0;
00056         crc = 0;
00057         szComp = szUncomp = 0;
00058         lhEntryChecked = false;
00059     }
00060 
00061     quint32 lhOffset;           // Offset of the local header record for this entry
00062     quint32 dataOffset;         // Offset of the file data for this entry
00063     unsigned char gpFlag[2];    // General purpose flag
00064     quint16 compMethod;         // Compression method
00065     unsigned char modTime[2];   // Last modified time
00066     unsigned char modDate[2];   // Last modified date
00067     quint32 crc;                // CRC32
00068     quint32 szComp;             // Compressed file size
00069     quint32 szUncomp;           // Uncompressed file size
00070     QString comment;            // File comment
00071 
00072     bool lhEntryChecked;        // Is true if the local header record for this entry has been parsed
00073 
00074     inline bool isEncrypted() const { return gpFlag[0] & 0x01; }
00075     inline bool hasDataDescriptor() const { return gpFlag[0] & 0x08; }
00076 };
00077 
00078 #endif // OSDAB_ZIPENTRY_P__H