KArchive

karchiveentry.h
1 /* This file is part of the KDE libraries
2  SPDX-FileCopyrightText: 2000-2005 David Faure <[email protected]>
3  SPDX-FileCopyrightText: 2003 Leo Savernik <[email protected]>
4 
5  Moved from ktar.h by Roberto Teixeira <[email protected]>
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 
21 class KArchiveDirectory;
22 class KArchiveFile;
23 class KArchive;
24 
25 class 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  */
35 class KARCHIVE_EXPORT KArchiveEntry
36 {
37 public:
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 
98 protected:
99  KArchive *archive() const;
100 
101 protected:
102  virtual void virtual_hook(int id, void *data);
103 
104 private:
105  KArchiveEntryPrivate *const d;
106 };
107 
108 #endif
A directory in an archive.
Base class for the archive-file's directory structure.
Definition: karchiveentry.h:35
generic class for reading/writing archives
Definition: karchive.h:39
A file in an archive.
Definition: karchivefile.h:24
int access(const QString &path, int mode)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 04:08:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.