23 #if !defined (octave_c_file_ptr_stream_h)
24 #define octave_c_file_ptr_stream_h 1
35 #if !defined (CXX_ISO_COMPLIANT_LIBRARY)
38 typedef std::streambuf::int_type int_type;
46 :
std::streambuf (),
f (f_arg), cf (cf_arg)
51 int_type overflow (int_type);
53 int_type
underflow (
void) {
return underflow_common (
false); }
55 int_type
uflow (
void) {
return underflow_common (
true); }
57 int_type pbackfail (int_type);
59 std::streamsize xsputn (
const char*, std::streamsize);
61 std::streamsize xsgetn (
char *, std::streamsize);
63 std::streampos seekoff (std::streamoff, std::ios::seekdir,
64 std::ios::openmode = std::ios::in | std::ios::out);
66 std::streampos seekpos (std::streampos,
67 std::ios::openmode = std::ios::in | std::ios::out);
77 int seek (off_t offset,
int origin);
81 void clear (
void) {
if (
f) clearerr (
f); }
83 static int file_close (FILE *
f);
93 int_type underflow_common (
bool);
104 template <
typename STREAM_T,
typename FILE_T,
typename BUF_T>
111 :
STREAM_T (0), buf (new BUF_T (f, cf)) { STREAM_T::init (buf); }
119 int seek (off_t offset,
int origin)
120 {
return buf ? buf->seek (offset, origin) : -1; }
122 off_t
tell (
void) {
return buf ? buf->tell () : -1; }
155 #if !defined (CXX_ISO_COMPLIANT_LIBRARY)
158 typedef std::streambuf::int_type int_type;
166 :
std::streambuf (),
f (f_arg), cf (cf_arg)
171 int_type overflow (int_type);
173 int_type
underflow (
void) {
return underflow_common (
false); }
175 int_type
uflow (
void) {
return underflow_common (
true); }
177 int_type pbackfail (int_type);
179 std::streamsize xsputn (
const char*, std::streamsize);
181 std::streamsize xsgetn (
char *, std::streamsize);
183 std::streampos seekoff (std::streamoff, std::ios::seekdir,
184 std::ios::openmode = std::ios::in | std::ios::out);
186 std::streampos seekpos (std::streampos,
187 std::ios::openmode = std::ios::in | std::ios::out);
193 int buf_close (
void);
197 int seek (off_t offset,
int origin)
198 {
return f ? gzseek (
f, offset, origin) >= 0 : -1; }
200 off_t
tell (
void) {
return f ? gztell (
f) : -1; }
214 int_type underflow_common (
bool);
static void clear(octave_shlib &oct_file)
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
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
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)
F77_RET_T const double const double * 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
int seek(off_t offset, int origin)