| ★ wanayoo — archive 1999 http://zipios.sourceforge.net/zipinputstream.cpp-source.html | Nouvelle recherche | Portail wanayoo |
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 // SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first?? 00014 ifs( 0 ) 00015 { 00016 izf = new ZipInputStreambuf( is.rdbuf(), pos ) ; 00017 // this->rdbuf( izf ) ; is replaced by: 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 // this->rdbuf( izf ) ; is replaced by: 00028 this->init( izf ) ; 00029 } 00030 00031 int ZipInputStream::available() { 00032 return 1 ; // FIXME: Dummy implementation 00033 } 00034 00035 void ZipInputStream::closeEntry() { 00036 izf->closeEntry() ; 00037 } 00038 00039 void ZipInputStream::close() { 00040 izf->close() ; 00041 } 00042 00043 // ZipLocalEntry *ZipInputStream::createZipCDirEntry( const string 00044 // &name ) {} 00045 00046 ConstEntryPointer ZipInputStream::getNextEntry() { 00047 clear() ; // clear eof and other flags. 00048 return izf->getNextEntry() ; 00049 } 00050 00051 ZipInputStream::~ZipInputStream() { 00052 // It's ok to call delete with a Null pointer. 00053 delete izf ; 00054 delete ifs ; 00055 } 00056 00057 } // namespace 00058 00063 /* 00064 Zipios++ - a small C++ library that provides easy access to .zip files. 00065 Copyright (C) 2000 Thomas Søndergaard 00066 00067 This library is free software; you can redistribute it and/or 00068 modify it under the terms of the GNU Lesser General Public 00069 License as published by the Free Software Foundation; either 00070 version 2 of the License, or (at your option) any later version. 00071 00072 This library is distributed in the hope that it will be useful, 00073 but WITHOUT ANY WARRANTY; without even the implied warranty of 00074 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00075 Lesser General Public License for more details. 00076 00077 You should have received a copy of the GNU Lesser General Public 00078 License along with this library; if not, write to the Free Software 00079 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00080 */
1.2.0 written by Dimitri van Heesch,
© 1997-2000