SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Protected Member Functions
RWTStreambufToByteCharOutputStream< OutputStream > Class Template Reference

Adaptor class to adapt the iostreams std::streambuf interface to the Rogue Wave binary and narrow character Output Stream interfaces. More...

#include <rw/stream/RWTStreambufToByteCharOutputStream.h>

Inherits streambuf.

Public Types

typedef OutputStream::element_type element_type
 
typedef OutputStream RWOutputStream_type
 

Public Member Functions

 RWTStreambufToByteCharOutputStream (const OutputStream &sinkStream)
 

Protected Member Functions

OutputStream & getSinkStream ()
 
const OutputStream & getSinkStream () const
 
virtual int_type overflow (int_type c=traits_type::eof())
 
virtual int_type pbackfail (int_type c=traits_type::eof())
 
virtual pos_type seekoff (off_type off, std::ios_base::seekdir way, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
 
virtual pos_type seekpos (pos_type sp, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
 
virtual int sync ()
 
virtual int_type underflow ()
 
virtual std::streamsize xsgetn (char_type *, std::streamsize)
 
virtual std::streamsize xsputn (const char_type *s, std::streamsize n)
 

Detailed Description

template<class OutputStream>
class RWTStreambufToByteCharOutputStream< OutputStream >

The class RWTStreambufToByteCharOutputStream is an adaptor class that adapts the iostreams std::streambuf interface to the Rogue Wave binary and narrow character Output Stream interfaces. Requests made through the iostreams std::streambuf interface are forwarded to the embedded output stream handle. Calls to the iostreams std::streambuf functions dealing with the std::streambuf's input sequence will always fail since the underlying output stream only supports output operations. The type of the underlying output stream is provided by the template parameter OutputStream, and can be RWByteOutputStream or RWCharOutputStream.

Member Typedef Documentation

template<class OutputStream >
typedef OutputStream::element_type RWTStreambufToByteCharOutputStream< OutputStream >::element_type

A typedef for the type of element to be written to RWOutputStream_type.

template<class OutputStream >
typedef OutputStream RWTStreambufToByteCharOutputStream< OutputStream >::RWOutputStream_type

A typedef for the template parameter OutputStream which will be used as the sink for elements.

Constructor & Destructor Documentation

template<class OutputStream >
RWTStreambufToByteCharOutputStream< OutputStream >::RWTStreambufToByteCharOutputStream ( const OutputStream &  sinkStream)

Initializes the reference to the output stream that will be used as the sink of elements.

Parameters
sinkStreamThe output stream that will serve as the sink of elements.

Member Function Documentation

template<class OutputStream >
OutputStream& RWTStreambufToByteCharOutputStream< OutputStream >::getSinkStream ( )
inlineprotected

Returns a handle to the embedded Output Stream that is used as the sink of elements. Throws no exceptions.

template<class OutputStream >
const OutputStream& RWTStreambufToByteCharOutputStream< OutputStream >::getSinkStream ( ) const
inlineprotected

Returns a handle to the embedded Output Stream that is used as the sink of elements. Throws no exceptions.

template<class OutputStream >
virtual int_type RWTStreambufToByteCharOutputStream< OutputStream >::overflow ( int_type  c = traits_type::eof())
protectedvirtual

Consumes the bytes in the put area, by inserting them in the embedded output stream. If c is not EOF, it is either consumed or placed in the newly established put area. This function is normally called when the put area is full, but may be called at other times to force the consumption of the bytes in the put area. If an error occurs, overflow() returns EOF, otherwise it returns a value other than EOF. Throws no exceptions.

Parameters
cEOF to force consumption of the bytes in the put area, or any other 8 bits value that need to be inserted in the put area.
template<class OutputStream >
virtual int_type RWTStreambufToByteCharOutputStream< OutputStream >::pbackfail ( int_type  c = traits_type::eof())
protectedvirtual

This function always returns EOF to indicate failure. Throws no exceptions.

template<class OutputStream >
virtual pos_type RWTStreambufToByteCharOutputStream< OutputStream >::seekoff ( off_type  off,
std::ios_base::seekdir  way,
std::ios_base::openmode  which = std::ios_base::in|std::ios_base::out 
)
protectedvirtual

This function always returns EOF to indicate failure. Throws no exceptions.

template<class OutputStream >
virtual pos_type RWTStreambufToByteCharOutputStream< OutputStream >::seekpos ( pos_type  sp,
std::ios_base::openmode  which = std::ios_base::in|std::ios_base::out 
)
protectedvirtual

This function always returns EOF to indicate failure. Throws no exceptions.

template<class OutputStream >
virtual int RWTStreambufToByteCharOutputStream< OutputStream >::sync ( )
protectedvirtual

This function synchronizes the controlled output sequence with the array. That is, if std::streambuf::pbase() is non-null the characters between std::streambuf::pbase() and std::streambuf::pptr() are written to the controlled output sequence. The pointers may then be reset as appropriate. The function returns EOF in case of error; otherwise it returns zero. Throws no exceptions.

template<class OutputStream >
virtual int_type RWTStreambufToByteCharOutputStream< OutputStream >::underflow ( )
protectedvirtual

This function always returns EOF to indicate failure. Throws no exceptions.

template<class OutputStream >
virtual std::streamsize RWTStreambufToByteCharOutputStream< OutputStream >::xsgetn ( char_type *  ,
std::streamsize   
)
protectedvirtual

This function always returns EOF to indicate failure. Throws no exceptions.

template<class OutputStream >
virtual std::streamsize RWTStreambufToByteCharOutputStream< OutputStream >::xsputn ( const char_type *  s,
std::streamsize  n 
)
protectedvirtual

This function stores n characters (bytes) pointed to by s after the put pointer, and increments the put pointer by n. If the function rwUnbuffered() returns true, then the characters (bytes) are directly forwarded to the embedded output stream. Throws no exceptions.

Parameters
sA pointer to the first element of the character (byte) array.
nThe number of elements to be written.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.