Zipios++
|
ZipFile is a FileCollection, where the files are stored in a .zip file. More...
#include <zipfile.h>
Public Member Functions | |
ZipFile () | |
Default constructor. | |
ZipFile (const string &name, int s_off=0, int e_off=0) | |
Constructor. | |
virtual FileCollection * | clone () const |
Create a heap allocated clone of the object this method is called for. | |
virtual | ~ZipFile () |
Destructor. | |
virtual void | close () |
Closes the FileCollection. | |
virtual istream * | getInputStream (const ConstEntryPointer &entry) |
Returns a pointer to an opened istream for the specified FileEntry. | |
virtual istream * | getInputStream (const string &entry_name, MatchPath matchpath=MATCH) |
Returns a pointer to an opened istream for the specified entry name. | |
![]() | |
FileCollection () | |
FileCollection constructor. | |
FileCollection (const FileCollection &src) | |
Copy constructor. | |
const FileCollection & | operator= (const FileCollection &src) |
Copy assignment operator. | |
virtual ConstEntries | entries () const |
Returns a vector of const pointers to the entries in the FileCollection. | |
virtual ConstEntryPointer | getEntry (const string &name, MatchPath matchpath=MATCH) const |
Returns a ConstEntryPointer to a FileEntry object for the entry with the specified name. | |
virtual string | getName () const |
Returns the name of the FileCollection. | |
virtual int | size () const |
Returns the number of entries in the FileCollection. | |
bool | isValid () const |
The member function returns true if the collection is valid. | |
virtual | ~FileCollection () |
FileCollection destructor. | |
Static Public Member Functions | |
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 followed by the start offset of the zip file. | |
Additional Inherited Members | |
![]() | |
enum | MatchPath { IGNORE , MATCH } |
![]() | |
string | _filename |
Entries | _entries |
bool | _valid |
ZipFile is a FileCollection, where the files are stored in a .zip file.
|
explicit |
Constructor.
Opens the zip file name. If the zip "file" is embedded in a file that contains other data, e.g. a binary program, the offset of the zip file start and end must be specified.
name | The filename of the zip file to open. |
s_off | Offset relative to the start of the file, that indicates the beginning of the zip file. |
e_off | Offset relative to the end of the file, that indicates the end of the zip file. The offset is a positive number, even though the offset is towards the beginning of the file. |
FColException | Thrown if the specified file name is not a valid zip archive. |
IOException | Thrown if an I/O problem is encountered, while the directory of the specified zip archive is being read. |
Definition at line 30 of file zipfile.cpp.
|
virtual |
Destructor.
Definition at line 46 of file zipfile.cpp.
|
virtual |
Create a heap allocated clone of the object this method is called for.
The caller is responsible for deallocating the clone when he is done with it.
Implements zipios::FileCollection.
Definition at line 41 of file zipfile.cpp.
|
virtual |
Closes the FileCollection.
Implements zipios::FileCollection.
Definition at line 50 of file zipfile.cpp.
|
virtual |
Returns a pointer to an opened istream for the specified FileEntry.
It is the callers responsibility to delete the stream when he is done with it. Returns 0, if there is no such FileEntry in the FileCollection.
entry | A ConstEntryPointer to the FileEntry to get an istream to. |
InvalidStateException | Thrown if the collection is invalid. |
Implements zipios::FileCollection.
Definition at line 55 of file zipfile.cpp.
|
virtual |
Returns a pointer to an opened istream for the specified entry name.
It is the callers responsibility to delete the stream when he is done with it. Returns 0, if there is no entry with the specified name in the FileCollection.
matchpath | Speficy MATCH, if the path should match as well, specify IGNORE, if the path should be ignored. |
InvalidStateException | Thrown if the collection is invalid. |
Implements zipios::FileCollection.
Definition at line 61 of file zipfile.cpp.
|
static |
Opens a Zip archive embedded in another file, by writing the zip archive to the end of the file followed by the start offset of the zip file.
The offset must be written in zip-file byte-order (little endian). The program appendzip, which is part of the Zipios++ distribution can be used to append a Zip archive to a file, e.g. a binary program.
FColException | Thrown if the specified file name is not a valid zip archive. |
IOException | Thrown if an I/O problem is encountered, while the directory of the specified zip archive is being read. |
Definition at line 19 of file zipfile.cpp.