00001
00002 #include "zipios++/zipios-config.h"
00003
00004 #include "zipios++/meta-iostreams.h"
00005
00006 #include "zipios++/zipinputstreambuf.h"
00007 #include "zipios++/zipinputstream.h"
00008
00009 namespace zipios {
00010
00011 ZipInputStream::ZipInputStream( istream &is, streampos pos )
00012 : istream( 0 ),
00013
00014 ifs( 0 )
00015 {
00016 izf = new ZipInputStreambuf( is.rdbuf(), pos ) ;
00017
00018 this->init( izf ) ;
00019 }
00020
00021 ZipInputStream::ZipInputStream( const string &filename, streampos pos )
00022 : istream( 0 ),
00023 ifs( 0 )
00024 {
00025 ifs = new ifstream( filename.c_str(), ios::in | ios::binary ) ;
00026 izf = new ZipInputStreambuf( ifs->rdbuf(), pos ) ;
00027
00028 this->init( izf ) ;
00029 }
00030
00031 int ZipInputStream::available() {
00032 return 1 ;
00033 }
00034
00035 void ZipInputStream::closeEntry() {
00036 izf->closeEntry() ;
00037 }
00038
00039 void ZipInputStream::close() {
00040 izf->close() ;
00041 }
00042
00043
00044
00045
00046 ConstEntryPointer ZipInputStream::getNextEntry() {
00047 clear() ;
00048 return izf->getNextEntry() ;
00049 }
00050
00051 ZipInputStream::~ZipInputStream() {
00052
00053 delete izf ;
00054 delete ifs ;
00055 }
00056
00057 }
00058
00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080