libzypp 17.31.23
zypp::gzstream_detail::gzstreambufimpl Class Reference

Streambuffer reading or writing gzip files. More...

#include <base/gzstream.h>

Public Types

using error_type = ZlibError
 

Public Member Functions

 ~gzstreambufimpl ()
 
bool isOpen () const
 
bool canRead () const
 
bool canWrite () const
 
bool canSeek (std::ios_base::seekdir way_r) const
 
error_type error () const
 The last error returned fron zlib.
 
std::streamsize readData (char *buffer_r, std::streamsize maxcount_r)
 
bool writeData (const char *buffer_r, std::streamsize count_r)
 
off_t seekTo (off_t off_r, std::ios_base::seekdir way_r, std::ios_base::openmode omode_r)
 
off_t tell () const
 

Protected Member Functions

bool openImpl (const char *name_r, std::ios_base::openmode mode_r)
 
bool closeImpl ()
 
off_t compressed_tell () const
 Tell the file position in the compressed file.
 

Private Member Functions

void setZError () const
 

Private Attributes

int _fd = -1
 file descriptor of the compressed file
 
gzFile _file = nullptr
 
std::ios_base::openmode _mode = std::ios_base::openmode(0)
 
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 90 of file gzstream.h.

Member Typedef Documentation

◆ error_type

Constructor & Destructor Documentation

◆ ~gzstreambufimpl()

zypp::gzstream_detail::gzstreambufimpl::~gzstreambufimpl ( )
inline

Definition at line 95 of file gzstream.h.

Member Function Documentation

◆ isOpen()

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

Definition at line 99 of file gzstream.h.

◆ canRead()

bool zypp::gzstream_detail::gzstreambufimpl::canRead ( ) const
inline

Definition at line 103 of file gzstream.h.

◆ canWrite()

bool zypp::gzstream_detail::gzstreambufimpl::canWrite ( ) const
inline

Definition at line 107 of file gzstream.h.

◆ canSeek()

bool zypp::gzstream_detail::gzstreambufimpl::canSeek ( std::ios_base::seekdir  way_r) const
inline

Definition at line 111 of file gzstream.h.

◆ openImpl()

bool zypp::gzstream_detail::gzstreambufimpl::openImpl ( const char *  name_r,
std::ios_base::openmode  mode_r 
)
protected

Definition at line 74 of file gzstream.cc.

◆ closeImpl()

bool zypp::gzstream_detail::gzstreambufimpl::closeImpl ( )
protected

Definition at line 110 of file gzstream.cc.

◆ compressed_tell()

off_t zypp::gzstream_detail::gzstreambufimpl::compressed_tell ( ) const
protected

Tell the file position in the compressed file.

Analogous to tell(2), complementary to gztell.

Definition at line 197 of file gzstream.cc.

◆ error()

error_type zypp::gzstream_detail::gzstreambufimpl::error ( ) const
inline

The last error returned fron zlib.

Definition at line 127 of file gzstream.h.

◆ readData()

std::streamsize zypp::gzstream_detail::gzstreambufimpl::readData ( char *  buffer_r,
std::streamsize  maxcount_r 
)

Definition at line 143 of file gzstream.cc.

◆ writeData()

bool zypp::gzstream_detail::gzstreambufimpl::writeData ( const char *  buffer_r,
std::streamsize  count_r 
)

Definition at line 157 of file gzstream.cc.

◆ seekTo()

off_t zypp::gzstream_detail::gzstreambufimpl::seekTo ( off_t  off_r,
std::ios_base::seekdir  way_r,
std::ios_base::openmode  omode_r 
)

Definition at line 174 of file gzstream.cc.

◆ tell()

off_t zypp::gzstream_detail::gzstreambufimpl::tell ( ) const

Definition at line 188 of file gzstream.cc.

◆ setZError()

void zypp::gzstream_detail::gzstreambufimpl::setZError ( ) const
inlineprivate

Definition at line 138 of file gzstream.h.

Member Data Documentation

◆ _fd

int zypp::gzstream_detail::gzstreambufimpl::_fd = -1
private

file descriptor of the compressed file

Definition at line 142 of file gzstream.h.

◆ _file

gzFile zypp::gzstream_detail::gzstreambufimpl::_file = nullptr
private

Definition at line 144 of file gzstream.h.

◆ _mode

std::ios_base::openmode zypp::gzstream_detail::gzstreambufimpl::_mode = std::ios_base::openmode(0)
private

Definition at line 146 of file gzstream.h.

◆ _error

ZlibError zypp::gzstream_detail::gzstreambufimpl::_error
mutableprivate

Definition at line 148 of file gzstream.h.


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