• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.12
  • kdelibs
  • kdecore
  • io
kzip.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2002 Holger Schroeder <holger-kde@holgis.net>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 #ifndef KZIP_H
19 #define KZIP_H
20 
21 #include <karchive.h>
22 
23 class KZipFileEntry;
45 class KDECORE_EXPORT KZip : public KArchive
46 {
47 public:
54  KZip( const QString& filename );
55 
63  KZip( QIODevice * dev );
64 
69  virtual ~KZip();
70 
74  enum ExtraField { NoExtraField = 0,
75  ModificationTime = 1,
76  DefaultExtraField = 1
77  };
78 
85  void setExtraField( ExtraField ef );
86 
92  ExtraField extraField() const;
93 
97  enum Compression { NoCompression = 0,
98  DeflateCompression = 1
99  };
100 
101 
108  void setCompression( Compression c );
109 
115  Compression compression() const;
116 
123  virtual bool writeData( const char* data, qint64 size );
124 
125 protected:
127  virtual bool doWriteSymLink(const QString &name, const QString &target,
128  const QString &user, const QString &group,
129  mode_t perm, time_t atime, time_t mtime, time_t ctime);
131  virtual bool doPrepareWriting( const QString& name, const QString& user,
132  const QString& group, qint64 size, mode_t perm,
133  time_t atime, time_t mtime, time_t ctime );
134 
140  virtual bool doFinishWriting( qint64 size );
141 
148  virtual bool openArchive( QIODevice::OpenMode mode );
149 
151  virtual bool closeArchive();
152 
154  virtual bool doWriteDir( const QString& name, const QString& user,
155  const QString& group, mode_t perm, time_t atime,
156  time_t mtime, time_t ctime );
157 
158 protected:
159  virtual void virtual_hook( int id, void* data );
160 
161 private:
162  class KZipPrivate;
163  KZipPrivate * const d;
164 };
165 
166 
170 class KDECORE_EXPORT KZipFileEntry : public KArchiveFile
171 {
172 public:
176  KZipFileEntry( KZip* zip, const QString& name, int access, int date,
177  const QString& user, const QString& group, const QString& symlink,
178  const QString& path, qint64 start, qint64 uncompressedSize,
179  int encoding, qint64 compressedSize);
180 
184  ~KZipFileEntry();
185 
186  int encoding() const;
187  qint64 compressedSize() const;
188 
190  void setCompressedSize(qint64 compressedSize);
191 
193  void setHeaderStart(qint64 headerstart);
194  qint64 headerStart() const;
195 
197  unsigned long crc32() const;
198  void setCRC32(unsigned long crc32);
199 
201  const QString &path() const;
202 
207  virtual QByteArray data() const;
208 
216  virtual QIODevice* createDevice() const;
217 
218 private:
219  class KZipFileEntryPrivate;
220  KZipFileEntryPrivate * const d;
221 };
222 
223 #endif
KZip::ExtraField
ExtraField
Describes the contents of the "extra field" for a given file in the Zip archive.
Definition: kzip.h:74
qint64
KArchive::virtual_hook
virtual void virtual_hook(int id, void *data)
Definition: karchive.cpp:860
KMacroExpander::group
Definition: kmacroexpander_unix.cpp:34
KArchive
KArchive is a base class for reading and writing archives.
Definition: karchive.h:43
QString
KArchive::openArchive
virtual bool openArchive(QIODevice::OpenMode mode)=0
Opens an archive for reading or writing.
KArchive::writeData
virtual bool writeData(const char *data, qint64 size)
Write data into the current file - to be called after calling prepareWriting.
Definition: karchive.cpp:345
karchive.h
KArchiveFile::createDevice
virtual QIODevice * createDevice() const
This method returns QIODevice (internal class: KLimitedIODevice) on top of the underlying QIODevice...
Definition: karchive.cpp:652
KZip
A class for reading / writing zip archives.
Definition: kzip.h:45
KArchive::doWriteSymLink
virtual bool doWriteSymLink(const QString &name, const QString &target, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)=0
Writes a symbolic link to the archive.
KArchive::doWriteDir
virtual bool doWriteDir(const QString &name, const QString &user, const QString &group, mode_t perm, time_t atime, time_t mtime, time_t ctime)=0
Write a directory to the archive.
KArchive::doPrepareWriting
virtual bool doPrepareWriting(const QString &name, const QString &user, const QString &group, qint64 size, mode_t perm, time_t atime, time_t mtime, time_t ctime)=0
This virtual method must be implemented by subclasses.
KZip::Compression
Compression
Describes the compression type for a given file in the Zip archive.
Definition: kzip.h:97
KDE::access
int access(const QString &path, int mode)
Definition: kde_file_win.cpp:123
KArchive::closeArchive
virtual bool closeArchive()=0
Closes the archive.
KArchiveFile
Represents a file entry in a KArchive.
Definition: karchive.h:457
KArchive::doFinishWriting
virtual bool doFinishWriting(qint64 size)=0
Called after writing the data.
QIODevice
KArchiveFile::data
virtual QByteArray data() const
Returns the data of the file.
Definition: karchive.cpp:635
KZipFileEntry
A KZipFileEntry represents an file in a zip archive.
Definition: kzip.h:170
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal