File indexing completed on 2024-05-12 05:50:10
0001 /* 0002 SPDX-FileCopyrightText: 2010-2011 Raphael Kubo da Costa <rakuco@FreeBSD.org> 0003 0004 SPDX-License-Identifier: BSD-2-Clause 0005 */ 0006 0007 #ifndef JSONARCHIVEINTERFACE_H 0008 #define JSONARCHIVEINTERFACE_H 0009 0010 #include "archiveinterface.h" 0011 #include "jsonparser.h" 0012 0013 /** 0014 * A dummy archive interface used by our test cases. 0015 * 0016 * It reads a JSON file which defines the contents of the archive. 0017 * For the file format description, see the documentation for @c JSONParser. 0018 * 0019 * The file's content is read to memory when open() is called and the archive 0020 * is then closed. This means that this class never changes the file's content 0021 * on disk, and entry addition or deletion do not change the original file. 0022 * 0023 * @sa JSONParser 0024 * 0025 * @author Raphael Kubo da Costa <rakuco@FreeBSD.org> 0026 */ 0027 class JSONArchiveInterface : public Kerfuffle::ReadWriteArchiveInterface 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 explicit JSONArchiveInterface(QObject *parent, const QVariantList &args); 0033 ~JSONArchiveInterface() override; 0034 0035 bool list() override; 0036 bool open() override; 0037 0038 bool addFiles(const QVector<Kerfuffle::Archive::Entry *> &files, 0039 const Kerfuffle::Archive::Entry *destination, 0040 const Kerfuffle::CompressionOptions &options, 0041 uint numberOfEntriesToAdd = 0) override; 0042 bool 0043 moveFiles(const QVector<Kerfuffle::Archive::Entry *> &files, Kerfuffle::Archive::Entry *destination, const Kerfuffle::CompressionOptions &options) override; 0044 bool 0045 copyFiles(const QVector<Kerfuffle::Archive::Entry *> &files, Kerfuffle::Archive::Entry *destination, const Kerfuffle::CompressionOptions &options) override; 0046 bool 0047 extractFiles(const QVector<Kerfuffle::Archive::Entry *> &files, const QString &destinationDirectory, const Kerfuffle::ExtractionOptions &options) override; 0048 bool deleteFiles(const QVector<Kerfuffle::Archive::Entry *> &files) override; 0049 bool addComment(const QString &comment) override; 0050 bool testArchive() override; 0051 0052 private: 0053 JSONParser::JSONArchive m_archive; 0054 }; 0055 0056 #endif