SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
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>
Public Types | |
typedef OutputStream | RWOutputStream_type |
typedef OutputStream::element_type | element_type |
Public Member Functions | |
RWTStreambufToByteCharOutputStream (const OutputStream &sinkStream) | |
virtual | ~RWTStreambufToByteCharOutputStream () |
Protected Member Functions | |
virtual int_type | overflow (int_type c=traits_type::eof()) |
virtual int_type | underflow () |
virtual int_type | pbackfail (int_type c=traits_type::eof()) |
virtual int | sync () |
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 std::streamsize | xsgetn (char_type *, std::streamsize) |
virtual std::streamsize | xsputn (const char_type *s, std::streamsize n) |
OutputStream & | getSinkStream () |
const OutputStream & | getSinkStream () const |
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.
typedef OutputStream::element_type RWTStreambufToByteCharOutputStream< OutputStream >::element_type |
A typedef for the type of element to be written to RWOutputStream_type.
typedef OutputStream RWTStreambufToByteCharOutputStream< OutputStream >::RWOutputStream_type |
A typedef for the template parameter OutputStream
which will be used as the sink for elements.
RWTStreambufToByteCharOutputStream< OutputStream >::RWTStreambufToByteCharOutputStream | ( | const OutputStream & | sinkStream | ) |
Initializes the reference to the output stream that will be used as the sink of elements.
sinkStream | The output stream that will serve as the sink of elements. |
virtual RWTStreambufToByteCharOutputStream< OutputStream >::~RWTStreambufToByteCharOutputStream | ( | ) | [virtual] |
Destructor.
const OutputStream& RWTStreambufToByteCharOutputStream< OutputStream >::getSinkStream | ( | ) | const [inline, protected] |
Returns a handle to the embedded Output Stream that is used as the sink of elements. Throws no exceptions.
OutputStream& RWTStreambufToByteCharOutputStream< OutputStream >::getSinkStream | ( | ) | [inline, protected] |
Returns a handle to the embedded Output Stream that is used as the sink of elements. Throws no exceptions.
virtual int_type RWTStreambufToByteCharOutputStream< OutputStream >::overflow | ( | int_type | c = traits_type::eof() |
) | [protected, virtual] |
(Use if a standard C++ library implementation and the Standard iostreams are defined.)
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.
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. |
virtual int_type RWTStreambufToByteCharOutputStream< OutputStream >::pbackfail | ( | int_type | c = traits_type::eof() |
) | [protected, virtual] |
(Use if a standard C++ library implementation and the Standard iostreams are defined.)
This function always returns EOF
to indicate failure. Throws no exceptions.
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 | |||
) | [protected, virtual] |
(Use if a standard C++ library implementation and the Standard iostreams are defined.)
This function always returns EOF
to indicate failure. Throws no exceptions.
virtual pos_type RWTStreambufToByteCharOutputStream< OutputStream >::seekpos | ( | pos_type | sp, | |
std::ios_base::openmode | which = std::ios_base::in|std::ios_base::out | |||
) | [protected, virtual] |
(Use if a standard C++ library implementation and the Standard iostreams are defined.)
This function always returns EOF
to indicate failure. Throws no exceptions.
virtual int RWTStreambufToByteCharOutputStream< OutputStream >::sync | ( | ) | [protected, virtual] |
This function synchronizes the controlled output sequence with the array. That is, if pbase() is non-null the characters between pbase() and 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.
virtual int_type RWTStreambufToByteCharOutputStream< OutputStream >::underflow | ( | ) | [protected, virtual] |
(Use if a standard C++ library implementation and the Standard iostreams are defined.)
This function always returns EOF
to indicate failure. Throws no exceptions.
virtual std::streamsize RWTStreambufToByteCharOutputStream< OutputStream >::xsgetn | ( | char_type * | , | |
std::streamsize | ||||
) | [protected, virtual] |
(Use if a standard C++ library implementation and the Standard iostreams are defined.)
This function always returns EOF
to indicate failure. Throws no exceptions.
virtual std::streamsize RWTStreambufToByteCharOutputStream< OutputStream >::xsputn | ( | const char_type * | s, | |
std::streamsize | n | |||
) | [protected, virtual] |
(Use if a standard C++ library implementation and the Standard iostreams are defined.)
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.
s | A pointer to the first element of the character (byte) array. | |
n | The number of elements to be written. |
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.