- bullseye 5.07.00-1
- testing 6.02.02-1
- unstable 6.02.02-1
- experimental 6.03.02-1
FBB::EoiBuf(3bobcat) | End-Of-Information Base class | FBB::EoiBuf(3bobcat) |
NAME¶
FBB::EoiBuf - std::streambuf class offering an eoi manipulator
SYNOPSIS¶
#include <bobcat/eoibuf>
Linking option: -lbobcat
DESCRIPTION¶
The class EoiBuf inherits from Eoi and may therefore be used as a base class of classes specializing std::streambuf. It also provides a configurable character buffer for storing characters received from their devices. Often, when deriving classes from std::streambuf the derived classes must implement storage to and retrieval from a character buffer. By deriving from EoiBuf buffer-handling is automatically provided.
NAMESPACE¶
FBB
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace FBB.
INHERITS FROM¶
Eoi (and thus from: std::streambuf)
PROTECTED CONSTRUCTOR¶
Analogously to std::streambuf only protected constructors are available.
- o
- EoiBuf():
The default constructor initializes an empty buffer. - o
- EoiBuf(size_t size):
This initializes an empty buffer of a predefined size of size characters .
Note that there’s no inherent limit to the size of the internal buffer: its size can always be enlarged or reduced.
Copy and move constructors (and assignment operators) are not available.
PROTECTED MEMBER FUNCTIONS¶
All members of std:streambuf and Eoi are available, as FBB::EoiBuf inherits from these classes.
- o
- std::string &buffer():
A reference to the internal buffer is returned; - o
- size_t bufSize() const:
The length (size) of the internal buffer is returned; - o
- void resize(size_t size):
The size of the internal buffer is changed to size characters; - o
- void setg(unsigned next, unsigned beyond):
The streambuf::eback member returns the address of the internal buffer’s first character, streambuf::gptr returns the address of the internal buffer’s next character, streambuf::egptr returns the the address of the internal buffer’s beyond character; - o
- void setp():
The streambuf::pbase and pptr members return the address of the internal buffer’s first character, streambuf::epptr returns the address immediately beyond the internal buffer’s last character; - o
- unsigned char *ucharPtr():
The address of the first character of the internal buffer is returned as a pointer to an unsigned character; - o
- unsigned char const *ucharPtr() const:
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.
PROTECTED STATIC MEMBER FUNCTIONS¶
The following two static members are provided as convenient functions for derived classes to convert the address of the first character of std::string objects to pointers to unsigned characters:
- o
- unsigned char *ucharPtr(std::string &str):
The address of the first character of str is returned as a pointer to an unsigned character; - o
- unsigned char const *ucharPtr(std::string const &str) const:
Same as the previous member, but this time the address of the first character of str is returned as a pointer to an immutable unsigned character.
EXAMPLE¶
Here is an example from the implementation of EncryptBuf:
#include "encryptbuf.ih" 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 } << "Encrypt update failed";
d_outStream.write(&d_encrypted[0], encryptedLen);
setp(); // reset the buffer }
FILES¶
bobcat/eoibuf - defines the class interface
SEE ALSO¶
bobcat(7), eoi(3bobcat)
BUGS¶
None Reported.
BOBCAT PROJECT FILES¶
- o
- https://fbb-git.gitlab.io/bobcat/: gitlab project page;
- o
- bobcat_5.07.00-x.dsc: detached signature;
- o
- bobcat_5.07.00-x.tar.gz: source archive;
- o
- bobcat_5.07.00-x_i386.changes: change log;
- o
- libbobcat1_5.07.00-x_*.deb: debian package containing the libraries;
- o
- libbobcat1-dev_5.07.00-x_*.deb: debian package containing the libraries, headers and manual pages;
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).
AUTHOR¶
Frank B. Brokken (f.b.brokken@rug.nl).
2005-2020 | libbobcat-dev_5.07.00 |