PageRenderTime 1455ms CodeModel.GetById 315ms app.highlight 655ms RepoModel.GetById 296ms app.codeStats 0ms

/src/libtomahawk/thirdparty/quazip/quazip/quazipnewinfo.h

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