21 #ifndef ZYPP_BASE_GZSTREAM_H
22 #define ZYPP_BASE_GZSTREAM_H
34 namespace gzstream_detail
93 ,
_mode( std::ios_base::openmode(0) )
94 ,
_buffer( (bufferSize_r?bufferSize_r:1), 0 )
107 {
return(
_mode == std::ios_base::in ); }
111 {
return(
_mode == std::ios_base::out ); }
114 open(
const char * name_r, std::ios_base::openmode mode_r = std::ios_base::in );
136 overflow( int_type c = traits_type::eof() );
142 seekoff( off_type off_r, std::ios_base::seekdir way_r, std::ios_base::openmode )
143 {
return seekTo( off_r, way_r ); }
146 seekpos( pos_type pos_r, std::ios_base::openmode )
147 {
return seekTo( off_type(pos_r), std::ios_base::beg ); }
171 zReadTo(
char * buffer_r, std::streamsize maxcount_r );
174 zWriteFrom(
const char * buffer_r, std::streamsize count_r );
177 zSeekTo( off_type off_r, std::ios_base::seekdir way_r );
183 seekTo( off_type off_r, std::ios_base::seekdir way_r );
198 template<
class _BStream,
class _StreamBuf>
228 this->setstate(std::ios_base::failbit);
237 this->setstate(std::ios_base::failbit);
257 std::ios_base::openmode
259 {
return std::ios_base::in; }
261 std::ios_base::openmode
263 {
return std::ios_base::out; }
286 #endif // ZYPP_BASE_GZSTREAM_H
fXstream(const char *file_r)
pos_type zSeekTo(off_type off_r, std::ios_base::seekdir way_r)
std::vector< char > buffer_type
ZlibError zError() const
The last error returned retuned fron zlib.
streambuf_type _streambuf
gzstream_detail::fXstream< std::istream, gzstream_detail::fgzstreambuf > ifgzstream
istream reading gzip files as well as plain files.
fgzstreambuf(unsigned bufferSize_r=512)
virtual pos_type seekpos(pos_type pos_r, std::ios_base::openmode)
bool zWriteFrom(const char *buffer_r, std::streamsize count_r)
int _errno
errno, valid if zError is Z_ERRNO
const streambuf_type & getbuf() const
Similar to ios::rdbuf.
int _fd
file descriptor of the compressed file
pos_type seekTo(off_type off_r, std::ios_base::seekdir way_r)
ZlibError zError() const
The last error returned fron zlib.
std::ios_base::openmode defMode(const std::ostream &str_r)
Common template to define ifgzstream/ofgzstream reading/writing gzip files.
void open(const char *file_r)
std::ios_base::openmode _mode
gzstream_detail::ZlibError ZlibError
std::ostream & operator<<(std::ostream &str, const ZlibError &obj)
virtual int_type overflow(int_type c=traits_type::eof())
_StreamBuf streambuf_type
std::streamsize zReadTo(char *buffer_r, std::streamsize maxcount_r)
gzstream_detail::fXstream< std::ostream, gzstream_detail::fgzstreambuf > ofgzstream
ostream writing gzip files.
virtual int_type underflow()
int _zError
The zlib error code.
virtual pos_type seekoff(off_type off_r, std::ios_base::seekdir way_r, std::ios_base::openmode)
std::string strerror() const
Return string describing the zlib error code.
Helper class to ship zlib errors.
pos_type compressed_tell() const
Tell the file position in the compressed file.
Streambuffer reading or writing gzip files.
fgzstreambuf * open(const char *name_r, std::ios_base::openmode mode_r=std::ios_base::in)
std::ios_base::openmode defMode(const std::istream &str_r)