KArchive

kzipfileentry.h
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 kzipfileentry.h KZipFileEntry
15 *
16 * A KZipFileEntry represents a file in a zip archive.
17 */
18class KARCHIVE_EXPORT KZipFileEntry : public KArchiveFile
19{
20public:
21 /**
22 * Creates a new zip file entry. Do not call this, KZip takes care of it.
23 */
25 const QString &name,
26 int access,
27 const QDateTime &date,
28 const QString &user,
29 const QString &group,
30 const QString &symlink,
31 const QString &path,
32 qint64 start,
33 qint64 uncompressedSize,
34 int encoding,
35 qint64 compressedSize);
36
37 /**
38 * Destructor. Do not call this.
39 */
40 ~KZipFileEntry() override;
41
42 int encoding() const;
43 qint64 compressedSize() const;
44
45 /// Only used when writing
46 void setCompressedSize(qint64 compressedSize);
47
48 /// Header start: only used when writing
49 void setHeaderStart(qint64 headerstart);
50 qint64 headerStart() const;
51
52 /// CRC: only used when writing
53 unsigned long crc32() const;
54 void setCRC32(unsigned long crc32);
55
56 /// Name with complete path - KArchiveFile::name() is the filename only (no path)
57 const QString &path() const;
58
59 /**
60 * @return the content of this file.
61 * Call data() with care (only once per file), this data isn't cached.
62 */
63 QByteArray data() const override;
64
65 /**
66 * This method returns a QIODevice to read the file contents.
67 * This is obviously for reading only.
68 * Note that the ownership of the device is being transferred to the caller,
69 * who will have to delete it.
70 * The returned device auto-opens (in readonly mode), no need to open it.
71 */
72 QIODevice *createDevice() const override;
73
74private:
75 class KZipFileEntryPrivate;
76 KZipFileEntryPrivate *const d;
77};
78
79#endif
Represents a file entry in a KArchive.
virtual QIODevice * createDevice() const
This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice.
Definition karchive.cpp:821
virtual QByteArray data() const
Returns the data of the file.
Definition karchive.cpp:805
A KZipFileEntry represents a file in a zip archive.
A class for reading / writing zip archives.
Definition kzip.h:38
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.