libzypp  17.3.0
zypp::gzstream_detail::fgzstreambuf Class Reference

Streambuffer reading or writing gzip files. More...

#include <GzStream.h>

Inheritance diagram for zypp::gzstream_detail::fgzstreambuf:

Public Member Functions

 fgzstreambuf (unsigned bufferSize_r=512)
 
virtual ~fgzstreambuf ()
 
bool isOpen () const
 
bool inReadMode () const
 
bool inWriteMode () const
 
fgzstreambufopen (const char *name_r, std::ios_base::openmode mode_r=std::ios_base::in)
 
fgzstreambufclose ()
 
pos_type compressed_tell () const
 Tell the file position in the compressed file. More...
 
ZlibError zError () const
 The last error returned fron zlib. More...
 

Protected Member Functions

virtual int sync ()
 
virtual int_type overflow (int_type c=traits_type::eof())
 
virtual int_type underflow ()
 
virtual pos_type seekoff (off_type off_r, std::ios_base::seekdir way_r, std::ios_base::openmode)
 
virtual pos_type seekpos (pos_type pos_r, std::ios_base::openmode)
 

Private Types

typedef std::vector< char > buffer_type
 

Private Member Functions

void setZError ()
 
std::streamsize zReadTo (char *buffer_r, std::streamsize maxcount_r)
 
bool zWriteFrom (const char *buffer_r, std::streamsize count_r)
 
pos_type zSeekTo (off_type off_r, std::ios_base::seekdir way_r)
 
pos_type zTell ()
 
pos_type seekTo (off_type off_r, std::ios_base::seekdir way_r)
 

Private Attributes

int _fd
 file descriptor of the compressed file More...
 
gzFile _file
 
std::ios_base::openmode _mode
 
buffer_type _buffer
 
ZlibError _error
 

Detailed Description

Streambuffer reading or writing gzip files.

Read and write mode are mutual exclusive. Seek is supported, but zlib restrictions appy (only forward seek in write mode; backward seek in read mode might be expensive).Putback is not supported.

Reading plain (no gziped) files is possible as well.

This streambuf is used in ifgzstream and ofgzstream.

Definition at line 86 of file GzStream.h.

Member Typedef Documentation

◆ buffer_type

typedef std::vector<char> zypp::gzstream_detail::fgzstreambuf::buffer_type
private

Definition at line 151 of file GzStream.h.

Constructor & Destructor Documentation

◆ fgzstreambuf()

zypp::gzstream_detail::fgzstreambuf::fgzstreambuf ( unsigned  bufferSize_r = 512)
inline

Definition at line 90 of file GzStream.h.

◆ ~fgzstreambuf()

virtual zypp::gzstream_detail::fgzstreambuf::~fgzstreambuf ( )
inlinevirtual

Definition at line 98 of file GzStream.h.

Member Function Documentation

◆ isOpen()

bool zypp::gzstream_detail::fgzstreambuf::isOpen ( ) const
inline

Definition at line 102 of file GzStream.h.

◆ inReadMode()

bool zypp::gzstream_detail::fgzstreambuf::inReadMode ( ) const
inline

Definition at line 106 of file GzStream.h.

◆ inWriteMode()

bool zypp::gzstream_detail::fgzstreambuf::inWriteMode ( ) const
inline

Definition at line 110 of file GzStream.h.

◆ open()

fgzstreambuf * zypp::gzstream_detail::fgzstreambuf::open ( const char *  name_r,
std::ios_base::openmode  mode_r = std::ios_base::in 
)

Definition at line 74 of file GzStream.cc.

◆ close()

fgzstreambuf * zypp::gzstream_detail::fgzstreambuf::close ( )

Definition at line 120 of file GzStream.cc.

◆ compressed_tell()

fgzstreambuf::pos_type zypp::gzstream_detail::fgzstreambuf::compressed_tell ( ) const

Tell the file position in the compressed file.

Analogous to tell(2), complementary to gztell.

Definition at line 352 of file GzStream.cc.

◆ zError()

ZlibError zypp::gzstream_detail::fgzstreambuf::zError ( ) const
inline

The last error returned fron zlib.

Definition at line 127 of file GzStream.h.

◆ sync()

int zypp::gzstream_detail::fgzstreambuf::sync ( )
protectedvirtual

Definition at line 156 of file GzStream.cc.

◆ overflow()

fgzstreambuf::int_type zypp::gzstream_detail::fgzstreambuf::overflow ( int_type  c = traits_type::eof())
protectedvirtual

Definition at line 173 of file GzStream.cc.

◆ underflow()

fgzstreambuf::int_type zypp::gzstream_detail::fgzstreambuf::underflow ( )
protectedvirtual

Definition at line 202 of file GzStream.cc.

◆ seekoff()

virtual pos_type zypp::gzstream_detail::fgzstreambuf::seekoff ( off_type  off_r,
std::ios_base::seekdir  way_r,
std::ios_base::openmode   
)
inlineprotectedvirtual

Definition at line 142 of file GzStream.h.

◆ seekpos()

virtual pos_type zypp::gzstream_detail::fgzstreambuf::seekpos ( pos_type  pos_r,
std::ios_base::openmode   
)
inlineprotectedvirtual

Definition at line 146 of file GzStream.h.

◆ setZError()

void zypp::gzstream_detail::fgzstreambuf::setZError ( )
inlineprivate

Definition at line 167 of file GzStream.h.

◆ zReadTo()

std::streamsize zypp::gzstream_detail::fgzstreambuf::zReadTo ( char *  buffer_r,
std::streamsize  maxcount_r 
)
private

Definition at line 232 of file GzStream.cc.

◆ zWriteFrom()

bool zypp::gzstream_detail::fgzstreambuf::zWriteFrom ( const char *  buffer_r,
std::streamsize  count_r 
)
private

Definition at line 246 of file GzStream.cc.

◆ zSeekTo()

fgzstreambuf::pos_type zypp::gzstream_detail::fgzstreambuf::zSeekTo ( off_type  off_r,
std::ios_base::seekdir  way_r 
)
private

Definition at line 263 of file GzStream.cc.

◆ zTell()

fgzstreambuf::pos_type zypp::gzstream_detail::fgzstreambuf::zTell ( )
private

Definition at line 277 of file GzStream.cc.

◆ seekTo()

fgzstreambuf::pos_type zypp::gzstream_detail::fgzstreambuf::seekTo ( off_type  off_r,
std::ios_base::seekdir  way_r 
)
private

Definition at line 291 of file GzStream.cc.

Member Data Documentation

◆ _fd

int zypp::gzstream_detail::fgzstreambuf::_fd
private

file descriptor of the compressed file

Definition at line 154 of file GzStream.h.

◆ _file

gzFile zypp::gzstream_detail::fgzstreambuf::_file
private

Definition at line 156 of file GzStream.h.

◆ _mode

std::ios_base::openmode zypp::gzstream_detail::fgzstreambuf::_mode
private

Definition at line 158 of file GzStream.h.

◆ _buffer

buffer_type zypp::gzstream_detail::fgzstreambuf::_buffer
private

Definition at line 160 of file GzStream.h.

◆ _error

ZlibError zypp::gzstream_detail::fgzstreambuf::_error
private

Definition at line 162 of file GzStream.h.


The documentation for this class was generated from the following files: