00001
00002 #include "zipios++/zipios-config.h"
00003
00004 #include "zipios++/meta-iostreams.h"
00005
00006 #include "zipios++/gzipoutputstreambuf.h"
00007 #include "zipios++/gzipoutputstream.h"
00008
00009 using std::ostream;
00010
00011 namespace zipios {
00012
00013 GZIPOutputStream::GZIPOutputStream( std::ostream &os )
00014 : ostream( 0 ),
00015 ofs( 0 )
00016 {
00017 ozf = new GZIPOutputStreambuf( os.rdbuf() ) ;
00018
00019 init( ozf ) ;
00020 }
00021
00022 GZIPOutputStream::GZIPOutputStream( const std::string &filename )
00023 : ostream( 0 ),
00024 ofs( 0 )
00025 {
00026 ofs = new std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ;
00027 ozf = new GZIPOutputStreambuf( ofs->rdbuf() ) ;
00028 init( ozf ) ;
00029 }
00030
00031 void GZIPOutputStream::setFilename( const string &filename ) {
00032 ozf->setFilename(filename);
00033 }
00034
00035 void GZIPOutputStream::setComment( const string &comment ) {
00036 ozf->setComment(comment);
00037 }
00038
00039 void GZIPOutputStream::close() {
00040 ozf->close() ;
00041 if ( ofs )
00042 ofs->close() ;
00043 }
00044
00045
00046 void GZIPOutputStream::finish() {
00047 ozf->finish() ;
00048 }
00049
00050
00051 GZIPOutputStream::~GZIPOutputStream() {
00052
00053 delete ozf ;
00054 delete ofs ;
00055 }
00056
00057 }
00058
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080