zipfile.h

Go to the documentation of this file.
00001 #ifndef ZIPFILE_H
00002 #define ZIPFILE_H
00003 
00004 #include "zipios-config.h"
00005 
00006 #include <vector>
00007 #include "meta-iostreams.h"
00008 
00009 #include "fcoll.h"
00010 #include "ziphead.h"
00011 #include "virtualseeker.h"
00012 
00013 namespace zipios {
00014 
00015 using std::ifstream ;
00016 
00020 class BaseExport ZipFile : public FileCollection {
00021 public:
00033   static ZipFile openEmbeddedZipFile( const string &name ) ;
00034 
00037   ZipFile() {}
00038 
00039   /* Default Copy constructor and copy assignment operator are sufficient. */
00040 
00055   explicit ZipFile( const string &name, int s_off = 0, int e_off = 0
00056                     /* , ios::open_mode mode  = ios::in | ios::binary */ ) ;
00057 
00058   virtual FileCollection *clone() const ;
00059 
00061   virtual ~ZipFile() ;
00062 
00063   virtual void close() ;
00064 
00065   virtual istream *getInputStream( const ConstEntryPointer &entry ) ;
00066   virtual istream *getInputStream( const string &entry_name, 
00067                                      MatchPath matchpath = MATCH ) ;
00068 private:
00069   VirtualSeeker _vs ;
00070   EndOfCentralDirectory  _eocd ;
00071 
00072   bool init( istream &_zipfile ) ;
00073   bool readCentralDirectory( istream &_zipfile ) ;
00074   bool readEndOfCentralDirectory( istream &_zipfile ) ;
00075   bool confirmLocalHeaders( istream &_zipfile ) ;
00076   void setError( string error_str ) ;
00077 };
00078 
00079 }
00080 
00081 #endif
00082 
00087 /*
00088   Zipios++ - a small C++ library that provides easy access to .zip files.
00089   Copyright (C) 2000  Thomas Søndergaard
00090   
00091   This library is free software; you can redistribute it and/or
00092   modify it under the terms of the GNU Lesser General Public
00093   License as published by the Free Software Foundation; either
00094   version 2 of the License, or (at your option) any later version.
00095   
00096   This library is distributed in the hope that it will be useful,
00097   but WITHOUT ANY WARRANTY; without even the implied warranty of
00098   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00099   Lesser General Public License for more details.
00100   
00101   You should have received a copy of the GNU Lesser General Public
00102   License along with this library; if not, write to the Free Software
00103   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00104 */

Generated on Wed Nov 23 19:01:12 2011 for FreeCAD by  doxygen 1.6.1