15 #define BIGBUFSIZE BUFSIZ
16 #define SMALLBUFSIZE 1
22 :
file(NULL), io_mode(
std::ios_base::openmode(0)), own_fd(
false),
26 this->disable_buffer();
52 std::ios_base::openmode
mode)
62 char char_mode[6] =
"\0\0\0\0\0";
80 std::ios_base::openmode
mode)
90 char char_mode[6] =
"\0\0\0\0\0";
115 if (this->
sync() == -1)
134 bool testb =
mode & std::ios_base::binary;
138 bool testa =
mode & std::ios_base::app;
145 if (!testi && testo && !testt && !testa)
147 if (!testi && testo && !testt && testa)
149 if (!testi && testo && testt && !testa)
151 if (testi && !testo && !testt && !testa)
160 if (strlen(c_mode) == 0)
175 if (this->gptr() && (this->gptr() < this->egptr()))
176 return std::streamsize(this->egptr() - this->gptr());
188 if (this->gptr() && (this->gptr() < this->egptr()))
189 return traits_type::to_int_type(*(this->gptr()));
193 return traits_type::eof();
203 return traits_type::eof();
209 return traits_type::to_int_type(*(this->gptr()));
220 if (this->pptr() > this->epptr() || this->pptr() < this->pbase())
221 return traits_type::eof();
223 if (!traits_type::eq_int_type(
c, traits_type::eof()))
225 *(this->pptr()) = traits_type::to_char_type(
c);
229 int bytes_to_write = this->pptr() - this->pbase();
231 if (bytes_to_write > 0)
235 return traits_type::eof();
237 if (
gzwrite(
file, this->pbase(), bytes_to_write) != bytes_to_write)
238 return traits_type::eof();
240 this->pbump(-bytes_to_write);
244 else if (!traits_type::eq_int_type(
c, traits_type::eof()))
248 return traits_type::eof();
250 char_type last_char = traits_type::to_char_type(
c);
253 return traits_type::eof();
258 if (traits_type::eq_int_type(
c, traits_type::eof()))
259 return traits_type::not_eof(
c);
270 if (this->
sync() == -1)
301 return traits_type::eq_int_type(this->
overflow(), traits_type::eof()) ? -1 : 0;
375 :
std::istream(NULL), sb()
380 std::ios_base::openmode
mode)
381 :
std::istream(NULL), sb()
389 std::ios_base::openmode
mode)
390 :
std::istream(NULL), sb()
399 std::ios_base::openmode
mode)
402 this->setstate(std::ios_base::failbit);
410 std::ios_base::openmode
mode)
413 this->setstate(std::ios_base::failbit);
423 this->setstate(std::ios_base::failbit);
430 :
std::ostream(NULL), sb()
435 std::ios_base::openmode
mode)
436 :
std::ostream(NULL), sb()
444 std::ios_base::openmode
mode)
445 :
std::ostream(NULL), sb()
454 std::ios_base::openmode
mode)
457 this->setstate(std::ios_base::failbit);
465 std::ios_base::openmode
mode)
468 this->setstate(std::ios_base::failbit);
478 this->setstate(std::ios_base::failbit);