2 #ifdef SOPLEX_WITH_ZLIB 36 #ifdef GZSTREAM_NAMESPACE 49 gzstreambuf* gzstreambuf::open(
const char* _name,
int _open_mode)
54 mode =
static_cast<unsigned int>(_open_mode);
57 if((mode & std::ios::ate) || (mode & std::ios::app)
58 || ((mode & std::ios::in) && (mode & std::ios::out)))
62 char* fmodeptr = fmode;
64 if(mode & std::ios::in)
66 else if(mode & std::ios::out)
71 file = gzopen(_name, fmode);
80 gzstreambuf* gzstreambuf::close()
87 if(gzclose(file) == Z_OK)
94 int gzstreambuf::underflow()
96 if(gptr() && (gptr() < egptr()))
97 return *
reinterpret_cast<unsigned char*
>(gptr());
99 if(!(mode & std::ios::in) || ! opened)
103 size_t n_putback = (size_t)(gptr() - eback());
108 memcpy(buffer + (4 - n_putback), gptr() - n_putback, n_putback);
110 int num = gzread(file, buffer + 4, bufferSize - 4);
116 setg(buffer + (4 - n_putback),
121 return *
reinterpret_cast<unsigned char*
>(gptr());
124 int gzstreambuf::flush_buffer()
128 int w =
static_cast<int>(pptr() - pbase());
130 if(gzwrite(file, pbase(), (
unsigned int) w) != w)
137 int gzstreambuf::overflow(
int c)
139 if(!(mode & std::ios::out) || ! opened)
144 *pptr() =
static_cast<char>(c);
148 if(flush_buffer() == EOF)
154 int gzstreambuf::sync()
159 if(pptr() && pptr() > pbase())
161 if(flush_buffer() == EOF)
172 gzstreambase::gzstreambase(
const char* name,
int mode)
178 gzstreambase::~gzstreambase()
183 void gzstreambase::open(
const char* _name,
int _open_mode)
185 if(! buf.open(_name, _open_mode))
186 setstate(std::ios::badbit);
191 void gzstreambase::close()
195 setstate(std::ios::badbit);
200 #ifdef GZSTREAM_NAMESPACE
Debugging, floating point type and parameter definitions.