KArchive 5.109.0
karchivedirectory.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 Moved from ktar.h by Roberto Teixeira <maragato@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9#ifndef KARCHIVEDIRECTORY_H
10#define KARCHIVEDIRECTORY_H
11
12#include <sys/stat.h>
13#include <sys/types.h>
14
15#include <QDate>
16#include <QString>
17#include <QStringList>
18
19#include <karchiveentry.h>
20
21class KArchiveDirectoryPrivate;
22class KArchiveFile;
32class KARCHIVE_EXPORT KArchiveDirectory : public KArchiveEntry
33{
34public:
46 const QString &name,
47 int access,
48 const QDateTime &date,
49 const QString &user,
50 const QString &group,
51 const QString &symlink);
52
53 ~KArchiveDirectory() override;
54
62 QStringList entries() const;
63
70 const KArchiveEntry *entry(const QString &name) const;
71
82 const KArchiveFile *file(const QString &name) const;
83
89 void addEntry(KArchiveEntry *); // KF6 TODO: return bool
90
96 bool addEntryV2(KArchiveEntry *); // KF6 TODO: merge with the one above
97
102 void removeEntry(KArchiveEntry *); // KF6 TODO: return bool since it can fail
103
108 bool isDirectory() const override;
109
117 bool copyTo(const QString &dest, bool recursive = true) const;
118
119protected:
120 void virtual_hook(int id, void *data) override;
121
122private:
123 friend class KArchiveDirectoryPrivate;
124 KArchiveDirectoryPrivate *const d;
125};
126
127#endif
Represents a directory entry in a KArchive.
Definition karchivedirectory.h:33
KArchiveDirectory(KArchive *archive, const QString &name, int access, const QDateTime &date, const QString &user, const QString &group, const QString &symlink)
Creates a new directory entry.
QStringList entries() const
Returns a list of sub-entries.
bool copyTo(const QString &dest, bool recursive=true) const
Extracts all entries in this archive directory to the directory dest.
const KArchiveEntry * entry(const QString &name) const
Returns the entry in the archive with the given name.
bool isDirectory() const override
Checks whether this entry is a directory.
const KArchiveFile * file(const QString &name) const
Returns the file entry in the archive with the given name.
A base class for entries in an KArchive.
Definition karchiveentry.h:36
Represents a file entry in a KArchive.
Definition karchivefile.h:25
KArchive is a base class for reading and writing archives.
Definition karchive.h:40