File indexing completed on 2025-02-16 13:00:38
0001 /* This file is part of the KDE libraries 0002 SPDX-FileCopyrightText: 2002 Holger Schroeder <holger-kde@holgis.net> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KZIPFILEENTRY_H 0008 #define KZIPFILEENTRY_H 0009 0010 #include "karchive.h" 0011 0012 class KZip; 0013 /** 0014 * @class KZipFileEntry kzipfileentry.h KZipFileEntry 0015 * 0016 * A KZipFileEntry represents a file in a zip archive. 0017 */ 0018 class KARCHIVE_EXPORT KZipFileEntry : public KArchiveFile 0019 { 0020 public: 0021 /** 0022 * Creates a new zip file entry. Do not call this, KZip takes care of it. 0023 */ 0024 KZipFileEntry(KZip *zip, 0025 const QString &name, 0026 int access, 0027 const QDateTime &date, 0028 const QString &user, 0029 const QString &group, 0030 const QString &symlink, 0031 const QString &path, 0032 qint64 start, 0033 qint64 uncompressedSize, 0034 int encoding, 0035 qint64 compressedSize); 0036 0037 /** 0038 * Destructor. Do not call this. 0039 */ 0040 ~KZipFileEntry() override; 0041 0042 int encoding() const; 0043 qint64 compressedSize() const; 0044 0045 /// Only used when writing 0046 void setCompressedSize(qint64 compressedSize); 0047 0048 /// Header start: only used when writing 0049 void setHeaderStart(qint64 headerstart); 0050 qint64 headerStart() const; 0051 0052 /// CRC: only used when writing 0053 unsigned long crc32() const; 0054 void setCRC32(unsigned long crc32); 0055 0056 /// Name with complete path - KArchiveFile::name() is the filename only (no path) 0057 const QString &path() const; 0058 0059 /** 0060 * @return the content of this file. 0061 * Call data() with care (only once per file), this data isn't cached. 0062 */ 0063 QByteArray data() const override; 0064 0065 /** 0066 * This method returns a QIODevice to read the file contents. 0067 * This is obviously for reading only. 0068 * Note that the ownership of the device is being transferred to the caller, 0069 * who will have to delete it. 0070 * The returned device auto-opens (in readonly mode), no need to open it. 0071 */ 0072 QIODevice *createDevice() const override; 0073 0074 private: 0075 class KZipFileEntryPrivate; 0076 KZipFileEntryPrivate *const d; 0077 }; 0078 0079 #endif