KArchive 5.109.0
kar.h
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2002 Laurence Anderson <l.d.anderson@warwick.ac.uk>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#ifndef KAR_H
7#define KAR_H
8
9#include <karchive.h>
10
20class KARCHIVE_EXPORT KAr : public KArchive
21{
22 Q_DECLARE_TR_FUNCTIONS(KAr)
23
24public:
30 KAr(const QString &filename);
31
37 KAr(QIODevice *dev);
38
43 ~KAr() override;
44
45protected:
46 /*
47 * Writing is not supported by this class, will always fail.
48 * @return always false
49 */
50 bool doPrepareWriting(const QString &name,
51 const QString &user,
52 const QString &group,
53 qint64 size,
54 mode_t perm,
55 const QDateTime &atime,
56 const QDateTime &mtime,
57 const QDateTime &ctime) override;
58
59 /*
60 * Writing is not supported by this class, will always fail.
61 * @return always false
62 */
63 bool doFinishWriting(qint64 size) override;
64
65 /*
66 * Writing is not supported by this class, will always fail.
67 * @return always false
68 */
69 bool doWriteDir(const QString &name,
70 const QString &user,
71 const QString &group,
72 mode_t perm,
73 const QDateTime &atime,
74 const QDateTime &mtime,
75 const QDateTime &ctime) override;
76
77 bool doWriteSymLink(const QString &name,
78 const QString &target,
79 const QString &user,
80 const QString &group,
81 mode_t perm,
82 const QDateTime &atime,
83 const QDateTime &mtime,
84 const QDateTime &ctime) override;
85
92 bool openArchive(QIODevice::OpenMode mode) override;
93 bool closeArchive() override;
94
95protected:
96 void virtual_hook(int id, void *data) override;
97
98private:
99 class KArPrivate;
100 KArPrivate *const d;
101};
102
103#endif
KAr is a class for reading archives in ar format.
Definition kar.h:21
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
Writes a symbolic link to the archive.
KAr(const QString &filename)
Creates an instance that operates on the given filename.
bool openArchive(QIODevice::OpenMode mode) override
Opens the archive for reading.
~KAr() override
If the ar file is still opened, then it will be closed automatically by the destructor.
KAr(QIODevice *dev)
Creates an instance that operates on the given device.
bool closeArchive() override
Closes the archive.
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
This virtual method must be implemented by subclasses.
bool doWriteDir(const QString &name, const QString &user, const QString &group, mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) override
Write a directory to the archive.
bool doFinishWriting(qint64 size) override
Called after writing the data.
KArchive is a base class for reading and writing archives.
Definition karchive.h:40