File indexing completed on 2025-01-05 03:59:22
0001 // SPDX-License-Identifier: LGPL-2.1-only WITH Qt-LGPL-exception-1.1 OR LGPL-3.0-only WITH Qt-LGPL-exception-1.1 OR GPL-3.0-only OR LicenseRef-Qt-Commercial 0002 // 0003 // SPDX-FileCopyrightText: 2015 The Qt Company Ltd. <https://www.qt.io/licensing/> 0004 // 0005 // This file is based on qzipwriter_p.h from Qt with the original license 0006 // below, taken from 0007 // https://code.qt.io/cgit/qt/qt.git/plain/src/gui/text/qzipwriter_p.h 0008 0009 #ifndef MARBLEZIPWRITER_H 0010 #define MARBLEZIPWRITER_H 0011 #ifndef QT_NO_TEXTODFWRITER 0012 0013 // 0014 // W A R N I N G 0015 // ------------- 0016 // 0017 // This file is not part of the Qt API. It exists for the convenience 0018 // of the QZipWriter class. This header file may change from 0019 // version to version without notice, or even be removed. 0020 // 0021 // We mean it. 0022 // 0023 0024 #include <QString> 0025 #include <QFile> 0026 0027 #include "digikam_export.h" 0028 0029 namespace Marble { 0030 0031 class MarbleZipWriterPrivate; 0032 0033 0034 class DIGIKAM_EXPORT MarbleZipWriter 0035 { 0036 public: 0037 MarbleZipWriter(const QString &fileName, QIODevice::OpenMode mode = (QIODevice::WriteOnly | QIODevice::Truncate) ); 0038 0039 explicit MarbleZipWriter(QIODevice *device); 0040 ~MarbleZipWriter(); 0041 0042 QIODevice* device() const; 0043 0044 bool isWritable() const; 0045 bool exists() const; 0046 0047 enum Status { 0048 NoError, 0049 FileWriteError, 0050 FileOpenError, 0051 FilePermissionsError, 0052 FileError 0053 }; 0054 0055 Status status() const; 0056 0057 enum CompressionPolicy { 0058 AlwaysCompress, 0059 NeverCompress, 0060 AutoCompress 0061 }; 0062 0063 void setCompressionPolicy(CompressionPolicy policy); 0064 CompressionPolicy compressionPolicy() const; 0065 0066 void setCreationPermissions(QFile::Permissions permissions); 0067 QFile::Permissions creationPermissions() const; 0068 0069 void addFile(const QString &fileName, const QByteArray &data); 0070 0071 void addFile(const QString &fileName, QIODevice *device); 0072 0073 void addDirectory(const QString &dirName); 0074 0075 void addSymLink(const QString &fileName, const QString &destination); 0076 0077 void close(); 0078 private: 0079 MarbleZipWriterPrivate *d; 0080 Q_DISABLE_COPY(MarbleZipWriter) 0081 }; 0082 0083 } 0084 0085 #endif // QT_NO_TEXTODFWRITER 0086 #endif // MARBLEZIPWRITER_H