FBB::Eoi - std::streambuf class offering an eoi manipulator
Contents
Bobcat
Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’.
Bobcat Project Files
o https://fbb-git.gitlab.io/bobcat/: gitlab project page;
Debian Bobcat project files:
o libbobcat6: debian package containing the shared library, changelog and copyright note;
o libbobcat-dev: debian package containing the static library, headers, manual pages, and developer
info;
Bugs
None Reported.
Copyright
This is free software, distributed under the terms of the GNU General Public License (GPL).
Description
The class Eoi inherits from std::streambuf and may therefore be used as a base class of classes
specializing std::streambuf. It is particularly useful for classes implementing output operations, as it
can be used to specify the `true end’ of the generated output. E.g., an std::istreamin object may insert
its content into a std::ostreamout object using the familiar out<<in.rdbuf() expression, but that
doesn’t allow out to conclude that it has received all of its information. Sometimes additional actions
are required to complete the output (this happens with, e.g., EncryptBuf objects (cf.
encryptbuf(3bobcat)) where after encrypting all input padding characters may have to be added to the
encrypted document). If out is initialized with the address of an EncryptBufstd::streambuf then the true
end of the input can be indicated by inserting the eoi manipulator. The resulting expression becomes
std::cout<<in.rdbuf()<<eoi, and the manipulator ensures that the correct padding is handled.
Example
See the example provided in the osymcryptstream(3bobcat) man-page
Files
bobcat/eoi - defines the class interface
Inherits From
std::streambuf
Manipulator
o std::ostream&FBB::eoi(std::ostream&out):
The eoi manipulator can be inserted into the ostream using a streambuf which is inherited from
FBB::EoiBuf to stop further insertions into the ostream. If it is inserted into a plain
std::ostream nothing happens.
eoi can also be called as a function, receiving the stream that uses an FBB::EoiBuf as its
streambuf. By default the eoi manipulator performs no actions. To use the manipulator in a class
derived from EoiBuf the following approach can be used:
1. define a tt(bool d_eoi) data member, initialized to tt(false);
2. define a tt(void eoi_() override) member;
3. tt(eoi_) returns if tt(d_eoi == true), otherwise:
4. it sets tt(d_eoi) to tt(true) and performs the actions normally
performed by the class’s destructor;
5. the class’s destructor calls tt(eoi_()).
Member Functions
All members of std:streambuf are available, as FBB::Eoi inherits from these classes.
Name
FBB::Eoi - std::streambuf class offering an eoi manipulator
Namespace
FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the
namespace FBB.
Protected Constructor
o Eoi():
Analogously to std::streambuf only a default protected constructor is available.
Copy and move constructors (and assignment operators) are not available.
See Also
bobcat(7), eoibuf(3bobcat)
Synopsis
#include<bobcat/eoi>
Linking option: -lbobcatVirtual Member Function
o virtualvoideoi_():
The virtual member function eoi_ is a private member that can be overridden by derived classes. By
default it performs no actions.
