This class implements a specialization of the std::streambuf class,
allowing input operations from and output operations to different files. It is
intended to be used in combination with FBB::IOStream, thus allowing all
stream-based input and output operations using the same object without the
need to use seek-operations. Using an FBB::IOStream object it is,
e.g., possible to construct two-way communications using pipes, much like the
facilities offered by sockets.
If the streams that will be associated with the IOStreambuf object
support seeking, then the IOStreambuf will do so to. Seeking might also be
availble for a single stream (either the std::istream or the
std::ostream).
When the IOStreambuf object goes out of scope, its associated
std::ostream object is flushed.
NAMESPACE
FBB
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace FBB.
INHERITS FROM
std::streambuf
CONSTRUCTORS
IOStreambuf():
The default constructor results in a IOStreambuf object that
cannot be immediately used. Its member open() must be called first.
IOStreambuf(std::istream &in, std::ostream &out):
This constructor associates the IOStreambuf object with a
std::istream and a std::ostream. All output operations will be passed
on to the std::ostream, all input operations to the std::istream. The
streams passed to IOStreambuf() should outlive the IOStreambuf
object.
De copy constructor is available as well.
MEMBER FUNCTIONS
All members of std::streambuf are
available, as FBB::IOStreambuf inherits from these classes.
void open(std::istream &in, std::ostream &out):
This member (re)associates the IOStreambuf object with a
std::istream and a std::ostream. All output operations will be passed
on to the std::ostream, all input operations to the std::istream. The
streams passed to IOStreambuf() should outlive the IOStreambuf
object. If this member is called for an IOStreambuf object already
associated with an std::ostream object, the already associated
std::ostream object is flushed before setting up the new association.
VIRTUAL PROTECTED MEMBER FUNCTIONS
The following std::streambuf member functions are overruled by
IOStreambuf. They should only be called when the FBB::Streambuf object
is associated with std::istream and std::ostream objects (i.e., they
should not be called between the construction of a default FBB:IOStreambuf
object and a subsequent call of IOStreambuf::open()):
int overflow(int c):
Inserts the next character into the associated std::ostream
object.
int underflow():
Returns the next character from the associated std::istream
object.
pos_type seekoff(off_type offset, std::ios::seekdir way,
std::ios::openmode mode =
std::ios::in | std::ios::out):
With seekable streams, repositions the associated std::istream
or std::ostream is repositioned to offset offset, relative to
way.
pos_type seekpos(off_type offset, std::ios::openmode mode =
std::ios::in | std::ios::out):
With seekable streams, repositions the associated std::istream
or std::ostream is repositioned to offset offset, relative to
the beginning of the stream.
int sync():
This member flushes the associated std::ostream object.
std::streamsize xsputn(char const *buffer, std::streamsize n):
This member inserts n characters from buffer into the
associated std::ostream stream.
EXAMPLE
See the example provided with process(3bobcat).
FILES
bobcat/iostreambuf - defines the class interface
SEE ALSO
bobcat(7), iostream(3bobcat), process(3bobcat)
BUGS
None reported.
DISTRIBUTION FILES
bobcat_2.02.03-x.dsc: detached signature;
bobcat_2.02.03-x.tar.gz: source archive;
bobcat_2.02.03-x_i386.changes: change log;
libbobcat1_2.02.03-x_*.deb: debian package holding the
libraries;
libbobcat1-dev_2.02.03-x_*.deb: debian package holding the
libraries, headers and manual pages;
http://sourceforge.net/projects/bobcat: public archive location;
BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
COPYRIGHT
This is free software, distributed under the terms of the
GNU General Public License (GPL).