libzypp 17.31.23
zckstream.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_CORE_BASE_ZCKSTREAM_H
10#define ZYPP_CORE_BASE_ZCKSTREAM_H
11
12#include <iosfwd>
13#include <streambuf>
14#include <vector>
15#include <zypp-core/base/SimpleStreambuf>
16#include <zypp-core/base/fXstream>
17
18typedef struct zckCtx zckCtx;
19
20namespace 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
Common template to define ifgzstream/ofgzstream reading/writing compressed files.
Definition: fxstream.h:27
Streambuffer reading or writing zchunk files.
Definition: zckstream.h:31
bool canSeek(std::ios_base::seekdir way_r) const
Definition: zckstream.cc:147
std::streamsize readData(char *buffer_r, std::streamsize maxcount_r)
Definition: zckstream.cc:104
error_type error() const
Definition: zckstream.h:48
off_t seekTo(off_t off_r, std::ios_base::seekdir way_r, std::ios_base::openmode omode_r)
Definition: zckstream.cc:152
bool writeData(const char *buffer_r, std::streamsize count_r)
Definition: zckstream.cc:118
bool openImpl(const char *name_r, std::ios_base::openmode mode_r)
Definition: zckstream.cc:31
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
struct zckCtx zckCtx
Definition: zckstream.h:18