BasicIOStream< CharT, TraitsT > Class Template Reference

#include <Pt/IOStream.h>

Input and output stream over a BasicStreamBuffer. More...

Inherited by BasicTextStream< Char, char >, and BasicTextStream< CharT, ByteT >.

Public Member Functions

 BasicIOStream (BasicStreamBuffer< CharT > *sb=0)
 Constructor.
 ~BasicIOStream ()
 Destructor.
std::streamsize peeksome (CharT *buffer, std::streamsize n)
 Peeks bytes in the stream buffer.
std::streamsize writesome (CharT *buffer, std::streamsize n)
 Write as much data as fits in buffer.
BasicStreamBuffer< CharT > * buffer ()
 Returns the buffer.
void setBuffer (BasicStreamBuffer< CharT > *sb)
 Sets the buffer.

Detailed Description

template<typename CharT, typename TraitsT = std::char_traits<CharT>>
class Pt::BasicIOStream< CharT, TraitsT >

BasicIOStream is the bidirectional stream in the Streams model. It is a std::basic_iostream that holds a BasicStreamBuffer pointer. peeksome() is the input lookahead of BasicIStream. writesome() is the partial write of BasicOStream. Both require that rdbuf() still is this buffer.

buffer() returns the pointer. setBuffer() replaces it and updates rdbuf(). The stream does not own the buffer. Use this type when the same buffer is read and written; use BasicIStream or BasicOStream when the direction is fixed.

Member Function Documentation

◆ peeksome()

template<typename CharT, typename TraitsT>
std::streamsize peeksome ( CharT * buffer,
std::streamsize n )

The number of bytes that can be peeked depends on the current stream buffer get area and maybe less than requested, similar to istream::readsome().