zipfile.h
Go to the documentation of this file.
#ifndef ZIPFILE_H
#define ZIPFILE_H
#include "zipios++/zipios-config.h"
#include <vector>
#include "zipios++/meta-iostreams.h"
#include "zipios++/fcoll.h"
#include "zipios++/ziphead.h"
#include "zipios++/virtualseeker.h"
namespace zipios {
using std::ifstream ;
class ZipFile : public FileCollection {
public:
static ZipFile openEmbeddedZipFile( const string &name ) ;
ZipFile() {}
/* Default Copy constructor and copy assignment operator are sufficient. */
explicit ZipFile( const string &name, int s_off = 0, int e_off = 0
/* , ios::open_mode mode = ios::in | ios::binary */ ) ;
virtual FileCollection *clone() const ;
virtual ~ZipFile() ;
virtual void close() ;
virtual istream *getInputStream( const ConstEntryPointer &entry ) ;
virtual istream *getInputStream( const string &entry_name,
MatchPath matchpath = MATCH ) ;
private:
VirtualSeeker _vs ;
EndOfCentralDirectory _eocd ;
bool init( istream &_zipfile ) ;
bool readCentralDirectory( istream &_zipfile ) ;
bool readEndOfCentralDirectory( istream &_zipfile ) ;
bool confirmLocalHeaders( istream &_zipfile ) ;
void setError( string error_str ) ;
};
}
#endif
/*
Zipios++ - a small C++ library that provides easy access to .zip files.
Copyright (C) 2000 Thomas Søndergaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
zipios::EndOfCentralDirectory
The end of the Central directory structure.
Definition ziphead.h:159
zipios::FileCollection
FileCollection is an abstract baseclass that represents a collection of files.
Definition fcoll.h:21
zipios::FileCollection::FileCollection
FileCollection()
FileCollection constructor.
Definition fcoll.h:24
zipios::VirtualSeeker
VirtualSeeker is a simple class that keeps track of a set of specified 'virtual' file endings that ma...
Definition virtualseeker.h:20
zipios::ZipFile::~ZipFile
virtual ~ZipFile()
Destructor.
Definition zipfile.cpp:46
zipios::ZipFile::close
virtual void close()
Closes the FileCollection.
Definition zipfile.cpp:50
zipios::ZipFile::ZipFile
ZipFile()
Default constructor.
Definition zipfile.h:37
zipios::ZipFile::openEmbeddedZipFile
static ZipFile openEmbeddedZipFile(const string &name)
Opens a Zip archive embedded in another file, by writing the zip archive to the end of the file follo...
Definition zipfile.cpp:19
zipios::ZipFile::clone
virtual FileCollection * clone() const
Create a heap allocated clone of the object this method is called for.
Definition zipfile.cpp:41
zipios::ZipFile::getInputStream
virtual istream * getInputStream(const ConstEntryPointer &entry)
Returns a pointer to an opened istream for the specified FileEntry.
Definition zipfile.cpp:55
fcoll.h
Header file that defines FileCollection.
zipios::ConstEntryPointer
SimpleSmartPointer< const FileEntry > ConstEntryPointer
ConstEntryPointer is a SimpleSmartPointer for const FileEntry's.
Definition fileentry.h:37
virtualseeker.h
Header file that defines VirtualSeeker.
ziphead.h
Header file containing classes and functions for reading the central directory and local header field...