File indexing completed on 2024-05-12 05:50:20
0001 /* 0002 SPDX-FileCopyrightText: 2009 Harald Hvaal <haraldhv@stud.ntnu.no> 0003 SPDX-FileCopyrightText: 2009-2010 Raphael Kubo da Costa <rakuco@FreeBSD.org> 0004 SPDX-FileCopyrightText: 2016 Vladyslav Batyrenko <mvlabat@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef CLIPLUGIN_H 0010 #define CLIPLUGIN_H 0011 0012 #include "cliinterface.h" 0013 0014 class CliPlugin : public Kerfuffle::CliInterface 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 explicit CliPlugin(QObject *parent, const QVariantList &args); 0020 ~CliPlugin() override; 0021 0022 void resetParsing() override; 0023 bool readListLine(const QString &line) override; 0024 bool readExtractLine(const QString &line) override; 0025 bool readDeleteLine(const QString &line) override; 0026 bool isPasswordPrompt(const QString &line) override; 0027 bool isWrongPasswordMsg(const QString &line) override; 0028 bool isCorruptArchiveMsg(const QString &line) override; 0029 bool isDiskFullMsg(const QString &line) override; 0030 bool isFileExistsMsg(const QString &line) override; 0031 bool isFileExistsFileName(const QString &line) override; 0032 0033 private: 0034 enum ArchiveType { 0035 ArchiveType7z = 0, 0036 ArchiveTypeBZip2, 0037 ArchiveTypeGZip, 0038 ArchiveTypeXz, 0039 ArchiveTypeTar, 0040 ArchiveTypeZip, 0041 ArchiveTypeRar, 0042 } m_archiveType; 0043 0044 enum ParseState { 0045 ParseStateTitle = 0, 0046 ParseStateHeader, 0047 ParseStateArchiveInformation, 0048 ParseStateComment, 0049 ParseStateEntryInformation, 0050 } m_parseState; 0051 0052 enum BinaryVariant { 0053 Undefined = 0, 0054 P7zip, 0055 Upstream7zip, 0056 } m_binaryVariant; 0057 0058 void setupCliProperties(); 0059 void handleMethods(const QStringList &methods); 0060 void fixDirectoryFullName(); 0061 0062 int m_linesComment; 0063 Kerfuffle::Archive::Entry *m_currentArchiveEntry; 0064 bool m_isFirstInformationEntry; 0065 }; 0066 0067 #endif // CLIPLUGIN_H