]> git.donarmstrong.com Git - flightcrew.git/blob - src/zipios/zipios++/gzipoutputstreambuf.h
Imported Upstream version 0.7.2+dfsg
[flightcrew.git] / src / zipios / zipios++ / gzipoutputstreambuf.h
1 #ifndef GZIPOUTPUTSTREAMBUF_H
2 #define GZIPOUTPUTSTREAMBUF_H
3
4 #include "zipios++/zipios-config.h"
5
6 #include <vector>
7
8 #include <zlib.h>
9
10 #include "zipios++/deflateoutputstreambuf.h"
11
12 namespace zipios {
13
14 /** GZIPOutputStreambuf is a zip output streambuf filter.  */
15 class GZIPOutputStreambuf : public DeflateOutputStreambuf {
16 public:
17
18   /** GZIPOutputStreambuf constructor. A newly constructed GZIPOutputStreambuf
19       is ready to accept data.
20       @param outbuf the streambuf to use for output.
21       @param del_outbuf if true is specified outbuf will be deleted, when 
22       the GZIPOutputStreambuf is destructed.  */
23   explicit GZIPOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ;
24
25   void setFilename( const string &filename );
26   void setComment( const string &comment );
27
28   /** Calls finish. */
29   void close() ;
30
31   /** Finishes the compression. */
32   void finish() ;
33
34   /** Destructor. */
35   virtual ~GZIPOutputStreambuf() ;
36
37 protected:
38   virtual int overflow( int c = EOF ) ;
39   virtual int sync() ;
40
41 private:
42   void writeHeader();
43   void writeTrailer();
44   void writeInt(uint32 i);
45   
46   std::string _filename;
47   std::string _comment;
48   bool _open ;
49 };
50
51
52 } // namespace
53
54
55
56 #endif
57
58 /** \file
59     Header file that defines ZipOutputStreambuf.
60 */
61
62 /*
63   Zipios++ - a small C++ library that provides easy access to .zip files.
64   Copyright (C) 2000  Thomas Søndergaard
65   
66   This library is free software; you can redistribute it and/or
67   modify it under the terms of the GNU Lesser General Public
68   License as published by the Free Software Foundation; either
69   version 2 of the License, or (at your option) any later version.
70   
71   This library is distributed in the hope that it will be useful,
72   but WITHOUT ANY WARRANTY; without even the implied warranty of
73   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
74   Lesser General Public License for more details.
75   
76   You should have received a copy of the GNU Lesser General Public
77   License along with this library; if not, write to the Free Software
78   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
79 */