kio Library API Documentation

ktar.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003    Copyright (C) 2003 Leo Savernik <l.savernik@aon.at>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 #ifndef __ktar_h
00020 #define __ktar_h
00021 
00022 #include <sys/stat.h>
00023 #include <sys/types.h>
00024 
00025 #include <qdatetime.h>
00026 #include <qstring.h>
00027 #include <qstringlist.h>
00028 #include <qdict.h>
00029 
00030 #include <karchive.h>
00031 
00038 class KTar : public KArchive
00039 {
00040 public:
00050     KTar( const QString& filename, const QString & mimetype = QString::null );
00051 
00060     KTar( QIODevice * dev );
00061 
00066     virtual ~KTar();
00067 
00073     QString fileName() { return m_filename; }
00074 
00081     void setOrigFileName( const QCString & fileName );
00082 
00083     // TODO(BIC) make virtual. For now it must be implemented by virtual_hook.
00084     bool writeSymLink(const QString &name, const QString &target,
00085                 const QString &user, const QString &group,
00086                 mode_t perm, time_t atime, time_t mtime, time_t ctime);
00087     virtual bool writeDir( const QString& name, const QString& user, const QString& group );
00088     // TODO(BIC) make virtual. For now it must be implemented by virtual_hook.
00089     bool writeDir( const QString& name, const QString& user, const QString& group,
00090                 mode_t perm, time_t atime, time_t mtime, time_t ctime );
00091     virtual bool prepareWriting( const QString& name, const QString& user, const QString& group, uint size );
00092     // TODO(BIC) make virtual. For now it must be implemented by virtual_hook.
00093     bool prepareWriting( const QString& name, const QString& user,
00094                 const QString& group, uint size, mode_t perm,
00095                 time_t atime, time_t mtime, time_t ctime );
00096     virtual bool doneWriting( uint size );
00097 
00098 protected:
00105     virtual bool openArchive( int mode );
00106     virtual bool closeArchive();
00107 
00108 private:
00112     void prepareDevice( const QString & filename, const QString & mimetype, bool forced = false );
00113 
00121     void fillBuffer( char * buffer, const char * mode, int size, time_t mtime,
00122             char typeflag, const char * uname, const char * gname );
00123 
00135     void writeLonglink(char *buffer, const QCString &name, char typeflag,
00136             const char *uname, const char *gname);
00137 
00138     Q_LONG readRawHeader(char *buffer);
00139     bool readLonglink(char *buffer,QCString &longlink);
00140     Q_LONG readHeader(char *buffer,QString &name,QString &symlink);
00141 
00142     QString m_filename;
00143 protected:
00144     virtual void virtual_hook( int id, void* data );
00145     bool prepareWriting_impl(const QString& name, const QString& user,
00146                 const QString& group, uint size, mode_t perm,
00147                 time_t atime, time_t mtime, time_t ctime);
00148     bool writeDir_impl(const QString& name, const QString& user,
00149                 const QString& group, mode_t perm,
00150                 time_t atime, time_t mtime, time_t ctime );
00151     bool writeSymLink_impl(const QString &name, const QString &target,
00152                 const QString &user, const QString &group,
00153                 mode_t perm, time_t atime, time_t mtime, time_t ctime);
00154 private:
00155     class KTarPrivate;
00156     KTarPrivate * d;
00157 };
00158 
00162 #define KTarGz KTar
00163 #define KTarEntry KArchiveEntry
00164 #define KTarFile KArchiveFile
00165 #define KTarDirectory KArchiveDirectory
00166 
00167 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Apr 21 18:43:48 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003