36 #if ! defined (octave_zfsstream_h)
37 #define octave_zfsstream_h 1
39 #include "octave-config.h"
41 #if defined (HAVE_ZLIB)
83 int comp_strategy = Z_DEFAULT_STRATEGY);
99 open (
const char *name,
100 std::ios_base::openmode mode);
110 std::ios_base::openmode mode);
135 virtual std::streamsize
158 overflow (int_type c = traits_type::eof ());
168 virtual std::streambuf *
187 seekoff (off_type off, std::ios_base::seekdir way,
188 std::ios_base::openmode mode =
189 std::ios_base::in | std::ios_base::out);
197 seekpos (pos_type sp, std::ios_base::openmode mode =
198 std::ios_base::in | std::ios_base::out);
201 pbackfail (int_type c = traits_type::eof ());
294 std::ios_base::openmode mode = std::ios_base::in);
303 std::ios_base::openmode mode = std::ios_base::in);
332 open (
const char *name,
333 std::ios_base::openmode mode = std::ios_base::in);
345 std::ios_base::openmode mode = std::ios_base::in);
381 std::ios_base::openmode mode = std::ios_base::out);
390 std::ios_base::openmode mode = std::ios_base::out);
419 open (
const char *name,
420 std::ios_base::openmode mode = std::ios_base::out);
432 std::ios_base::openmode mode = std::ios_base::out);
455 template <
typename T1,
typename T2>
460 template <
typename Ta,
typename Tb>
488 template <
typename T1,
typename T2>
493 : fcn(
f), val1(v1), val2(
v2)
497 template <
typename T1,
typename T2>
500 {
return (*
m.fcn)(s,
m.val1,
m.val2); }
Gzipped file stream buffer class.
gzfilebuf(const gzfilebuf &)=delete
gzfilebuf * close()
Close gzipped file.
bool m_own_fd
True if this object owns file descriptor.
bool is_open() const
Check if file is open.
virtual int_type underflow()
Fill get area from gzipped file.
virtual int_type overflow(int_type c=traits_type::eof())
Write put area to gzipped file.
char_type * m_buffer
Stream buffer.
gzfilebuf & operator=(const gzfilebuf &)=delete
virtual pos_type seekoff(off_type off, std::ios_base::seekdir way, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out)
Alters the stream positions.
std::ios_base::openmode m_io_mode
Mode in which file was opened.
virtual int_type pbackfail(int_type c=traits_type::eof())
virtual std::streambuf * setbuf(char_type *p, std::streamsize n)
Installs external stream buffer.
bool m_own_buffer
True if this object owns stream buffer.
void disable_buffer()
Destroy internal buffer.
gzfilebuf * open(const char *name, std::ios_base::openmode mode)
Open gzipped file.
virtual pos_type seekpos(pos_type sp, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out)
Alters the stream positions.
bool open_mode(std::ios_base::openmode mode, char *c_mode) const
Convert ios open mode int to mode string used by zlib.
int setcompression(int comp_level, int comp_strategy=Z_DEFAULT_STRATEGY)
Set compression level and strategy on the fly.
void enable_buffer()
Allocate internal buffer.
virtual int sync()
Flush stream buffer to file.
gzfilebuf * attach(int fd, std::ios_base::openmode mode)
Attach to already open gzipped file.
gzFile m_file
Underlying file pointer.
virtual std::streamsize showmanyc()
Number of characters available in stream buffer.
std::streamsize m_buffer_size
Stream buffer size.
Gzipped file input stream class.
void close()
Close gzipped file.
gzfilebuf * rdbuf() const
Obtain underlying stream buffer.
void attach(int fd, std::ios_base::openmode mode=std::ios_base::in)
Attach to already open gzipped file.
gzfilebuf m_sb
Underlying stream buffer.
void open(const char *name, std::ios_base::openmode mode=std::ios_base::in)
Open gzipped file.
bool is_open()
Check if file is open.
Gzipped file output stream class.
gzfilebuf * rdbuf() const
Obtain underlying stream buffer.
void close()
Close gzipped file.
gzfilebuf m_sb
Underlying stream buffer.
void attach(int fd, std::ios_base::openmode mode=std::ios_base::out)
Attach to already open gzipped file.
bool is_open()
Check if file is open.
void open(const char *name, std::ios_base::openmode mode=std::ios_base::out)
Open gzipped file.
Gzipped file output stream manipulator class.
friend gzofstream & operator<<(gzofstream &, const gzomanip2< Ta, Tb > &)
gzomanip2(gzofstream &(*f)(gzofstream &, T1, T2), T1 v1, T2 v2)
gzofstream & operator<<(gzofstream &s, const gzomanip2< T1, T2 > &m)
gzofstream & setcompression(gzofstream &gzs, int l, int s=Z_DEFAULT_STRATEGY)
F77_RET_T const F77_DBLE const F77_DBLE * f
const octave_char_matrix & v2