SourcePro® 2022.1 |
SourcePro® API Reference Guide |
Provides an automated mechanism for connecting an input stream to an output stream. More...
#include <rw/internet/RWStreamCoupler.h>
Public Types | |
typedef bool(* | Filter) (const RWCString &) |
enum | TransferMode { ASCII, BINARY, mode_ascii, mode_binary } |
Public Member Functions | |
RWStreamCoupler (TransferMode mode=mode_ascii) | |
TransferMode | getMode (void) const |
bool | operator() (std::istream &in, std::ostream &out) |
bool | operator() (std::istream &in, RWPortalOStream &out) |
bool | operator() (std::istream &in, std::ostream &out, Filter filter) |
bool | operator() (std::istream &in, RWPortalOStream &out, Filter filter) |
void | setMode (TransferMode mode) |
RWStreamCoupler provides an automated mechanism for connecting an input stream to an output stream. You can use it in conjunction with the network portal streams and the Internet classes to couple an FTP get
to an FTP put
, an FTP get
to a file, an FTP put
from a file, and a POP3 get
to a file. You can also use it to automate copying one file to another.
The coupling mechanism respects canonical line termination in ASCII mode, and always uses <cr><lf>
pairs to terminate lines when streaming out to a portal.
An optional end-of-input filter may be added to terminate the processing of the input stream prior to the end of the stream.
typedef bool(* RWStreamCoupler::Filter) (const RWCString &) |
Defines a Filter function that takes const
RWCString&
as its argument. The purpose of a possible customized Filter function is to allow the termination of the processing of an input stream prior to the end of the stream.
Enumerates whether an RWStreamCoupler object adopts a line mode (mode_ascii) transfer with possible line termination and filter issues, or a byte mode (mode_binary) transfer.
Enumerator | |
---|---|
ASCII |
line mode transfer |
BINARY |
byte mode transfer |
mode_ascii |
line mode transfer |
mode_binary |
byte mode transfer |
RWStreamCoupler::RWStreamCoupler | ( | TransferMode | mode = mode_ascii | ) |
Constructs an RWStreamCoupler object. If the mode argument is not explicitly set, it is mode_ascii by default.
TransferMode RWStreamCoupler::getMode | ( | void | ) | const |
Gets the current transfer mode.
bool RWStreamCoupler::operator() | ( | std::istream & | in, |
std::ostream & | out | ||
) |
Streams the contents of in into out. If the out argument is an RWPortalOStream and the current transfer mode is mode_ascii, <cr><lf>
line termination is enforced. If a filter function is passed in and the transfer mode is mode_ascii, each line of input from in is passed to the filter before streaming out to out.
bool RWStreamCoupler::operator() | ( | std::istream & | in, |
RWPortalOStream & | out | ||
) |
Streams the contents of in into out. If the out argument is an RWPortalOStream and the current transfer mode is mode_ascii, <cr><lf>
line termination is enforced. If a filter function is passed in and the transfer mode is mode_ascii, each line of input from in is passed to the filter before streaming out to out.
bool RWStreamCoupler::operator() | ( | std::istream & | in, |
std::ostream & | out, | ||
Filter | filter | ||
) |
Streams the contents of in into out. If the out argument is an RWPortalOStream and the current transfer mode is mode_ascii, <cr><lf>
line termination is enforced. If a filter function is passed in and the transfer mode is mode_ascii, each line of input from in is passed to the filter before streaming out to out.
bool RWStreamCoupler::operator() | ( | std::istream & | in, |
RWPortalOStream & | out, | ||
Filter | filter | ||
) |
Streams the contents of in into out. If the out argument is an RWPortalOStream and the current transfer mode is mode_ascii, <cr><lf>
line termination is enforced. If a filter function is passed in and the transfer mode is mode_ascii, each line of input from in is passed to the filter before streaming out to out.
void RWStreamCoupler::setMode | ( | TransferMode | mode | ) |
Sets the transfer mode.
Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |