26 #if ! defined (octave_oct_stdstrm_h)
27 #define octave_oct_stdstrm_h 1
29 #include "octave-config.h"
36 template <
typename BUF_T,
typename STREAM_T,
typename FILE_T>
43 std::ios::openmode
m = std::ios::in | std::ios::out,
46 const std::string& encoding =
"utf-8",
48 :
octave::base_stream (
m, ff, encoding), m_name (
n), m_mode (
m),
49 m_stream (
f ? new
STREAM_T (
f, cf) : nullptr), fnum (fid)
60 int seek (off_t offset,
int origin)
62 return m_stream ? m_stream->seek (offset, origin) : -1;
67 off_t
tell (
void) {
return m_stream ? m_stream->tell () : -1; }
71 bool eof (
void)
const {
return m_stream ? m_stream->eof () :
true; }
75 std::string
name (
void)
const {
return m_name; }
79 return (m_mode & std::ios::in) ? m_stream :
nullptr;
84 return (m_mode & std::ios::out) ? m_stream :
nullptr;
90 return m_stream ? (
const_cast<STREAM_T *
> (m_stream))->rdbuf () :
nullptr;
95 bool bad (
void)
const {
return m_stream ? m_stream->bad () :
true; }
106 m_stream->stream_close ();
130 std::ios::openmode
m = std::ios::in | std::ios::out,
133 const std::string& encoding =
"utf-8",
136 (
n,
f,
f ? fileno (
f) : -1,
m, ff, encoding, cf) { }
140 std::ios::openmode
m = std::ios::in | std::ios::out,
143 const std::string& encoding =
"utf-8",
160 #if defined (HAVE_ZLIB)
169 std::ios::openmode
m = std::ios::in | std::ios::out,
172 const std::string& encoding =
"utf-8",
176 (
n,
f, fid,
m, ff, encoding, cf) { }
179 create (
const std::string&
n, gzFile
f =
nullptr,
int fid = 0,
180 std::ios::openmode
m = std::ios::in | std::ios::out,
183 const std::string& encoding =
"utf-8",
static void close_fcn(FILE *f)
static int file_close(FILE *f)
static int file_close(gzFile f)
octave_stdiostream(const octave_stdiostream &)=delete
~octave_stdiostream(void)=default
static octave::stream create(const std::string &n, FILE *f=nullptr, std::ios::openmode m=std::ios::in|std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8", c_file_ptr_buf::close_fcn cf=c_file_ptr_buf::file_close)
octave_stdiostream(const std::string &n, FILE *f=nullptr, std::ios::openmode m=std::ios::in|std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8", c_file_ptr_buf::close_fcn cf=c_file_ptr_buf::file_close)
octave_tstdiostream(const octave_tstdiostream &)=delete
std::ostream * output_stream(void)
~octave_tstdiostream(void)
octave_tstdiostream(const std::string &n, FILE_T f=0, int fid=0, std::ios::openmode m=std::ios::in|std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8", typename BUF_T::close_fcn cf=BUF_T::file_close)
int file_number(void) const
std::ios::openmode m_mode
std::string name(void) const
BUF_T * rdbuf(void) const
std::istream * input_stream(void)
int seek(off_t offset, int origin)
~octave_zstdiostream(void)=default
octave_zstdiostream(const octave_zstdiostream &)=delete
static octave::stream create(const std::string &n, gzFile f=nullptr, int fid=0, std::ios::openmode m=std::ios::in|std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8", c_zfile_ptr_buf::close_fcn cf=c_zfile_ptr_buf::file_close)
octave_zstdiostream(const std::string &n, gzFile f=nullptr, int fid=0, std::ios::openmode m=std::ios::in|std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8", c_zfile_ptr_buf::close_fcn cf=c_zfile_ptr_buf::file_close)
F77_RET_T const F77_DBLE const F77_DBLE * f
float_format native_float_format(void)