Zipios++
|
00001 #ifndef GZIPOUTPUTSTREAMBUF_H 00002 #define GZIPOUTPUTSTREAMBUF_H 00003 00004 #include "zipios++/zipios-config.h" 00005 00006 #include <vector> 00007 00008 #include <zlib.h> 00009 00010 #include "zipios++/deflateoutputstreambuf.h" 00011 00012 namespace zipios { 00013 00015 class GZIPOutputStreambuf : public DeflateOutputStreambuf { 00016 public: 00017 00023 explicit GZIPOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ; 00024 00025 void setFilename( const string &filename ); 00026 void setComment( const string &comment ); 00027 00029 void close() ; 00030 00032 void finish() ; 00033 00035 virtual ~GZIPOutputStreambuf() ; 00036 00037 protected: 00038 virtual int overflow( int c = EOF ) ; 00039 virtual int sync() ; 00040 00041 private: 00042 void writeHeader(); 00043 void writeTrailer(); 00044 void writeInt(uint32 i); 00045 00046 std::string _filename; 00047 std::string _comment; 00048 bool _open ; 00049 }; 00050 00051 00052 } // namespace 00053 00054 00055 00056 #endif 00057 00062 /* 00063 Zipios++ - a small C++ library that provides easy access to .zip files. 00064 Copyright (C) 2000 Thomas Søndergaard 00065 00066 This library is free software; you can redistribute it and/or 00067 modify it under the terms of the GNU Lesser General Public 00068 License as published by the Free Software Foundation; either 00069 version 2 of the License, or (at your option) any later version. 00070 00071 This library is distributed in the hope that it will be useful, 00072 but WITHOUT ANY WARRANTY; without even the implied warranty of 00073 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00074 Lesser General Public License for more details. 00075 00076 You should have received a copy of the GNU Lesser General Public 00077 License along with this library; if not, write to the Free Software 00078 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00079 */