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;
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;
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);