BasicOStream< CharT, TraitsT > Class Template Reference

#include <Pt/IOStream.h>

Output stream over a BasicStreamBuffer. More...

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

Public Member Functions

 BasicOStream (BasicStreamBuffer< CharT > *sb=0)
 Constructor.
 ~BasicOStream ()
 Destructor.
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::BasicOStream< CharT, TraitsT >

BasicOStream is the output stream in the Streams model. It is a std::basic_ostream that holds a BasicStreamBuffer pointer. Insertion uses that buffer through rdbuf(). writesome() writes at most BasicStreamBuffer::out_avail() characters with sputn() and writes nothing when the put area is empty. That is a partial write; it does not block waiting for overflow to flush.

buffer() returns the pointer. setBuffer() replaces it and updates rdbuf(). The stream does not own the buffer.