join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::Zstreambuf Class Reference

zlib stream buffer. More...

#include <zstream.hpp>

Inheritance diagram for join::Zstreambuf:
Collaboration diagram for join::Zstreambuf:

Public Member Functions

 Zstreambuf (std::streambuf *streambuf, int format, bool own=false)
 create the zlib stream buffer instance.
 
 Zstreambuf (const Zstreambuf &other)=delete
 copy constructor.
 
Zstreambufoperator= (const Zstreambuf &other)=delete
 copy assignment operator.
 
 Zstreambuf (Zstreambuf &&other)
 move constructor.
 
Zstreambufoperator= (Zstreambuf &&other)
 move assignment operator.
 
virtual ~Zstreambuf ()
 destroy the zlib stream buffer instance.
 
- Public Member Functions inherited from join::StreambufDecorator
 StreambufDecorator (std::streambuf *streambuf, bool own=false)
 create the stream buffer decorator instance.
 
 StreambufDecorator (const StreambufDecorator &other)=delete
 copy constructor.
 
StreambufDecoratoroperator= (const StreambufDecorator &other)=delete
 copy assignment operator.
 
 StreambufDecorator (StreambufDecorator &&other)
 move constructor.
 
StreambufDecoratoroperator= (StreambufDecorator &&other)
 move assignment operator.
 
virtual ~StreambufDecorator ()
 destroy the stream buffer decorator instance.
 

Protected Member Functions

virtual int_type underflow () override
 reads characters from the associated input sequence to the get area.
 
virtual int_type overflow (int_type c=traits_type::eof()) override
 writes characters to the associated output sequence from the put area.
 
virtual int_type sync () override
 synchronizes the buffers with the associated character sequence.
 

Protected Attributes

std::unique_ptr< z_stream > _inflate
 inflate context.
 
int _instate = Z_OK
 inflate state.
 
std::unique_ptr< z_stream > _deflate
 deflate context.
 
std::unique_ptr< char[]> _buf
 internal buffer.
 
- Protected Attributes inherited from join::StreambufDecorator
std::streambuf * _innerbuf
 concrete stream buffer.
 
bool _own = false
 own inner stream buffer.
 

Static Protected Attributes

static const std::streamsize _bufsize = 16384
 internal buffer size.
 

Detailed Description

zlib stream buffer.

Constructor & Destructor Documentation

◆ Zstreambuf() [1/3]

Zstreambuf::Zstreambuf ( std::streambuf * streambuf,
int format,
bool own = false )

create the zlib stream buffer instance.

Parameters
streambufconcrete stream buffer
formatcompressed data format.
ownis the decorator owning inner stream buffer.

◆ Zstreambuf() [2/3]

join::Zstreambuf::Zstreambuf ( const Zstreambuf & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ Zstreambuf() [3/3]

Zstreambuf::Zstreambuf ( Zstreambuf && other)

move constructor.

Parameters
otherother object to move.

◆ ~Zstreambuf()

Zstreambuf::~Zstreambuf ( )
virtual

destroy the zlib stream buffer instance.

Member Function Documentation

◆ operator=() [1/2]

Zstreambuf & join::Zstreambuf::operator= ( const Zstreambuf & other)
delete

copy assignment operator.

Parameters
otherother object to assign.
Returns
current object.

◆ operator=() [2/2]

Zstreambuf & Zstreambuf::operator= ( Zstreambuf && other)

move assignment operator.

Parameters
otherother object to assign.
Returns
current object.

◆ overflow()

Zstreambuf::int_type Zstreambuf::overflow ( int_type c = traits_type::eof ())
overrideprotectedvirtual

writes characters to the associated output sequence from the put area.

Parameters
cthe character to store in the put area.
Returns
EOF on failure, some other value on success.

◆ sync()

Zstreambuf::int_type Zstreambuf::sync ( )
overrideprotectedvirtual

synchronizes the buffers with the associated character sequence.

Returns
EOF on failure, some other value on success.

◆ underflow()

Zstreambuf::int_type Zstreambuf::underflow ( )
overrideprotectedvirtual

reads characters from the associated input sequence to the get area.

Returns
the value of the character pointed to by the get pointer after the call on success, EOF otherwise.

Member Data Documentation

◆ _buf

std::unique_ptr<char []> join::Zstreambuf::_buf
protected

internal buffer.

◆ _bufsize

const std::streamsize join::Zstreambuf::_bufsize = 16384
staticprotected

internal buffer size.

◆ _deflate

std::unique_ptr<z_stream> join::Zstreambuf::_deflate
protected

deflate context.

◆ _inflate

std::unique_ptr<z_stream> join::Zstreambuf::_inflate
protected

inflate context.

◆ _instate

int join::Zstreambuf::_instate = Z_OK
protected

inflate state.


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