KArchive

karchiveentry.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 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
25class KArchiveFile;
26class KArchive;
27
28class KArchiveEntryPrivate;
29/**
30 * @class KArchiveEntry karchiveentry.h KArchiveEntry
31 *
32 * A base class for entries in an KArchive.
33 * @short Base class for the archive-file's directory structure.
34 *
35 * @see KArchiveFile
36 * @see KArchiveDirectory
37 */
38class KARCHIVE_EXPORT KArchiveEntry
39{
40public:
41 /**
42 * Creates a new entry.
43 * @param archive the entries archive
44 * @param name the name of the entry
45 * @param access the permissions in unix format
46 * @param date the date (in seconds since 1970)
47 * @param user the user that owns the entry
48 * @param group the group that owns the entry
49 * @param symlink the symlink, or QString()
50 */
51 KArchiveEntry(KArchive *archive, const QString &name, int access, const QDateTime &date, const QString &user, const QString &group, const QString &symlink);
52
53 virtual ~KArchiveEntry();
54
55 /**
56 * Creation date of the file.
57 * @return the creation date
58 */
59 QDateTime date() const;
60
61 /**
62 * Name of the file without path.
63 * @return the file name without path
64 */
65 QString name() const;
66 /**
67 * The permissions and mode flags as returned by the stat() function
68 * in st_mode.
69 * @return the permissions
70 */
71 mode_t permissions() const;
72 /**
73 * User who created the file.
74 * @return the owner of the file
75 */
76 QString user() const;
77 /**
78 * Group of the user who created the file.
79 * @return the group of the file
80 */
81 QString group() const;
82
83 /**
84 * Symlink if there is one.
85 * @return the symlink, or QString()
86 */
87 QString symLinkTarget() const;
88
89 /**
90 * Checks whether the entry is a file.
91 * @return true if this entry is a file
92 */
93 virtual bool isFile() const;
94
95 /**
96 * Checks whether the entry is a directory.
97 * @return true if this entry is a directory
98 */
99 virtual bool isDirectory() const;
100
101protected:
102 KArchive *archive() const;
103
104protected:
105 virtual void virtual_hook(int id, void *data);
106
107private:
108 KArchiveEntryPrivate *const d;
109};
110
111#endif
Represents a directory entry in a KArchive.
A base class for entries in an KArchive.
Represents a file entry in a KArchive.
KArchive is a base class for reading and writing archives.
Definition karchive.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.