Main Page   Class Hierarchy   Compound List   File List   Compound Members  

zipoutputstream.cpp

Go to the documentation of this file.
00001 
00002 #include "zipios++/zipios-config.h"
00003 
00004 #include "zipios++/meta-iostreams.h"
00005 
00006 #include "zipios++/zipoutputstreambuf.h"
00007 #include "zipios++/zipoutputstream.h"
00008 
00009 namespace zipios {
00010 
00011 ZipOutputStream::ZipOutputStream( ostream &os, streampos pos ) 
00012   : ostream( 0 ), 
00013 // SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first??
00014     ofs( 0 )
00015 {
00016   ozf = new ZipOutputStreambuf( os.rdbuf(), pos ) ;
00017   
00018   init( ozf ) ;
00019 }
00020 
00021 
00022 ZipOutputStream::ZipOutputStream( const string &filename, streampos pos )
00023   : ostream( 0 ),
00024     ofs( 0 )
00025 {
00026   ofs = new ofstream( filename.c_str(), ios::out | ios::binary ) ;
00027   ozf = new ZipOutputStreambuf( ofs->rdbuf(), pos ) ;
00028   this->init( ozf ) ;
00029 }
00030 
00031 void ZipOutputStream::closeEntry() {
00032   ozf->closeEntry() ;
00033 }
00034 
00035 
00036 void ZipOutputStream::close() {
00037   ozf->close() ;  
00038   if ( ofs )
00039     ofs->close() ;
00040 }
00041 
00042 
00043 void ZipOutputStream::finish() {
00044   ozf->finish() ;
00045 }
00046 
00047 
00048 void ZipOutputStream::putNextEntry( const ZipCDirEntry &entry ) {
00049   ozf->putNextEntry( entry ) ;
00050 }
00051 
00052 
00053 void ZipOutputStream::setComment( const string &comment ) {
00054   ozf->setComment( comment ) ;
00055 }
00056 
00057 
00058 void ZipOutputStream::setLevel( int level ) {
00059   ozf->setLevel( level ) ;
00060 }
00061 
00062 
00063 void ZipOutputStream::setMethod( StorageMethod method ) {
00064   ozf->setMethod( method ) ;
00065 }
00066 
00067 
00068 ZipOutputStream::~ZipOutputStream() {
00069   // It's ok to call delete with a Null pointer.
00070   delete ozf ;
00071   delete ofs ;
00072 }
00073 
00074 } // namespace
00075 
00080 /*
00081   Zipios++ - a small C++ library that provides easy access to .zip files.
00082   Copyright (C) 2000  Thomas Søndergaard
00083   
00084   This library is free software; you can redistribute it and/or
00085   modify it under the terms of the GNU Lesser General Public
00086   License as published by the Free Software Foundation; either
00087   version 2 of the License, or (at your option) any later version.
00088   
00089   This library is distributed in the hope that it will be useful,
00090   but WITHOUT ANY WARRANTY; without even the implied warranty of
00091   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00092   Lesser General Public License for more details.
00093   
00094   You should have received a copy of the GNU Lesser General Public
00095   License along with this library; if not, write to the Free Software
00096   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00097 */

Generated at Tue Aug 14 20:39:26 2001 for Zipios++ by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000