.TH "FBB::EoiBuf" "3bobcat" "2005\-2020" "libbobcat\-dev_5\&.07\&.00" "End\-Of\-Information Base class" .PP .SH "NAME" FBB::EoiBuf \- std::streambuf class offering an eoi manipulator .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" The class \fIEoiBuf\fP inherits from \fIEoi\fP and may therefore be used as a base class of classes specializing \fIstd::streambuf\fP\&. It also provides a configurable character buffer for storing characters received from their devices\&. Often, when deriving classes from \fIstd::streambuf\fP the derived classes must implement storage to and retrieval from a character buffer\&. By deriving from \fIEoiBuf\fP buffer\-handling is automatically provided\&. .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" \fIEoi\fP (and thus from: \fIstd::streambuf\fP) .PP .SH "PROTECTED CONSTRUCTOR" .PP Analogously to \fIstd::streambuf\fP only protected constructors are available\&. .PP .IP o \fBEoiBuf()\fP: .br The default constructor initializes an empty buffer\&. .IP .IP o \fBEoiBuf(size_t size)\fP: .br This initializes an empty buffer of a predefined size of \fIsize\fP characters \&. .PP Note that there\(cq\&s no inherent limit to the size of the internal buffer: its size can always be enlarged or reduced\&. .PP Copy and move constructors (and assignment operators) are not available\&. .PP .SH "PROTECTED MEMBER FUNCTIONS" .PP All members of \fIstd:streambuf\fP and \fIEoi\fP are available, as \fBFBB::EoiBuf\fP inherits from these classes\&. .PP .IP o \fBstd::string &buffer()\fP: .br A reference to the internal buffer is returned; .IP .IP o \fBsize_t bufSize() const\fP: .br The length (size) of the internal buffer is returned; .IP .IP o \fBvoid resize(size_t size)\fP: .br The size of the internal buffer is changed to \fIsize\fP characters; .IP .IP o \fBvoid setg(unsigned next, unsigned beyond)\fP: .br The \fIstreambuf::eback\fP member returns the address of the internal buffer\(cq\&s first character, \fIstreambuf::gptr\fP returns the address of the internal buffer\(cq\&s \fInext\fP character, \fIstreambuf::egptr\fP returns the the address of the internal buffer\(cq\&s \fIbeyond\fP character; .IP .IP o \fBvoid setp()\fP: .br The \fIstreambuf::pbase\fP and \fIpptr\fP members return the address of the internal buffer\(cq\&s first character, \fIstreambuf::epptr\fP returns the address immediately beyond the internal buffer\(cq\&s last character; .IP .IP o \fBunsigned char *ucharPtr()\fP: .br The address of the first character of the internal buffer is returned as a pointer to an unsigned character; .IP .IP o \fBunsigned char const *ucharPtr() const\fP: .br Same as the previous member, but this time the address of the first character of the internal buffer is returned as a pointer to an immutable unsigned character\&. .PP .SH "PROTECTED STATIC MEMBER FUNCTIONS" .PP The following two static members are provided as convenient functions for derived classes to convert the address of the first character of \fIstd::string\fP objects to pointers to unsigned characters: .PP .IP o \fBunsigned char *ucharPtr(std::string &str)\fP: .br The address of the first character of \fIstr\fP is returned as a pointer to an unsigned character; .PP .IP o \fBunsigned char const *ucharPtr(std::string const &str) const\fP: .br Same as the previous member, but this time the address of the first character of \fIstr\fP is returned as a pointer to an immutable unsigned character\&. .PP .SH "EXAMPLE" Here is an example from the implementation of \fIEncryptBuf\fP: .PP .nf #include \(dq\&encryptbuf\&.ih\(dq\& void EncryptBuf::flushBuffer() // called by overflow when d_buffer is // full and by end() { int srcLen = pptr() \- pbase(); int encryptedLen; if ( not EVP_EncryptUpdate(d_ctx, ucharPtr(d_encrypted), &encryptedLen, ucharPtr(), srcLen) ) throw Exception{ 1 } << \(dq\&Encrypt update failed\(dq\&; d_outStream\&.write(&d_encrypted[0], encryptedLen); setp(); // reset the buffer } .fi .PP .SH "FILES" \fIbobcat/eoibuf\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBeoi\fP(3bobcat) .PP .SH "BUGS" None Reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_5\&.07\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_5\&.07\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_5\&.07\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_5\&.07\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_5\&.07\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .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