home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-11-08  |  3.1 KB  |  104 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2002 Laurence Anderson <l.d.anderson@warwick.ac.uk>
  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 __kar_h
  19. #define __kar_h
  20.  
  21. #include <sys/stat.h>
  22. #include <sys/types.h>
  23.  
  24. #include <qdatetime.h>
  25. #include <qstring.h>
  26. #include <qstringlist.h>
  27. #include <qdict.h>
  28.  
  29. #include <karchive.h>
  30.  
  31. /**
  32.  * KAr is a class for reading archives in ar format. Writing
  33.  * is not supported.
  34.  * @short A class for reading ar archives.
  35.  * @author Laurence Anderson <l.d.anderson@warwick.ac.uk>
  36.  * @since 3.1
  37.  */
  38. class KIO_EXPORT KAr : public KArchive
  39. {
  40. public:
  41.     /**
  42.      * Creates an instance that operates on the given filename.
  43.      *
  44.      * @param filename is a local path (e.g. "/home/holger/myfile.ar")
  45.      */
  46.     KAr( const QString& filename );
  47.  
  48.     /**
  49.      * Creates an instance that operates on the given device.
  50.      * The device can be compressed (KFilterDev) or not (QFile, etc.).
  51.      * @param dev the device to read from
  52.      */
  53.     KAr( QIODevice * dev );
  54.  
  55.     /**
  56.      * If the ar file is still opened, then it will be
  57.      * closed automatically by the destructor.
  58.      */
  59.     virtual ~KAr();
  60.  
  61.     /**
  62.      * The name of the ar file, as passed to the constructor.
  63.      * @return the filename. Null if you used the QIODevice constructor
  64.      */
  65.     QString fileName() { return m_filename; }
  66.  
  67.     /*
  68.      * Writing not supported by this class, will always fail.
  69.      * @return always false
  70.      */
  71.     virtual bool prepareWriting( const QString& name, const QString& user, const QString& group, uint size ) { Q_UNUSED(name); Q_UNUSED(user); Q_UNUSED(group); Q_UNUSED(size); return false; }
  72.  
  73.     /*
  74.      * Writing not supported by this class, will always fail.
  75.      * @return always false
  76.      */
  77.     virtual bool doneWriting( uint size ) { Q_UNUSED(size); return false; }
  78.  
  79.     /*
  80.      * Writing not supported by this class, will always fail.
  81.      * @return always false
  82.      */
  83.     virtual bool writeDir( const QString& name, const QString& user, const QString& group )  { Q_UNUSED(name); Q_UNUSED(user); Q_UNUSED(group); return false; }
  84.  
  85. protected:
  86.     /**
  87.      * Opens the archive for reading.
  88.      * Parses the directory listing of the archive
  89.      * and creates the KArchiveDirectory/KArchiveFile entries.
  90.      *
  91.      */
  92.     virtual bool openArchive( int mode );
  93.     virtual bool closeArchive();
  94.  
  95. protected:
  96.     virtual void virtual_hook( int id, void* data );
  97. private:
  98.     QString m_filename;
  99.     class KArPrivate;
  100.     KArPrivate * d;
  101. };
  102.  
  103. #endif
  104.