23 #if ! defined (octave_c_file_ptr_stream_h) 24 #define octave_c_file_ptr_stream_h 1 26 #include "octave-config.h" 45 :
std::streambuf (),
f (f_arg), cf (cf_arg)
56 int_type overflow (int_type);
62 int_type pbackfail (int_type);
64 std::streamsize xsputn (
const char*, std::streamsize);
66 std::streamsize xsgetn (
char *, std::streamsize);
68 std::streampos seekoff (std::streamoff, std::ios::seekdir,
69 std::ios::openmode = std::ios::in | std::ios::out);
71 std::streampos seekpos (std::streampos,
72 std::ios::openmode = std::ios::in | std::ios::out);
82 int seek (off_t offset,
int origin);
86 void clear (
void) {
if (
f) clearerr (
f); }
88 static int file_close (FILE *
f);
103 template <
typename STREAM_T,
typename FILE_T,
typename BUF_T>
110 :
STREAM_T (nullptr), buf (new BUF_T (
f, cf)) { STREAM_T::init (buf); }
120 BUF_T *
rdbuf (
void) {
return buf; }
124 int seek (off_t offset,
int origin)
125 {
return buf ? buf->seek (offset, origin) : -1; }
127 off_t
tell (
void) {
return buf ? buf->tell () : -1; }
129 void clear (
void) {
if (buf) buf->clear (); STREAM_T::clear (); }
143 #if defined (HAVE_ZLIB) 145 #if defined (HAVE_ZLIB_H) 161 :
std::streambuf (),
f (f_arg), cf (cf_arg)
172 int_type overflow (int_type);
178 int_type pbackfail (int_type);
180 std::streamsize xsputn (
const char*, std::streamsize);
182 std::streamsize xsgetn (
char *, std::streamsize);
184 std::streampos seekoff (std::streamoff, std::ios::seekdir,
185 std::ios::openmode = std::ios::in | std::ios::out);
187 std::streampos seekpos (std::streampos,
188 std::ios::openmode = std::ios::in | std::ios::out);
194 int buf_close (
void);
198 int seek (off_t offset,
int origin)
199 {
return f ? gzseek (
f, offset, origin) >= 0 : -1; }
201 off_t
tell (
void) {
return f ? gztell (
f) : -1; }
static int file_close(gzFile f)
c_file_ptr_stream< std::ostream, gzFile, c_zfile_ptr_buf > o_c_zfile_ptr_stream
c_file_ptr_stream< std::iostream, gzFile, c_zfile_ptr_buf > io_c_zfile_ptr_stream
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
c_file_ptr_stream< std::istream, gzFile, c_zfile_ptr_buf > i_c_zfile_ptr_stream
c_file_ptr_stream< std::istream, FILE *, c_file_ptr_buf > i_c_file_ptr_stream
std::streambuf::int_type int_type
int seek(off_t offset, int origin)
c_file_ptr_stream(FILE_T f, typename BUF_T::close_fcn cf=BUF_T::file_close)
c_file_ptr_stream< std::iostream, FILE *, c_file_ptr_buf > io_c_file_ptr_stream
static void close_fcn(FILE *f)
c_zfile_ptr_buf(gzFile f_arg, close_fcn cf_arg=file_close)
c_file_ptr_buf(FILE *f_arg, close_fcn cf_arg=file_close)
c_file_ptr_stream< std::ostream, FILE *, c_file_ptr_buf > o_c_file_ptr_stream
std::streambuf::int_type int_type
int seek(off_t offset, int origin)