File indexing completed on 2025-01-26 04:14:57
0001 /* 0002 * Copyright (C) 2015 Dan Leinir Turthra Jensen <admin@leinir.dk> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) version 3, or any 0008 * later version accepted by the membership of KDE e.V. (or its 0009 * successor approved by the membership of KDE e.V.), which shall 0010 * act as a proxy defined in Section 6 of version 3 of the license. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Lesser General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Lesser General Public 0018 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 0019 * 0020 */ 0021 0022 #ifndef KRARFILEENTRY_H 0023 #define KRARFILEENTRY_H 0024 0025 #include "KRar.h" 0026 /** 0027 * A KRarFileEntry represents a file in a rar archive. 0028 */ 0029 class KRarFileEntry : public KArchiveFile 0030 { 0031 public: 0032 /** 0033 * Creates a new rar file entry. Do not call this, KRar takes care of it. 0034 */ 0035 KRarFileEntry(KRar *rar, const QString &name, int access, const QDateTime &date, 0036 const QString &user, const QString &group, const QString &symlink, 0037 const QString &path, qint64 start, qint64 uncompressedSize, struct ar_archive_s* archive); 0038 0039 /** 0040 * Destructor. Do not call this. 0041 */ 0042 ~KRarFileEntry() override; 0043 0044 /// Header start: only used when writing, consequently not used (as we don't support writing) 0045 void setHeaderStart(qint64 headerstart); 0046 qint64 headerStart() const; 0047 0048 /// CRC: only used when writing, consequently not used (as we don't support writing) 0049 unsigned long crc32() const; 0050 void setCRC32(unsigned long crc32); 0051 0052 /// Name with complete path - KArchiveFile::name() is the filename only (no path) 0053 const QString &path() const; 0054 0055 /** 0056 * @return the content of this file. 0057 * Call data() with care (only once per file), this data isn't cached. 0058 */ 0059 QByteArray data() const override; 0060 0061 /** 0062 * This method returns a QIODevice to read the file contents. 0063 * This is obviously for reading only. 0064 * Note that the ownership of the device is being transferred to the caller, 0065 * who will have to delete it. 0066 * The returned device auto-opens (in readonly mode), no need to open it. 0067 */ 0068 QIODevice *createDevice() const override; 0069 0070 private: 0071 class Private; 0072 Private *const d; 0073 }; 0074 0075 #endif//KRARFILEENTRY_H 0076