.TH "FBB::OFdStreambuf" "3bobcat" "2005\-2018" "libbobcat\-dev_4\&.08\&.06\-x\&.tar\&.gz" "File Descriptor Output Stream Buffer" .PP .SH "NAME" FBB::OFdStreambuf \- Output stream buffer initialized by a file descriptor .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" \fBFBB::OFdStreambuf\fP objects may be used as a \fBstd::streambuf\fP of \fIstd::ostream\fP objects to allow insertions into a file descriptor\&. .PP File descriptors are not defined within the context of \fBC++\fP, but they can be used on operating systems that support the concept\&. Realize that using file descriptors introduces operating system dependencies\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \fBstd::streambuf\fP .PP .SH "ENUMERATION" The public enumeration \fBMode\fP defined in the class \fBFBB::OFdStreamBuf\fP has the following values: .IP o \fBCLOSE_FD\fP, indicating that the file descriptor used by the object must be closed; .IP o \fBKEEP_FD\fP (the default) indicating that the file descriptor used by the object must not be closed\&. .PP .SH "CONSTRUCTORS" .IP o \fBOFdStreambuf()\fP: .br This constructor initializes the streambuf, without associating it to a file descriptor, and without using buffering\&. The member \fBopen()\fP can be used to associate the object later on with a file descriptor and optionally a buffer size\&. When the object is destroyed or if the mode\-less overloaded version of the \fBopen\fP member is called, the file descriptor will be closed\&. .IP .IP o \fBOFdStreambuf(Mode mode)\fP: .br This constructor initializes the streambuf, without associating it to a file descriptor, and without using buffering\&. The member \fBopen()\fP can be used to associate the object later on with a file descriptor and optionally a buffer size\&. When the object is destroyed or if the mode\-less overloaded version of the \fBopen\fP member is called, the \fBMode\fP argument determines whether the file descriptor will be closed or will remain open\&. .IP .IP o \fBOFdStreambuf(int fd, size_t n = 1)\fP: .br This constructor initializes the streambuf, associating it to file descriptor \fIfd\fP, and an optional unget buffer size (by default having size 1)\&. When \fBopen\fP is called subsequently, or if the object is destroyed the provided file descriptor will be closed\&. .IP .IP o \fBOFdStreambuf(int fd, size_t n = 1)\fP: .br This constructor initializes the streambuf, associating it to file descriptor \fIfd\fP, and an optional unget buffer size (by default having size 1)\&. When the object is destroyed or if the mode\-less overloaded version of the \fBopen\fP member is called, the file descriptor will be closed\&. .IP .IP o \fBOFdStreambuf(int fd, Mode mode, size_t n = 1)\fP: .br This constructor initializes the streambuf, associating it to file descriptor \fIfd\fP, and an optional unget buffer size (by default having size 1)\&. When the object is destroyed or if the mode\-less overloaded version of the \fBopen\fP member is called, the \fBMode\fP argument determines whether the file descriptor will be closed or will remain open\&. There are no copy or move constructors\&. .PP .SH "MEMBER FUNCTIONS" All members of \fBstd::streambuf\fP are available, as \fBFBB::OFdStreambuf\fP inherits from this class\&. Some of the \fBstd::streambuf\fP\(cq\&s member are overridden by \fBFBB::OFdStreambuf\fP, see below\&. .IP o \fBvoid close()\fP: .br The file descriptor used by the \fIOFdStreambuf\fP is closed, irrespective of the \fIMode\fP that was specified when the \fIOFdStreambuf\fP object was constructed\&. Following \fIclose\fP the \fIOFdStreambuf\fP object can no longer be used until one of its \fIopen\fP members has been called\&. .IP o \fBint fd() const\fP: .br The file descriptor used by the \fIOFdStreambuf\fP object is returned\&. If the \fIOFdStreambuf\fP is not associated with a file descriptor \-1 is returned\&. .IP o \fBvoid open(int xfd, size_t n = 1)\fP: .br The streambuf is (re)initialized, using file descriptor \fIfd\fP, and an optional unget buffer size (by default having size 1)\&. When called repeatedly, the \fBMode\fP specification used whem the object was constructed determines whether the file descriptor will be closed or will remain open\&. .IP o \fBvoid open(int xfd, Mode mode, size_t n = 1)\fP: .br The streambuf is (re)initialized, using file descriptor \fIfd\fP, a file descriptor closing parameter and an optional unget buffer size (by default having size 1)\&. Depending on the \fBMode\fP argument the object\(cq\&s currently used file descriptor will be closed or will remain open when the \fIIFdStreambuf\fP object is destroyed\&. The overloaded assignment operator is not available\&. .PP .SH "PROTECTED MEMBER FUNCTION" .PP The member listed in this section implements the tasks of the comparably named virtual function in the class\(cq\&s private interface\&. This separates the redefinable interface from the user\-interface\&. The class \fBOFdStreambuf\fP can, in accordance with Liskov\(cq\&s Substitution Principle, be used as a \fIstd:streambuf\fP; but it also offers a facility for classes deriving from \fBOFdStreambuf\fP\&. This facility is listed here\&. .IP o \fBint pSync()\fP: .br The contents of the \fBOFdStreambuf\fP\(cq\&s internal buffer are flushed\&. If writing the contents to the file descriptor fails, a warning message is displayed to the standard error stream\&. .PP .SH "EXAMPLE" To do .PP .SH "FILES" \fIbobcat/ofdstreambuf\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBifdstreambuf\fP(3bobcat), \fBofdstream\fP(3bobcat), \fBstd::streambuf\fP .PP .SH "BUGS" None reported .PP .SH "DISTRIBUTION FILES" .IP o \fIbobcat_4\&.08\&.06\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_4\&.08\&.06\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_4\&.08\&.06\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_4\&.08\&.06\-x_*\&.deb\fP: debian package holding the libraries; .IP o \fIlibbobcat1\-dev_4\&.08\&.06\-x_*\&.deb\fP: debian package holding the libraries, headers and manual pages; .IP o \fIhttp://sourceforge\&.net/projects/bobcat\fP: public archive location; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP