33 #ifdef FIX8_HAVE_ZLIB_H
40 #ifdef GZSTREAM_NAMESPACE
41 namespace GZSTREAM_NAMESPACE {
48 class gzstreambuf :
public std::streambuf
51 enum { bufferSize = 47+256 };
55 char buffer[bufferSize];
61 gzstreambuf() : opened(0)
63 setp( buffer, buffer + (bufferSize-1));
69 int is_open() {
return opened; }
70 gzstreambuf* open(
const char* name,
int open_mode);
72 ~gzstreambuf() { close(); }
74 virtual int overflow(
int c = EOF);
75 virtual int underflow();
79 class gzstreambase :
virtual public std::ios
84 gzstreambase() { init(&buf); }
85 gzstreambase(
const char* name,
int open_mode);
87 void open(
const char* name,
int open_mode);
89 gzstreambuf* rdbuf() {
return &buf; }
92 class ogzstream :
public gzstreambase,
public std::ostream
95 ogzstream() :
std::ostream( &buf) {}
96 ogzstream(
const char* name,
int mode = std::ios::out)
97 : gzstreambase( name, mode),
std::ostream( &buf) {}
98 gzstreambuf* rdbuf() {
return gzstreambase::rdbuf(); }
99 void open(
const char* name,
int open_mode = std::ios::out)
101 gzstreambase::open( name, open_mode);
104 bool operator!()
const {
return this->fail(); }
107 #ifdef GZSTREAM_NAMESPACE
111 #endif // FIX8_HAVE_ZLIB_H