File indexing completed on 2025-02-16 13:00:37
0001 /* This file is part of the KDE libraries 0002 SPDX-FileCopyrightText: 2014 David Faure <faure@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #ifndef KRCC_H 0007 #define KRCC_H 0008 0009 #include <karchive.h> 0010 0011 /** 0012 * KRcc is a class for reading dynamic binary resources created by Qt's rcc tool 0013 * from a .qrc file and the files it points to. 0014 * 0015 * Writing is not supported. 0016 * @short A class for reading rcc resources. 0017 * @since 5.3 0018 */ 0019 class KARCHIVE_EXPORT KRcc : public KArchive 0020 { 0021 Q_DECLARE_TR_FUNCTIONS(KRcc) 0022 0023 public: 0024 /** 0025 * Creates an instance that operates on the given filename. 0026 * 0027 * @param filename is a local path (e.g. "/home/holger/myfile.rcc") 0028 */ 0029 KRcc(const QString &filename); 0030 0031 /** 0032 * If the rcc file is still opened, then it will be 0033 * closed automatically by the destructor. 0034 */ 0035 ~KRcc() override; 0036 0037 protected: 0038 /* 0039 * Writing is not supported by this class, will always fail. 0040 * @return always false 0041 */ 0042 bool doPrepareWriting(const QString &name, 0043 const QString &user, 0044 const QString &group, 0045 qint64 size, 0046 mode_t perm, 0047 const QDateTime &atime, 0048 const QDateTime &mtime, 0049 const QDateTime &ctime) override; 0050 0051 /* 0052 * Writing is not supported by this class, will always fail. 0053 * @return always false 0054 */ 0055 bool doFinishWriting(qint64 size) override; 0056 0057 /* 0058 * Writing is not supported by this class, will always fail. 0059 * @return always false 0060 */ 0061 bool doWriteDir(const QString &name, 0062 const QString &user, 0063 const QString &group, 0064 mode_t perm, 0065 const QDateTime &atime, 0066 const QDateTime &mtime, 0067 const QDateTime &ctime) override; 0068 0069 /* 0070 * Writing is not supported by this class, will always fail. 0071 * @return always false 0072 */ 0073 bool doWriteSymLink(const QString &name, 0074 const QString &target, 0075 const QString &user, 0076 const QString &group, 0077 mode_t perm, 0078 const QDateTime &atime, 0079 const QDateTime &mtime, 0080 const QDateTime &ctime) override; 0081 0082 /** 0083 * Registers the .rcc resource in the QResource system under a unique identifier, 0084 * then lists that, and creates the KArchiveFile/KArchiveDirectory entries. 0085 */ 0086 bool openArchive(QIODevice::OpenMode mode) override; 0087 /** 0088 * Unregisters the .rcc resource from the QResource system. 0089 */ 0090 bool closeArchive() override; 0091 0092 protected: 0093 void virtual_hook(int id, void *data) override; 0094 0095 private: 0096 class KRccPrivate; 0097 KRccPrivate *const d; 0098 }; 0099 0100 #endif