libzypp  17.23.5
ZckStream.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 #ifndef ZYPP_BASE_ZCKSTREAM_H
10 #define ZYPP_BASE_ZCKSTREAM_H
11 
12 #include <iosfwd>
13 #include <streambuf>
14 #include <vector>
16 #include <zypp/base/fXstream.h>
17 
18 typedef struct zckCtx zckCtx;
19 
20 namespace zypp {
21 
22  namespace detail {
23 
32  public:
33 
34  using error_type = std::string;
35 
37 
38  bool isOpen () const;
39  bool canRead () const;
40  bool canWrite () const;
41  bool canSeek ( std::ios_base::seekdir way_r ) const;
42 
43  std::streamsize readData ( char * buffer_r, std::streamsize maxcount_r );
44  bool writeData( const char * buffer_r, std::streamsize count_r );
45  off_t seekTo( off_t off_r, std::ios_base::seekdir way_r, std::ios_base::openmode omode_r );
46  off_t tell() const;
47 
48  error_type error() const { return _lastErr; }
49 
50  protected:
51  bool openImpl( const char * name_r, std::ios_base::openmode mode_r );
52  bool closeImpl ();
53 
54  private:
55  void setError ();
56  int _fd = -1;
57  bool _isReading = false;
58  zckCtx *_zContext = nullptr;
59  off_t _currfp = 0;
61 
62  };
64  }
65 
70 
75 }
76 
77 #endif
zypp::detail::zckstreambufimpl::seekTo
off_t seekTo(off_t off_r, std::ios_base::seekdir way_r, std::ios_base::openmode omode_r)
Definition: ZckStream.cc:152
zypp::detail::zckstreambufimpl
Streambuffer reading or writing zchunk files.
Definition: ZckStream.h:31
zypp::detail::zckstreambufimpl::_currfp
off_t _currfp
Definition: ZckStream.h:59
zypp::detail::zckstreambufimpl::readData
std::streamsize readData(char *buffer_r, std::streamsize maxcount_r)
Definition: ZckStream.cc:104
zypp::detail::zckstreambufimpl::closeImpl
bool closeImpl()
Definition: ZckStream.cc:77
zypp::detail::zckstreambufimpl::canWrite
bool canWrite() const
Definition: ZckStream.cc:142
zypp::detail::zckstreambufimpl::isOpen
bool isOpen() const
Definition: ZckStream.cc:132
zypp::detail::zckstreambufimpl::tell
off_t tell() const
Definition: ZckStream.cc:157
zypp::detail::zckstreambufimpl::_lastErr
error_type _lastErr
Definition: ZckStream.h:60
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::detail::zckstreambufimpl::error_type
std::string error_type
Definition: ZckStream.h:34
zypp::detail::zckstreambufimpl::canRead
bool canRead() const
Definition: ZckStream.cc:137
SimpleStreambuf.h
zypp::detail::zckstreambufimpl::writeData
bool writeData(const char *buffer_r, std::streamsize count_r)
Definition: ZckStream.cc:118
zypp::detail::zckstreambufimpl::setError
void setError()
Definition: ZckStream.cc:96
zckCtx
struct zckCtx zckCtx
Definition: ZckStream.h:18
zypp::detail::zckstreambufimpl::_fd
int _fd
Definition: ZckStream.h:56
zypp::detail::fXstream
Common template to define ifgzstream/ofgzstream reading/writing compressed files.
Definition: fXstream.h:26
zypp::detail::SimpleStreamBuf
Definition: SimpleStreambuf.h:54
fXstream.h
zypp::detail::zckstreambufimpl::~zckstreambufimpl
~zckstreambufimpl()
Definition: ZckStream.cc:26
zypp::detail::zckstreambufimpl::openImpl
bool openImpl(const char *name_r, std::ios_base::openmode mode_r)
Definition: ZckStream.cc:31
zypp::detail::zckstreambufimpl::_isReading
bool _isReading
Definition: ZckStream.h:57
zypp::detail::zckstreambufimpl::_zContext
zckCtx * _zContext
Definition: ZckStream.h:58
zypp::detail::zckstreambufimpl::error
error_type error() const
Definition: ZckStream.h:48
zypp::detail::zckstreambufimpl::canSeek
bool canSeek(std::ios_base::seekdir way_r) const
Definition: ZckStream.cc:147