libzypp: zypp::detail::SimpleStreamBuf< Impl > Class Template Reference

libzypp 17.38.8

zypp::detail::SimpleStreamBuf< Impl > Class Template Reference

`#include <zypp-core/base/simplestreambuf.h>`

Inheritance diagram for zypp::detail::SimpleStreamBuf< Impl >:

## Public Member Functions
| SimpleStreamBuf (size_t bufsize_r=512)
| ~SimpleStreamBuf () override
template<typename OpenSpecType>
SimpleStreamBuf * | open (OpenSpecType &&name_r, std::ios_base::openmode mode_r=std::ios_base::in)
SimpleStreamBuf * | close ()

## Protected Member Functions
int | sync () override
int_type | overflow (int_type c=traits_type::eof()) override
int_type | underflow () override
pos_type | seekpos (pos_type pos_r, std::ios_base::openmode openMode) override
pos_type | seekoff (off_type off_r, std::ios_base::seekdir way_r, std::ios_base::openmode openMode) override

## Private Types
using | buffer_type = std::vector<char>

## Private Attributes
buffer_type | _buffer

## Detailed Description

template<typename Impl>
class zypp::detail::SimpleStreamBuf< Impl >

Implementation of a std::streambuf that is using a std::vector<char> as buffer, relies on a Impl class that must implement the basic i/o functionality:

class streambufimpl {
public:
using error_type = my_error_type;
~streambufimpl();
bool isOpen () const; // returns true if the file is currently open
bool canRead () const; // returns true if in read mode
bool canWrite () const; // returns true if in write mode
bool canSeek ( std::ios_base::seekdir way_r ) const; // returns true if the backend can seek in the given way
std::streamsize readData ( char * buffer_r, std::streamsize maxcount_r ); // reads data from the file and returns it in buffer_r
bool writeData( const char * buffer_r, std::streamsize count_r ); // writes data ( if in write mode ) to file from buffer
off_t seekTo( off_t off_r, std::ios_base::seekdir way_r, std::ios_base::openmode omode_r ); // seeks in file if supported
off_t tell() const; // returns the current FP
error_type error() const; // returns the last error that happend in backend
protected:
bool openImpl( const char * name_r, std::ios_base::openmode mode_r ); // backend implementation of opening the file
bool closeImpl (); // closes the file
};
using FullStreamBuf = detail::SimpleStreamBuf<streambufimpl>;
zypp::detail::SimpleStreamBuf
Definition simplestreambuf.h:55

Note
  Currently only supports reading or writing at the same time, but can be extended to support both

Definition at line 54 of file simplestreambuf.h.

## Member Typedef Documentation

## ◆ buffer_type

template<typename Impl>

using zypp::detail::SimpleStreamBuf< Impl >::buffer_type = std::vector<char>
| private

Definition at line 213 of file simplestreambuf.h.

## Constructor & Destructor Documentation

## ◆ SimpleStreamBuf()

template<typename Impl>

zypp::detail::SimpleStreamBuf< Impl >::SimpleStreamBuf | ( | size_t | bufsize_r = 512 | ) |
| inline

Definition at line 59 of file simplestreambuf.h.

## ◆ ~SimpleStreamBuf()

template<typename Impl>

zypp::detail::SimpleStreamBuf< Impl >::~SimpleStreamBuf | ( |  | ) |
| inlineoverride

Definition at line 60 of file simplestreambuf.h.

## Member Function Documentation

## ◆ open()

template<typename Impl>
template<typename OpenSpecType>

SimpleStreamBuf * zypp::detail::SimpleStreamBuf< Impl >::open | ( | OpenSpecType && | name_r,
|  | std::ios_base::openmode | mode_r = std::ios_base::in )
| inline

Definition at line 63 of file simplestreambuf.h.

## ◆ close()

template<typename Impl>

SimpleStreamBuf * zypp::detail::SimpleStreamBuf< Impl >::close | ( |  | ) |
| inline

Definition at line 79 of file simplestreambuf.h.

## ◆ sync()

template<typename Impl>

int zypp::detail::SimpleStreamBuf< Impl >::sync | ( |  | ) |
| inlineoverrideprotected

Definition at line 95 of file simplestreambuf.h.

## ◆ overflow()

template<typename Impl>

int_type zypp::detail::SimpleStreamBuf< Impl >::overflow | ( | int_type | c = traits_type::eof() | ) |
| inlineoverrideprotected

Definition at line 105 of file simplestreambuf.h.

## ◆ underflow()

template<typename Impl>

int_type zypp::detail::SimpleStreamBuf< Impl >::underflow | ( |  | ) |
| inlineoverrideprotected

Definition at line 126 of file simplestreambuf.h.

## ◆ seekpos()

template<typename Impl>

pos_type zypp::detail::SimpleStreamBuf< Impl >::seekpos | ( | pos_type | pos_r,
|  | std::ios_base::openmode | openMode )
| inlineoverrideprotected

Definition at line 149 of file simplestreambuf.h.

## ◆ seekoff()

template<typename Impl>

pos_type zypp::detail::SimpleStreamBuf< Impl >::seekoff | ( | off_type | off_r,
|  | std::ios_base::seekdir | way_r,
|  | std::ios_base::openmode | openMode )
| inlineoverrideprotected

Definition at line 154 of file simplestreambuf.h.

## Member Data Documentation

## ◆ _buffer

template<typename Impl>

buffer_type zypp::detail::SimpleStreamBuf< Impl >::_buffer
| private

Definition at line 214 of file simplestreambuf.h.

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

- zypp-core/base/simplestreambuf.h