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

source code of karchive/src/karchiveentry.h