FBB::EoiBuf(3bobcat) | End-Of-Information Base class | FBB::EoiBuf(3bobcat) |
FBB::EoiBuf - std::streambuf class offering an eoi manipulator
#include <bobcat/eoibuf>
Linking option: -lbobcat
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: it contains a (resizable) character buffer, and offers a setp member as well as a setg member that can be used to specify the index rage of the buffer from which extractions receive characters. Also, when overriding its base class’s eoi_ member it can be used to signal the end of input inserted into std::ostream classes using EoiBuf objects as std::streambuf objects.
FBB
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace FBB.
FBB::Eoi (and thus from: std::streambuf)
Analogously to std::streambuf only protected constructors are available.
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.
All members of std:streambuf and Eoi are available, as FBB::EoiBuf inherits from these classes.
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:
The following two functions are defined in the (internally used only) class FBB::OSymCryptBase, which is the base class of osymcryptstreambuf(3bobcat).
#include "osymcryptbase.ih" void OSymCryptBase::evpUpdate() {
size_t inBufRead = pptr() - pbase(); // # read chars
checkOutBufSize(inBufRead);
int nOutputChars;
if (not ((*d_evpUpdate)( // en/decrypt the bytes in d_inBuf
ctx(),
uOutBuf(), &nOutputChars,
ucharPtr(), inBufRead
))
)
throw Exception{} << "EVP_{En,De}cryptUpdate failed";
d_outStream.write(outBuf(), nOutputChars); // write the processed
// chars to d_outSteam
setp(); }
#include "osymcryptbase.ih" void OSymCryptBase::eoi_() {
if (d_eoi)
return;
evpUpdate(); // process available chars in the input
d_eoi = true;
resize(0); // clear the input buffer
evpUpdate(); // update an empty buffer }
bobcat/eoibuf - defines the class interface
None Reported.
Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’.
This is free software, distributed under the terms of the GNU General Public License (GPL).
Frank B. Brokken (f.b.brokken@rug.nl).
2005-2022 | libbobcat-dev_6.02.02 |