AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::cutils::CStreambuf Class Reference

#include <iostream.hpp>

Inheritance diagram for anch::cutils::CStreambuf:
Collaboration diagram for anch::cutils::CStreambuf:

Public Member Functions

 CStreambuf (const anch::cutils::cbuffer &cbuffer, anch::cutils::Direction dir)
 CStreambuf () noexcept
 CStreambuf (const CStreambuf &)=delete
virtual ~CStreambuf ()
CStreambuf & operator= (const CStreambuf &)=delete
void setBuffer (const anch::cutils::cbuffer &cbuffer, anch::cutils::Direction dir)

Protected Member Functions

virtual std::streambuf::int_type underflow () override
virtual std::streambuf::int_type overflow (std::streambuf::int_type value) override
virtual int sync () override

Detailed Description

C stream buffer implementation.

Reading and writing areas are distinct. Pending written data are sent before reading new data (as a tied stream): request / response protocols do not need an explicit flush.

Since
0.1
Author
Vincent Lachenal

Constructor & Destructor Documentation

◆ CStreambuf() [1/3]

anch::cutils::CStreambuf::CStreambuf ( const anch::cutils::cbuffer & cbuffer,
anch::cutils::Direction dir )

CStreambuf constructor

Parameters
cbufferthe cbuffer to user
dirstream direction
Exceptions
std::invalid_argumentcbuffer definition according to dir

◆ CStreambuf() [2/3]

anch::cutils::CStreambuf::CStreambuf ( )
noexcept

CStreambuf default constructor: setBuffer has to be called before use

◆ CStreambuf() [3/3]

anch::cutils::CStreambuf::CStreambuf ( const CStreambuf & )
delete

Prohibits CStreambuf copy constructor

Here is the call graph for this function:

◆ ~CStreambuf()

virtual anch::cutils::CStreambuf::~CStreambuf ( )
virtual

CStreambuf destructor.
Send pending written data (errors are ignored).

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

CStreambuf & anch::cutils::CStreambuf::operator= ( const CStreambuf & )
delete

Prohibits CStreambuf copy assignment

Here is the call graph for this function:

◆ overflow()

virtual std::streambuf::int_type anch::cutils::CStreambuf::overflow ( std::streambuf::int_type value)
overrideprotectedvirtual

Send writing area content when it is full

Parameters
valuethe character to add (or eof)
Returns
eof on error, another value otherwise
Here is the call graph for this function:

◆ setBuffer()

void anch::cutils::CStreambuf::setBuffer ( const anch::cutils::cbuffer & cbuffer,
anch::cutils::Direction dir )

Set (or replace) buffer.
Pending written data are sent before.

Parameters
cbufferthe cbuffer to user
dirstream direction
Exceptions
std::invalid_argumentcbuffer definition according to dir
Here is the call graph for this function:

◆ sync()

virtual int anch::cutils::CStreambuf::sync ( )
overrideprotectedvirtual

Send writing area content

Returns
0 on success, -1 on error
Here is the call graph for this function:

◆ underflow()

virtual std::streambuf::int_type anch::cutils::CStreambuf::underflow ( )
overrideprotectedvirtual

Read data from read function when reading area is empty

Returns
the next character or eof
Here is the call graph for this function:

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