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
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
00070 delete ozf ;
00071 delete ofs ;
00072 }
00073
00074 }
00075
00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097