System::IO::BasicSystemIOStreamBuf< Elem, Traits > Class Template Reference

Represents a buffer that wraps System::IO::Stream-like streams and allows them to be used as an std::iostream-like streams internal buffer. More...

Inherits basic_streambuf< Elem, Traits >.

Public Types

using char_type = Elem
 
using traits_type = Traits
 
using Mysb = std::basic_streambuf< char_type, traits_type >
 
using int_type = typename traits_type::int_type
 
using pos_type = typename traits_type::pos_type
 
using off_type = typename traits_type::off_type
 

Public Member Functions

virtual ~BasicSystemIOStreamBuf () override
 Destructor. More...
 
 BasicSystemIOStreamBuf ()
 Constructs a new instance of the BasicSystemIOStreamBuf. More...
 
 BasicSystemIOStreamBuf (const SharedPtr< Stream > &str, SystemIOStreamWrappingMode mode=SystemIOStreamWrappingMode::Binary, const std::locale &locale=std::locale())
 Constructs a new instance of the BasicSystemIOStreamBuf. More...
 
 BasicSystemIOStreamBuf (const BasicSystemIOStreamBuf &)=delete
 Copy constructor. Deleted. More...
 
 BasicSystemIOStreamBuf (BasicSystemIOStreamBuf &&right) noexcept
 Move constructor. More...
 
BasicSystemIOStreamBufoperator= (const BasicSystemIOStreamBuf &)=delete
 Copy assignment operator. Deleted. More...
 
BasicSystemIOStreamBufoperator= (BasicSystemIOStreamBuf &&right) noexcept
 Move assignment operator. More...
 
void AssignRV (BasicSystemIOStreamBuf &&right)
 Used in move constructor and move assignment operator to reset pointers and call swap(). More...
 
void swap (BasicSystemIOStreamBuf &right)
 Call to swap *this and right, if they are not equal. More...
 

Protected Member Functions

virtual int_type overflow (int_type meta=traits_type::eof()) override
 Put a character to the stream and advances one position forward. More...
 
virtual int_type underflow () override
 Get an element from stream, but don't advances position. More...
 
virtual int_type uflow () override
 Get an element from stream and advances one position forward. More...
 
virtual int_type pbackfail (int_type meta=traits_type::eof()) override
 Put an element to stream on previous position. More...
 
virtual pos_type seekoff (off_type off, std::ios_base::seekdir way, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out) override
 Change position by off, according to way, mode. More...
 
virtual pos_type seekpos (pos_type pos, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out) override
 Set position pointer to absolute pos position. More...
 
virtual std::streamsize showmanyc () override
 Get number of characters available. More...
 
void Tidy ()
 Set all pointers to nullptr. More...
 

Detailed Description

template<typename Elem, typename Traits = std::char_traits<Elem>>
class System::IO::BasicSystemIOStreamBuf< Elem, Traits >

Represents a buffer that wraps System::IO::Stream-like streams and allows them to be used as an std::iostream-like streams internal buffer.

Member Typedef Documentation

◆ char_type

template<typename Elem, typename Traits = std::char_traits<Elem>>
using System::IO::BasicSystemIOStreamBuf< Elem, Traits >::char_type = Elem

◆ int_type

template<typename Elem, typename Traits = std::char_traits<Elem>>
using System::IO::BasicSystemIOStreamBuf< Elem, Traits >::int_type = typename traits_type::int_type

◆ Mysb

template<typename Elem, typename Traits = std::char_traits<Elem>>
using System::IO::BasicSystemIOStreamBuf< Elem, Traits >::Mysb = std::basic_streambuf<char_type, traits_type>

◆ off_type

template<typename Elem, typename Traits = std::char_traits<Elem>>
using System::IO::BasicSystemIOStreamBuf< Elem, Traits >::off_type = typename traits_type::off_type

◆ pos_type

template<typename Elem, typename Traits = std::char_traits<Elem>>
using System::IO::BasicSystemIOStreamBuf< Elem, Traits >::pos_type = typename traits_type::pos_type

◆ traits_type

template<typename Elem, typename Traits = std::char_traits<Elem>>
using System::IO::BasicSystemIOStreamBuf< Elem, Traits >::traits_type = Traits

Constructor & Destructor Documentation

◆ ~BasicSystemIOStreamBuf()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual System::IO::BasicSystemIOStreamBuf< Elem, Traits >::~BasicSystemIOStreamBuf ( )
inlineoverridevirtual

Destructor.

◆ BasicSystemIOStreamBuf() [1/4]

template<typename Elem, typename Traits = std::char_traits<Elem>>
System::IO::BasicSystemIOStreamBuf< Elem, Traits >::BasicSystemIOStreamBuf ( )
inlineexplicit

Constructs a new instance of the BasicSystemIOStreamBuf.

◆ BasicSystemIOStreamBuf() [2/4]

template<typename Elem, typename Traits = std::char_traits<Elem>>
System::IO::BasicSystemIOStreamBuf< Elem, Traits >::BasicSystemIOStreamBuf ( const SharedPtr< Stream > &  str,
SystemIOStreamWrappingMode  mode = SystemIOStreamWrappingMode::Binary,
const std::locale &  locale = std::locale() 
)
inlineexplicit

