32#ifndef RCSC_GZ_GZFSTREAM_H
33#define RCSC_GZ_GZFSTREAM_H
51 :
public std::streambuf {
63 DEFAULT_COMPRESSION = -1,
93 std::unique_ptr< Impl > M_impl;
96 std::size_t M_buf_size;
103 char_type M_remained_char;
150 std::ios_base::openmode mode,
151 int level = DEFAULT_COMPRESSION,
152 int strategy = DEFAULT_STRATEGY );
181 std::
string makeModeString( std::ios_base::openmode mode,
191 void destroyInternalBuffer() throw();
215 std::ios_base::seekdir way,
216 std::ios_base::openmode mode );
227 std::ios_base::openmode mode );
251 std::streambuf::int_type
overflow( std::streambuf::int_type c );
303 : public std::istream {
326 return const_cast< gzfilebuf *
>( &M_file_buf );
350 void open(
const char * path );
370 :
public std::ostream {
393 int level = gzfilebuf::DEFAULT_COMPRESSION,
394 int strategy = gzfilebuf::DEFAULT_STRATEGY );
402 return const_cast< gzfilebuf *
>( &M_file_buf );
429 int level = gzfilebuf::DEFAULT_COMPRESSION,
430 int strategy = gzfilebuf::DEFAULT_STRATEGY );
gzip file stream buffer class.
Definition: gzfstream.h:51
Strategy
typical compression strategy enumeration.
Definition: gzfstream.h:80
bool is_open()
check if file is open.
virtual std::streampos seekpos(std::streampos pos, std::ios_base::openmode mode)
overrided method. seek stream.
virtual std::streambuf::int_type underflow()
get current character
virtual std::streamsize showmanyc()
overrided method. get number of characters availbale in input sequence
virtual int sync()
synchronize stream buffer
virtual std::streambuf::int_type overflow(std::streambuf::int_type c)
put character at current put position.
gzfilebuf()
default constructor.
CompressionLevel
typical compression level enumeration
Definition: gzfstream.h:62
virtual ~gzfilebuf()
destructor.
virtual std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode mode)
overrided method. set relative position of internal position pointer
gzfilebuf * close()
closes the file if opened.
gzfilebuf * open(const char *path, std::ios_base::openmode mode, int level=DEFAULT_COMPRESSION, int strategy=DEFAULT_STRATEGY)
open the file.
gzipped file input stream class.
Definition: gzfstream.h:303
gzifstream()
default constructor
void open(const char *path)
open gzipped file.
gzifstream(const char *path)
init stream buffer and open file.
void close()
close gzipped file.
gzfilebuf * rdbuf() const
get underlying stream buffer.
Definition: gzfstream.h:324
bool is_open()
check if file is open.
Definition: gzfstream.h:334
gzipped file output stream class.
Definition: gzfstream.h:370
gzofstream()
default constructor
gzofstream(const char *path, int level=gzfilebuf::DEFAULT_COMPRESSION, int strategy=gzfilebuf::DEFAULT_STRATEGY)
construct streambuf with file name.
void close()
close gzipped file.
void open(const char *path, int level=gzfilebuf::DEFAULT_COMPRESSION, int strategy=gzfilebuf::DEFAULT_STRATEGY)
open gzipped file.
gzfilebuf * rdbuf() const
get const_cast<> pointer to the underlying stream buffer.
Definition: gzfstream.h:400
bool is_open()
check if file is open
Definition: gzfstream.h:410