Stellarium 0.15.2
qzipwriter.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #ifndef QZIPWRITER_H
42 #define QZIPWRITER_H
43 
44 #include <QtGlobal>
45 #include <QString>
46 #include <QFile>
47 
48 // QT_BEGIN_NAMESPACE
49 namespace Stel {
50 
51 class QZipWriterPrivate;
52 
53 class /* Q_GUI_EXPORT */ QZipWriter
54 {
55 public:
56  explicit QZipWriter(const QString &fileName, QIODevice::OpenMode mode = (QIODevice::WriteOnly | QIODevice::Truncate) );
57 
58  explicit QZipWriter(QIODevice *device);
59  ~QZipWriter();
60 
61  QIODevice* device() const;
62 
63  bool isWritable() const;
64  bool exists() const;
65 
66  enum Status {
67  NoError,
68  FileWriteError,
69  FileOpenError,
70  FilePermissionsError,
71  FileError
72  };
73 
74  Status status() const;
75 
76  enum CompressionPolicy {
77  AlwaysCompress,
78  NeverCompress,
79  AutoCompress
80  };
81 
82  void setCompressionPolicy(CompressionPolicy policy);
83  CompressionPolicy compressionPolicy() const;
84 
85  void setCreationPermissions(QFile::Permissions permissions);
86  QFile::Permissions creationPermissions() const;
87 
88  void addFile(const QString &fileName, const QByteArray &data);
89 
90  void addFile(const QString &fileName, QIODevice *device);
91 
92  void addDirectory(const QString &dirName);
93 
94  void addSymLink(const QString &fileName, const QString &destination);
95 
96  void close();
97 private:
98  QZipWriterPrivate *d;
99  Q_DISABLE_COPY(QZipWriter)
100 };
101 
102 // QT_END_NAMESPACE
103 }
104 
105 #endif // QZIPWRITER_H