FBB::Mbuf(3bobcat)
β¨ FBB::Mbuf β std::streambuf handling messages β¨
okay bestie, welcome to the FBB::Mbuf page from the bobcat manual (that's section 3bobcat, iykyk) π
πΈ SYNOPSIS πΈ
#include <bobcat/mbuf>
Linking option: -lbobcat
π¦ DESCRIPTION π¦
So like⦠objects of this class are derived from std::streambuf, and their whole thing is handling messages in a standardized way. Periodt. Messages can be prefixed with order (line) numbers and/or labels.
By default every message goes straight into the standard output stream, but you can romance other destinations (standard error, a named file, whatever you want) into existence, no cap.
Now here's the important bit, bestie: FBB::Mbuf objects are std::streambuf objects, so technically you can use them to construct std::ostream objects. BUT β and this is the part where I need you to look at me β they're intended to be used by mstream(3bobcat) objects, and passing Mbuf objects to any other kind of ostream object is deprecated and results in undefined behavior. Not the cute kind of chaos. The scary kind. π
π NAMESPACE π
FBB
Every single element mentioned in this man-page is defined in the namespace FBB. All of them. The whole squad.
π INHERITS FROM π
std::streambuf
π CONSTRUCTORS π
Mbuf()β the default constructor handles messages using thestd::streambufthatstd::coutalso uses. There is no limit to the number of messages you can insert. No message or line numbers get shown, and no exceptions get thrown when inserting messages. Chill vibes only.explicit Mbuf(std::streambuf *buf, size_t maxCount = std::numeric_limits<size_t>::max(), std::string const &tag = "", bool throwing = false)β this one uses buf to handle messages. With the default argument values there's no limit to the number of messages you can insert, no message or line numbers get shown, and no exceptions get thrown when inserting messages. Specifying any value other thanstd::numeric_limits<size_t>::max()sets the maximum number of messages that can be inserted to that value. Thetagdefines the text of the message label (e.g.Error). Whenthrowingis specified astrue, anFBB::Exceptionexception is thrown after completing a message β and that generated exception holds theid(see the memberidbelow) of theFBB::Mbufobject it was thrown from, plus the textFBB::Mbuf.explicit Mbuf(std::string const &name, size_t maxCount = std::numeric_limits<size_t>::max(), std::string const &tag = "", bool throwing = false)β this constructor creates astd::ofstreamfrom the providednameparameter, and that stream receives the messages handled by the constructedFBB:Mbufobject. It throws anFBB::Exceptionexception if the stream can't be opened for writing. If a file by that name already exists, it gets rewritten (bye bye old contents, no cap). The remaining parameters are identical to those of the previous two constructors.
π«Ά heads up: Copy and move constructors (and assignment operators) are not available. They simply did not show up to the function.
π MEMBER FUNCTIONS π
size_t count() constβ returns the number of inserted messages. And ifsetCounthas been called: it's the value set by the lastsetCountcall plus the number of inserted messages since that call.bool lineExcess() constβ returnstrueafter you've attempted to insert an additional message aftermaxCount()number of messages have already been inserted. Overflow behavior, but make it a bool.std::string const &lineTag() constβ returns the currently used line-tag (by defaultLine).size_t maxCount() constβ returns the maximum number of messages that can be inserted. If the returned value equalsstd::numeric_limits<size_t>::max()then there's no limit to the number of messages that can be inserted. Infinite message glitch, iconic.void noLineNr()β calling this member suppresses the display of a line number, but only if it's called after callingsetLineNr(see below) and before a message is being inserted (or has been inserted).void reset(std::streambuf *buf, size_t maxCount, std::string const &tag, bool throwing)β messages inserted intoFBB::Mbufobjects get handled bystd::streambufbuf. By specifyingstd::numeric_limits<size_t>::max()formaxCountthere's no limit to the number of messages that may be handled by thisstd::streambuf. Thetagdefines the text of the message label (e.g.,Error, or the empty string for no message label). Whenthrowingis specified astrue, anFBB::Exceptionexception is thrown after completing a message.void reset(std::string const &name, size_t maxCount, std::string const &tag, bool throwing)β messages inserted intoFBB::Mbufobjects get handled by astd::ofstreamcreated using the providednameparameter. It throws anFBB::Exceptionexception if the stream can't be opened for writing. If a file by that name already exists it gets rewritten. The remaining parameters are identical to those of the previousresetmembers.void reset(FBB::Mbuf const &mbuf)β the current object gets reset using the parameters of thembufparameter. After the reset, every one of the current object's parameters can be modified independently from those used bymbuf. Glow-up complete, but separate. πvoid setCount(size_t count)β assigns the valuecountto the object's message counter.void setLineNr(size_t lineNr)β specifies the valuelineNras the message's line number when the next line is displayed (see alsonoLineNr). This value is not changed by theFBB::Mbufobject. To display another line number you'll have to call the member again β meaning the line number is not automatically displayed again at every new line. It's a one-time moment, main character energy, it doesn't repeat itself. β¨void setLineTag(std::string const &tag)β specifies the tag prefixing line numbers. By default the line tag equalsLine.void setMaxCount(size_t maxCount)β definesmaxCountas the maximum number of messages that can be inserted into theFBB::Mbufobject.void setTag(std::string const &tag)β specifies the tag prefixing messages. By default the tag is empty. If it's not empty, the tag gets enclosed by square brackets. So, e.g., specifying the tagErrorwill prefix messages with[Error]. Cute formatting, honestly.std::string const &tag() constβ returns the currently used message tag (by default an empty string).bool throws()β returnstruewhen theFBB::Mbufobject will throw anFBB::Exceptionexception at the next completed message. That generated exception holds theid(see earlier for the memberid) of theFBB::Mbufobject the exception was thrown from, as well as the textFBB::Mbuf.void throwing(bool ifTrue)β modifies the behavior ofFBB::Mbufobjects at completed messages. After passingtrue,FBB::Mbufobjects will throw anFBB::Exceptionexception at the next completed message; otherwise this exception is not thrown.
π EXAMPLE π
See the mstream(3bobcat) example. Bestie, it's right there, go look π
π FILES π
bobcat/mbufβ defines the class interface.
π₯ SEE ALSO π₯
bobcat(7), exception(3bobcat), mstream(3bobcat)
π BUGS π
None Reported. (Periodt. We're clean.)
π BOBCAT PROJECT FILES π
https://fbb-git.gitlab.io/bobcat/: gitlab project page;
Debian Bobcat project files:
libbobcat6: debian package containing the shared library, changelog and copyright note;libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;
π§ BOBCAT π§
Bobcat is an acronym of Brokken's Own Base Classes And Templates. The name ate, frankly.
π 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).
okay that's the whole thing, you're so welcome π«Ά this was FBB::Mbuf(3bobcat), living in libbobcat-dev_6.15.01, dated 2005-2026, and fr fr that's a legacy. go forth and stream responsibly, bestie π
πΈ
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms