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