~ubuntu-branches/debian/sid/chessx/sid

« back to all changes in this revision

Viewing changes to src/quazip/quazipnewinfo.h

  • Committer: Package Import Robot
  • Author(s): Niklas Fiekas
  • Date: 2013-10-31 17:02:37 UTC
  • Revision ID: package-import@ubuntu.com-20131031170237-wghf5j9jlv28gmls
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef QUA_ZIPNEWINFO_H
 
2
#define QUA_ZIPNEWINFO_H
 
3
 
 
4
/*
 
5
Copyright (C) 2005-2011 Sergey A. Tachenov
 
6
 
 
7
This program is free software; you can redistribute it and/or modify it
 
8
under the terms of the GNU Lesser General Public License as published by
 
9
the Free Software Foundation; either version 2 of the License, or (at
 
10
your option) any later version.
 
11
 
 
12
This program is distributed in the hope that it will be useful, but
 
13
WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
 
15
General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU Lesser General Public License
 
18
along with this program; if not, write to the Free Software Foundation,
 
19
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
20
 
 
21
See COPYING file for the full LGPL text.
 
22
 
 
23
Original ZIP package is copyrighted by Gilles Vollant, see
 
24
quazip/(un)zip.h files for details, basically it's zlib license.
 
25
 **/
 
26
 
 
27
#include <QDateTime>
 
28
#include <QString>
 
29
 
 
30
#include "quazip_global.h"
 
31
 
 
32
/// Information about a file to be created.
 
33
/** This structure holds information about a file to be created inside
 
34
 * ZIP archive. At least name should be set to something correct before
 
35
 * passing this structure to
 
36
 * QuaZipFile::open(OpenMode,const QuaZipNewInfo&,int,int,bool).
 
37
 **/
 
38
struct QUAZIP_EXPORT QuaZipNewInfo
 
39
{
 
40
    /// File name.
 
41
    /** This field holds file name inside archive, including path relative
 
42
     * to archive root.
 
43
     **/
 
44
    QString name;
 
45
    /// File timestamp.
 
46
    /** This is the last file modification date and time. Will be stored
 
47
     * in the archive central directory. It is a good practice to set it
 
48
     * to the source file timestamp instead of archive creating time. Use
 
49
     * setFileDateTime() or QuaZipNewInfo(const QString&, const QString&).
 
50
     **/
 
51
    QDateTime dateTime;
 
52
    /// File internal attributes.
 
53
    quint16 internalAttr;
 
54
    /// File external attributes.
 
55
    quint32 externalAttr;
 
56
    /// File comment.
 
57
    /** Will be encoded using QuaZip::getCommentCodec().
 
58
     **/
 
59
    QString comment;
 
60
    /// File local extra field.
 
61
    QByteArray extraLocal;
 
62
    /// File global extra field.
 
63
    QByteArray extraGlobal;
 
64
    /// Uncompressed file size.
 
65
    /** This is only needed if you are using raw file zipping mode, i. e.
 
66
     * adding precompressed file in the zip archive.
 
67
     **/
 
68
    ulong uncompressedSize;
 
69
    /// Constructs QuaZipNewInfo instance.
 
70
    /** Initializes name with \a name, dateTime with current date and
 
71
     * time. Attributes are initialized with zeros, comment and extra
 
72
     * field with null values.
 
73
     **/
 
74
    QuaZipNewInfo(const QString& name);
 
75
    /// Constructs QuaZipNewInfo instance.
 
76
    /** Initializes name with \a name and dateTime with timestamp of the
 
77
     * file named \a file. If the \a file does not exists or its timestamp
 
78
     * is inaccessible (e. g. you do not have read permission for the
 
79
     * directory file in), uses current date and time. Attributes are
 
80
     * initialized with zeros, comment and extra field with null values.
 
81
     *
 
82
     * \sa setFileDateTime()
 
83
     **/
 
84
    QuaZipNewInfo(const QString& name, const QString& file);
 
85
    /// Sets the file timestamp from the existing file.
 
86
    /** Use this function to set the file timestamp from the existing
 
87
     * file. Use it like this:
 
88
     * \code
 
89
     * QuaZipFile zipFile(&zip);
 
90
     * QFile file("file-to-add");
 
91
     * file.open(QIODevice::ReadOnly);
 
92
     * QuaZipNewInfo info("file-name-in-archive");
 
93
     * info.setFileDateTime("file-to-add"); // take the timestamp from file
 
94
     * zipFile.open(QIODevice::WriteOnly, info);
 
95
     * \endcode
 
96
     *
 
97
     * This function does not change dateTime if some error occured (e. g.
 
98
     * file is inaccessible).
 
99
     **/
 
100
    void setFileDateTime(const QString& file);
 
101
};
 
102
 
 
103
#endif