8 class gzfilebuf : public streambuf {
15 gzfilebuf *open( const char *name, int io_mode );
16 gzfilebuf *attach( int file_descriptor, int io_mode );
19 int setcompressionlevel( int comp_level );
20 int setcompressionstrategy( int comp_strategy );
22 inline int is_open() const { return (file !=NULL); }
24 virtual streampos seekoff( streamoff, ios::seek_dir, int );
30 virtual int underflow();
31 virtual int overflow( int = EOF );
37 short own_file_descriptor;
44 class gzfilestream_common : virtual public ios {
46 friend class gzifstream;
47 friend class gzofstream;
48 friend gzofstream &setcompressionlevel( gzofstream &, int );
49 friend gzofstream &setcompressionstrategy( gzofstream &, int );
52 virtual ~gzfilestream_common();
54 void attach( int fd, int io_mode );
55 void open( const char *name, int io_mode );
59 gzfilestream_common();
68 class gzifstream : public gzfilestream_common, public istream {
73 gzifstream( const char *name, int io_mode = ios::in );
74 gzifstream( int fd, int io_mode = ios::in );
76 virtual ~gzifstream();
80 class gzofstream : public gzfilestream_common, public ostream {
85 gzofstream( const char *name, int io_mode = ios::out );
86 gzofstream( int fd, int io_mode = ios::out );
88 virtual ~gzofstream();
92 template<class T> class gzomanip {
93 friend gzofstream &operator<<(gzofstream &, const gzomanip<T> &);
95 gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { }
97 gzofstream &(*func)(gzofstream &, T);
101 template<class T> gzofstream &operator<<(gzofstream &s, const gzomanip<T> &m)
103 return (*m.func)(s, m.val);
106 inline gzofstream &setcompressionlevel( gzofstream &s, int l )
108 (s.rdbuf())->setcompressionlevel(l);
112 inline gzofstream &setcompressionstrategy( gzofstream &s, int l )
114 (s.rdbuf())->setcompressionstrategy(l);
118 inline gzomanip<int> setcompressionlevel(int l)
120 return gzomanip<int>(&setcompressionlevel,l);
123 inline gzomanip<int> setcompressionstrategy(int l)
125 return gzomanip<int>(&setcompressionstrategy,l);