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 std::streambuf.
|
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) |
|
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.
◆ element_type
template<class OutputStream >
◆ RWOutputStream_type
template<class OutputStream >
A typedef for the template parameter OutputStream
which will be used as the sink for elements.
◆ RWTStreambufToByteCharOutputStream()
template<class OutputStream >
Initializes the reference to the output stream that will be used as the sink of elements.
- Parameters
-
sinkStream | The output stream that will serve as the sink of elements. |
◆ getSinkStream() [1/2]
template<class OutputStream >
Returns a handle to the embedded Output Stream that is used as the sink of elements. Throws no exceptions.
◆ getSinkStream() [2/2]
template<class OutputStream >
Returns a handle to the embedded Output Stream that is used as the sink of elements. Throws no exceptions.
◆ overflow()
template<class OutputStream >
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
-
c | EOF 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. |
◆ pbackfail()
template<class OutputStream >
This function always returns EOF
to indicate failure. Throws no exceptions.
◆ seekoff()
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.
◆ seekpos()
template<class OutputStream >
This function always returns EOF
to indicate failure. Throws no exceptions.
◆ sync()
template<class OutputStream >
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.
◆ underflow()
template<class OutputStream >
This function always returns EOF
to indicate failure. Throws no exceptions.
◆ xsgetn()
template<class OutputStream >
This function always returns EOF
to indicate failure. Throws no exceptions.
◆ xsputn()
template<class OutputStream >
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
-
s | A pointer to the first element of the character (byte) array. |
n | The number of elements to be written. |