1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2002 Holger Schroeder <holger-kde@holgis.net>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KZIPFILEENTRY_H
8#define KZIPFILEENTRY_H
9
10#include "karchive.h"
11
12class KZip;
13/*!
14 * \class KZipFileEntry
15 * \inmodule KArchive
16 *
17 * \brief Represents a file in a zip archive.
18 */
19class KARCHIVE_EXPORT KZipFileEntry : public KArchiveFile
20{
21public:
22 /*!
23 * Creates a new zip file entry. Do not call this, KZip takes care of it.
24 */
25 KZipFileEntry(KZip *zip,
26 const QString &name,
27 int access,
28 const QDateTime &date,
29 const QString &user,
30 const QString &group,
31 const QString &symlink,
32 const QString &path,
33 qint64 start,
34 qint64 uncompressedSize,
35 int encoding,
36 qint64 compressedSize);
37
38 ~KZipFileEntry() override;
39
40 /*!
41 *
42 */
43 int encoding() const;
44
45 /*!
46 * Only used when writing
47 */
48 qint64 compressedSize() const;
49
50 /*!
51 * Only used when writing
52 */
53 void setCompressedSize(qint64 compressedSize);
54
55 /*!
56 * Header start: only used when writing
57 */
58 void setHeaderStart(qint64 headerstart);
59 /*!
60 * Header start: only used when writing
61 */
62 qint64 headerStart() const;
63
64 /*!
65 * CRC: only used when writing
66 */
67 unsigned long crc32() const;
68
69 /*!
70 * CRC: only used when writing
71 */
72 void setCRC32(unsigned long crc32);
73
74 /*!
75 * Name with complete path - KArchiveFile::name() is the filename only (no path)
76 */
77 const QString &path() const;
78
79 /*!
80 * Returns the content of this file.
81 *
82 * Call data() with care (only once per file), this data isn't cached.
83 */
84 QByteArray data() const override;
85
86 /*!
87 * This method returns a QIODevice to read the file contents.
88 *
89 * This is obviously for reading only.
90 *
91 * Note that the ownership of the device is being transferred to the caller,
92 * who will have to delete it.
93 *
94 * The returned device auto-opens (in readonly mode), no need to open it.
95 */
96 QIODevice *createDevice() const override;
97
98private:
99 class KZipFileEntryPrivate;
100 KZipFileEntryPrivate *const d;
101};
102
103#endif
104

source code of karchive/src/kzipfileentry.h