KArchive 5.109.0
ktar.h
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2000-2005 David Faure <faure@kde.org>
3 SPDX-FileCopyrightText: 2003 Leo Savernik <l.savernik@aon.at>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7#ifndef KTAR_H
8#define KTAR_H
9
10#include <karchive.h>
11
22class KARCHIVE_EXPORT KTar : public KArchive
23{
24 Q_DECLARE_TR_FUNCTIONS(KTar)
25
26public:
38 explicit KTar(const QString &filename, const QString &mimetype = QString());
39
48 explicit KTar(QIODevice *dev);
49
54 ~KTar() override;
55
62 void setOrigFileName(const QByteArray &fileName);
63
64protected:
66 bool doWriteSymLink(const QString &name,
67 const QString &target,
68 const QString &user,
69 const QString &group,
70 mode_t perm,
71 const QDateTime &atime,
72 const QDateTime &mtime,
73 const QDateTime &ctime) override;
75 bool doWriteDir(const QString &name,
76 const QString &user,
77 const QString &group,
78 mode_t perm,
79 const QDateTime &atime,
80 const QDateTime &mtime,
81 const QDateTime &ctime) override;
83 bool doPrepareWriting(const QString &name,
84 const QString &user,
85 const QString &group,
86 qint64 size,
87 mode_t perm,
88 const QDateTime &atime,
89 const QDateTime &mtime,
90 const QDateTime &ctime) override;
92 bool doFinishWriting(qint64 size) override;
93
100 bool openArchive(QIODevice::OpenMode mode) override;
101 bool closeArchive() override;
102
103 bool createDevice(QIODevice::OpenMode mode) override;
104
105private:
106protected:
107 void virtual_hook(int id, void *data) override;
108
109private:
110 class KTarPrivate;
111 KTarPrivate *const d;
112};
113
114#endif
KArchive is a base class for reading and writing archives.
Definition karchive.h:40
A class for reading / writing (optionally compressed) tar archives.
Definition ktar.h:23
bool doFinishWriting(qint64 size) override
Reimplemented from KArchive.
bool doWriteSymLink(const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
Reimplemented from KArchive.
KTar(const QString &filename, const QString &mimetype=QString())
Creates an instance that operates on the given filename using the compression filter associated to gi...
~KTar() override
If the tar ball is still opened, then it will be closed automatically by the destructor.
bool createDevice(QIODevice::OpenMode mode) override
Can be reimplemented in order to change the creation of the device (when using the fileName construct...
void setOrigFileName(const QByteArray &fileName)
Special function for setting the "original file name" in the gzip header, when writing a tar....
bool openArchive(QIODevice::OpenMode mode) override
Opens the archive for reading.
KTar(QIODevice *dev)
Creates an instance that operates on the given device.
bool closeArchive() override
Closes the archive.
bool doWriteDir(const QString &name, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
Reimplemented from KArchive.
bool doPrepareWriting(const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
Reimplemented from KArchive.