Constructs a new instance of the BasicSystemIOStreamBuf.

Parameters
strSmart pointer to the stream
modeWrapping mode
localeStream's locale

◆ BasicSystemIOStreamBuf() [3/4]

template<typename Elem, typename Traits = std::char_traits<Elem>>
System::IO::BasicSystemIOStreamBuf< Elem, Traits >::BasicSystemIOStreamBuf ( const BasicSystemIOStreamBuf< Elem, Traits > &  )
delete

Copy constructor. Deleted.

◆ BasicSystemIOStreamBuf() [4/4]

template<typename Elem, typename Traits = std::char_traits<Elem>>
System::IO::BasicSystemIOStreamBuf< Elem, Traits >::BasicSystemIOStreamBuf ( BasicSystemIOStreamBuf< Elem, Traits > &&  right)
inlinenoexcept

Move constructor.

Parameters
rightObject to be move

Member Function Documentation

◆ AssignRV()

template<typename Elem, typename Traits = std::char_traits<Elem>>
void System::IO::BasicSystemIOStreamBuf< Elem, Traits >::AssignRV ( BasicSystemIOStreamBuf< Elem, Traits > &&  right)
inline

Used in move constructor and move assignment operator to reset pointers and call swap().

Parameters
rightRvalue reference to object to be swap

◆ operator=() [1/2]

template<typename Elem, typename Traits = std::char_traits<Elem>>
BasicSystemIOStreamBuf& System::IO::BasicSystemIOStreamBuf< Elem, Traits >::operator= ( const BasicSystemIOStreamBuf< Elem, Traits > &  )
delete

Copy assignment operator. Deleted.

◆ operator=() [2/2]

template<typename Elem, typename Traits = std::char_traits<Elem>>
BasicSystemIOStreamBuf& System::IO::BasicSystemIOStreamBuf< Elem, Traits >::operator= ( BasicSystemIOStreamBuf< Elem, Traits > &&  right)
inlinenoexcept

Move assignment operator.

Parameters
rightObject to be move
Returns
*this

◆ overflow()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual int_type System::IO::BasicSystemIOStreamBuf< Elem, Traits >::overflow ( int_type  meta = traits_type::eof())
inlineoverrideprotectedvirtual

Put a character to the stream and advances one position forward.

Parameters
metaA character to be put
Returns
If succeeded, returns new position. Otherwice returns -1

◆ pbackfail()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual int_type System::IO::BasicSystemIOStreamBuf< Elem, Traits >::pbackfail ( int_type  meta = traits_type::eof())
inlineoverrideprotectedvirtual

Put an element to stream on previous position.

Parameters
metaA character to be put
Returns
If succeeded, returns new position. Otherwice returns -1

◆ seekoff()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual pos_type System::IO::BasicSystemIOStreamBuf< Elem, Traits >::seekoff ( off_type  off,
std::ios_base::seekdir  way,
std::ios_base::openmode  mode = std::ios_base::in | std::ios_base::out 
)
inlineoverrideprotectedvirtual

Change position by off, according to way, mode.

Parameters
offOffset value, relative to the way parameter
wayObject of type std::ios_base::seekdir, indicating the origin from which the offset is applied
modeGenerally used to determine the position on which of the controlled sequences shall be modified: the input sequence, the output sequence, or both
Returns
If succeeded, returns new position. Otherwice returns -1

◆ seekpos()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual pos_type System::IO::BasicSystemIOStreamBuf< Elem, Traits >::seekpos ( pos_type  pos,
std::ios_base::openmode  mode = std::ios_base::in | std::ios_base::out 
)
inlineoverrideprotectedvirtual

Set position pointer to absolute pos position.

Parameters
posNew absolute position for the position pointer
modeGenerally used to determine the position on which of the controlled sequences shall be modified: the input sequence, the output sequence, or both
Returns
If succeeded, returns new position. Otherwice returns -1

◆ showmanyc()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual std::streamsize System::IO::BasicSystemIOStreamBuf< Elem, Traits >::showmanyc ( )
inlineoverrideprotectedvirtual

Get number of characters available.

◆ swap()

template<typename Elem, typename Traits = std::char_traits<Elem>>
void System::IO::BasicSystemIOStreamBuf< Elem, Traits >::swap ( BasicSystemIOStreamBuf< Elem, Traits > &  right)
inline

Call to swap *this and right, if they are not equal.

Parameters
rightRvalue reference to object to be swap

◆ Tidy()

template<typename Elem, typename Traits = std::char_traits<Elem>>
void System::IO::BasicSystemIOStreamBuf< Elem, Traits >::Tidy ( )
inlineprotected

Set all pointers to nullptr.

◆ uflow()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual int_type System::IO::BasicSystemIOStreamBuf< Elem, Traits >::uflow ( )
inlineoverrideprotectedvirtual

Get an element from stream and advances one position forward.

Returns
If succeeded, returns new position. Otherwice returns -1

◆ underflow()

template<typename Elem, typename Traits = std::char_traits<Elem>>
virtual int_type System::IO::BasicSystemIOStreamBuf< Elem, Traits >::underflow ( )
inlineoverrideprotectedvirtual

Get an element from stream, but don't advances position.

Returns
If succeeded, returns current position. Otherwice returns -1