1 | /* This file is part of the KDE libraries |
2 | SPDX-FileCopyrightText: 2014 David Faure <faure@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | #ifndef KRCC_H |
7 | #define KRCC_H |
8 | |
9 | #include <karchive.h> |
10 | |
11 | /*! |
12 | * \class KRcc |
13 | * \inmodule KArchive |
14 | * |
15 | * KRcc is a class for reading dynamic binary resources created by Qt's rcc tool |
16 | * from a .qrc file and the files it points to. |
17 | * |
18 | * Writing is not supported. |
19 | * \brief A class for reading rcc resources. |
20 | * \since 5.3 |
21 | */ |
22 | class KARCHIVE_EXPORT KRcc : public KArchive |
23 | { |
24 | Q_DECLARE_TR_FUNCTIONS(KRcc) |
25 | |
26 | public: |
27 | /*! |
28 | * Creates an instance that operates on the given filename. |
29 | * |
30 | * \a filename is a local path (e.g. "/home/holger/myfile.rcc") |
31 | */ |
32 | explicit KRcc(const QString &filename); |
33 | |
34 | /*! |
35 | * If the rcc file is still opened, then it will be |
36 | * closed automatically by the destructor. |
37 | */ |
38 | ~KRcc() override; |
39 | |
40 | protected: |
41 | /* |
42 | * Writing is not supported by this class, will always fail. |
43 | * Returns always false |
44 | */ |
45 | bool doPrepareWriting(const QString &name, |
46 | const QString &user, |
47 | const QString &group, |
48 | qint64 size, |
49 | mode_t perm, |
50 | const QDateTime &atime, |
51 | const QDateTime &mtime, |
52 | const QDateTime &ctime) override; |
53 | |
54 | /* |
55 | * Writing is not supported by this class, will always fail. |
56 | * Returns always false |
57 | */ |
58 | bool doFinishWriting(qint64 size) override; |
59 | |
60 | /* |
61 | * Writing is not supported by this class, will always fail. |
62 | * Returns always false |
63 | */ |
64 | bool doWriteDir(const QString &name, |
65 | const QString &user, |
66 | const QString &group, |
67 | mode_t perm, |
68 | const QDateTime &atime, |
69 | const QDateTime &mtime, |
70 | const QDateTime &ctime) override; |
71 | |
72 | /* |
73 | * Writing is not supported by this class, will always fail. |
74 | * Returns always false |
75 | */ |
76 | bool doWriteSymLink(const QString &name, |
77 | const QString &target, |
78 | const QString &user, |
79 | const QString &group, |
80 | mode_t perm, |
81 | const QDateTime &atime, |
82 | const QDateTime &mtime, |
83 | const QDateTime &ctime) override; |
84 | |
85 | /*! |
86 | * Registers the .rcc resource in the QResource system under a unique identifier, |
87 | * then lists that, and creates the KArchiveFile/KArchiveDirectory entries. |
88 | */ |
89 | bool openArchive(QIODevice::OpenMode mode) override; |
90 | /*! |
91 | * Unregisters the .rcc resource from the QResource system. |
92 | */ |
93 | bool closeArchive() override; |
94 | |
95 | protected: |
96 | void virtual_hook(int id, void *data) override; |
97 | |
98 | private: |
99 | class KRccPrivate; |
100 | KRccPrivate *const d; |
101 | }; |
102 | |
103 | #endif |
104 | |