1 #ifndef INFLATEINPUTSTREAMBUF_H
2 #define INFLATEINPUTSTREAMBUF_H
4 #include "zipios++/zipios-config.h"
6 #include "zipios++/meta-iostreams.h"
11 #include "zipios++/filterinputstreambuf.h"
17 /** InflateInputStreambuf is an input stream filter, that inflates the input
18 from the attached input stream. Deflation/Inflation is a
19 compression/decompression method used in gzip and zip. The zlib
20 library is used to perform the actual inflation, this class only
21 wraps the functionality in an input stream filter. */
22 class InflateInputStreambuf : public FilterInputStreambuf {
24 /** InflateInputStreambuf constructor.
25 @param inbuf the streambuf to use for input.
26 @param s_pos a position to reset the inbuf to before reading. Specify
27 -1 to read from the current position.
28 @param del_inbuf if true is specified inbuf will be deleted, when
29 the InflateInputStreambuf is destructed.
31 explicit InflateInputStreambuf( streambuf *inbuf, int s_pos = -1, bool del_inbuf = false ) ;
32 virtual ~InflateInputStreambuf() ;
34 /** Resets the zlib stream and purges input and output buffers.
35 repositions the input streambuf at stream_position.
36 @param stream_position a position to reset the inbuf to before reading. Specify
37 -1 to read from the current position.
39 bool reset( int stream_position = -1 ) ;
41 virtual int underflow() ;
44 bool _zs_initialized ;
45 const int _invecsize ;
46 vector< char > _invec ;
47 protected: // FIXME: reconsider design?
48 const int _outvecsize ;
49 vector< char > _outvec ;
53 /** Copy-constructor is private to prevent copying. */
54 InflateInputStreambuf( const InflateInputStreambuf &src ) ;
56 /** Copy-assignment operator is private to prevent copying. */
57 const InflateInputStreambuf &operator= ( const InflateInputStreambuf &src ) ;
69 Header file that defines InflateInputStreambuf.
73 Zipios++ - a small C++ library that provides easy access to .zip files.
74 Copyright (C) 2000 Thomas Søndergaard
76 This library is free software; you can redistribute it and/or
77 modify it under the terms of the GNU Lesser General Public
78 License as published by the Free Software Foundation; either
79 version 2 of the License, or (at your option) any later version.
81 This library is distributed in the hope that it will be useful,
82 but WITHOUT ANY WARRANTY; without even the implied warranty of
83 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
84 Lesser General Public License for more details.
86 You should have received a copy of the GNU Lesser General Public
87 License along with this library; if not, write to the Free Software
88 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA