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

#include <base/simplestreambuf.h>

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

Public Member Functions

 SimpleStreamBuf (size_t bufsize_r=512)
 
virtual ~SimpleStreamBuf ()
 
SimpleStreamBufopen (const char *name_r, std::ios_base::openmode mode_r=std::ios_base::in)
 
SimpleStreamBufclose ()
 

Protected Member Functions

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

Private Types

typedef std::vector< char > buffer_type
 

Private Attributes

buffer_type _buffer
 

Additional Inherited Members

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
};
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 >
typedef std::vector<char> zypp::detail::SimpleStreamBuf< Impl >::buffer_type
private

Definition at line 212 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 >
virtual zypp::detail::SimpleStreamBuf< Impl >::~SimpleStreamBuf ( )
inlinevirtual

Definition at line 60 of file simplestreambuf.h.

Member Function Documentation

◆ open()

template<typename Impl >
SimpleStreamBuf * zypp::detail::SimpleStreamBuf< Impl >::open ( const char *  name_r,
std::ios_base::openmode  mode_r = std::ios_base::in 
)
inline

Definition at line 62 of file simplestreambuf.h.

◆ close()

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

Definition at line 78 of file simplestreambuf.h.

◆ sync()

template<typename Impl >
virtual int zypp::detail::SimpleStreamBuf< Impl >::sync ( )
inlineprotectedvirtual

Definition at line 94 of file simplestreambuf.h.

◆ overflow()

template<typename Impl >
virtual int_type zypp::detail::SimpleStreamBuf< Impl >::overflow ( int_type  c = traits_type::eof())
inlineprotectedvirtual

Definition at line 104 of file simplestreambuf.h.

◆ underflow()

template<typename Impl >
virtual int_type zypp::detail::SimpleStreamBuf< Impl >::underflow ( )
inlineprotectedvirtual

Definition at line 125 of file simplestreambuf.h.

◆ seekpos()

template<typename Impl >
virtual pos_type zypp::detail::SimpleStreamBuf< Impl >::seekpos ( pos_type  pos_r,
std::ios_base::openmode  openMode 
)
inlineprotectedvirtual

Definition at line 148 of file simplestreambuf.h.

◆ seekoff()

template<typename Impl >
virtual pos_type zypp::detail::SimpleStreamBuf< Impl >::seekoff ( off_type  off_r,
std::ios_base::seekdir  way_r,
std::ios_base::openmode  openMode 
)
inlineprotectedvirtual

Definition at line 153 of file simplestreambuf.h.

Member Data Documentation

◆ _buffer

template<typename Impl >
buffer_type zypp::detail::SimpleStreamBuf< Impl >::_buffer
private

Definition at line 213 of file simplestreambuf.h.


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