Marble

MarbleZipReader.h
1 // 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
2 //
3 // SPDX-FileCopyrightText: 2015 The Qt Company Ltd. <https://www.qt.io/licensing/>
4 // This file is based on qzipreader_p.h from Qt with the original license
5 // below, taken from
6 // https://code.qt.io/cgit/qt/qt.git/plain/src/gui/text/qzipreader_p.h
7 
8 #ifndef MARBLEZIPREADER_H
9 #define MARBLEZIPREADER_H
10 
11 #ifndef QT_NO_TEXTODFWRITER
12 
13 //
14 // W A R N I N G
15 // -------------
16 //
17 // This file is not part of the Qt API. It exists for the convenience
18 // of the QZipReader class. This header file may change from
19 // version to version without notice, or even be removed.
20 //
21 // We mean it.
22 //
23 
24 #include <QDateTime>
25 #include <QFile>
26 #include <QString>
27 
28 #include <marble_export.h>
29 
30 namespace Marble {
31 
32 class MarbleZipReaderPrivate;
33 
34 class MARBLE_EXPORT MarbleZipReader
35 {
36 public:
37  MarbleZipReader(const QString &fileName, QIODevice::OpenMode mode = QIODevice::ReadOnly );
38 
39  explicit MarbleZipReader(QIODevice *device);
40  ~MarbleZipReader();
41 
42  QIODevice* device() const;
43 
44  bool isReadable() const;
45  bool exists() const;
46 
47  struct MARBLE_EXPORT FileInfo
48  {
49  FileInfo();
50  FileInfo(const FileInfo &other);
51  ~FileInfo();
52  FileInfo &operator=(const FileInfo &other);
53  bool isValid() const;
54  QString filePath;
55  uint isDir : 1;
56  uint isFile : 1;
57  uint isSymLink : 1;
58  QFile::Permissions permissions;
59  uint crc32;
60  qint64 size;
61  QDateTime lastModified;
62  void *d;
63  };
64 
65  QList<FileInfo> fileInfoList() const;
66  int count() const;
67 
68  FileInfo entryInfoAt(int index) const;
69  QByteArray fileData(const QString &fileName) const;
70  bool extractAll(const QString &destinationDir) const;
71 
72  enum Status {
73  NoError,
74  FileReadError,
75  FileOpenError,
76  FilePermissionsError,
77  FileError
78  };
79 
80  Status status() const;
81 
82  void close();
83 
84 private:
85  MarbleZipReaderPrivate *d;
86  Q_DISABLE_COPY(MarbleZipReader)
87 };
88 
89 }
90 
91 #endif // QT_NO_TEXTODFWRITER
92 #endif // MARBLEZIPREADER_H
typedef OpenMode
Q_SCRIPTABLE CaptureState status()
QAction * close(const QObject *recvr, const char *slot, QObject *parent)
typedef Permissions
Binds a QML item to a specific geodetic location in screen coordinates.
bool isValid(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:12:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.