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 KARCHIVEENTRY_H
10#define KARCHIVEENTRY_H
11
12#include <sys/stat.h>
13#include <sys/types.h>
14
15#include <karchive_export.h>
16
17#ifdef Q_OS_WIN
18#include <qplatformdefs.h> // mode_t
19#endif
20
21class KArchiveDirectory;
22class KArchiveFile;
23class KArchive;
24
25class KArchiveEntryPrivate;
26/**
27 * @class KArchiveEntry karchiveentry.h KArchiveEntry
28 *
29 * A base class for entries in an KArchive.
30 * @short Base class for the archive-file's directory structure.
31 *
32 * @see KArchiveFile
33 * @see KArchiveDirectory
34 */
35class KARCHIVE_EXPORT KArchiveEntry
36{
37public:
38 /**
39 * Creates a new entry.
40 * @param archive the entries archive
41 * @param name the name of the entry
42 * @param access the permissions in unix format
43 * @param date the date (in seconds since 1970)
44 * @param user the user that owns the entry
45 * @param group the group that owns the entry
46 * @param symlink the symlink, or QString()
47 */
48 KArchiveEntry(KArchive *archive, const QString &name, int access, const QDateTime &date, const QString &user, const QString &group, const QString &symlink);
49
50 virtual ~KArchiveEntry();
51
52 /**
53 * Creation date of the file.
54 * @return the creation date
55 */
56 QDateTime date() const;
57
58 /**
59 * Name of the file without path.
60 * @return the file name without path
61 */
62 QString name() const;
63 /**
64 * The permissions and mode flags as returned by the stat() function
65 * in st_mode.
66 * @return the permissions
67 */
68 mode_t permissions() const;
69 /**
70 * User who created the file.
71 * @return the owner of the file
72 */
73 QString user() const;
74 /**
75 * Group of the user who created the file.
76 * @return the group of the file
77 */
78 QString group() const;
79
80 /**
81 * Symlink if there is one.
82 * @return the symlink, or QString()
83 */
84 QString symLinkTarget() const;
85
86 /**
87 * Checks whether the entry is a file.
88 * @return true if this entry is a file
89 */
90 virtual bool isFile() const;
91
92 /**
93 * Checks whether the entry is a directory.
94 * @return true if this entry is a directory
95 */
96 virtual bool isDirectory() const;
97
98protected:
99 KArchive *archive() const;
100
101protected:
102 virtual void virtual_hook(int id, void *data);
103
104private:
105 KArchiveEntryPrivate *const d;
106};
107
108#endif
109

source code of karchive/src/karchiveentry.h