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

KDE's Doxygen guidelines are available online.