FBB::OHexBuf(3bobcat)
π FBB::OHexBuf β from the 3bobcat manual, bestie π«Ά
okay so quick vibe check: this whole page is about FBB::OHexBuf, from the bobcat gang, and it's giving "turn literally everything into hex" energy. no cap. let's get into it πΈ
β¨ NAME β¨
FBB::OHexBuf β Writes characters written to an ostream as hex values
π¦ SYNOPSIS π¦
#include <bobcat/ohexbuf>
Linking option: -lbobcat
π DESCRIPTION π
So OHexBuf is a specialization of FBB::OFilterBuf, and what it does is take all the characters it receives and insert them into a destination file as 2-character wide hexadecimal values. iconic. Optionally you can also tell it a maximum linelength, if you're that kind of girl π
okay but pay attention to this part because it's highkey important: every single thing anOHexBufobject receives gets inserted as (a series of) hexadecimal values β not just plain characters. like, fr fr. e.g. when you insert the value123, the characters'1','2'and'3'are successively inserted, and so that'll result in the string313233being inserted into the destination stream. that's the whole bit. that's the assignment π
π NAMESPACE π
FBB
All constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB.
πΈ INHERITS FROM πΈ
FBB::OFilterBuf
π CONSTRUCTOR π
OHexBuf(std::ostream &stream, size_t width = 0, std::string const &separator = "")β the hexadecimal characters produced by theOFilterBufobject get inserted into stream. Optionally you can pass the maximum line width (in number of characters) with width. The (default) value0means "no line breaks requested, we're free-spiriting it". And separator defines the separator that's inserted between hexadecimal character values. By default? no separator at all. clean. minimal. slay.
Copy and move constructors (and assignment operators) are not available. they said no Γ no cancellations. periodt.
The destructor writes any buffered information to the destination stream and then flushes the destination stream. And finally, the destructor restores the original formatting flags of the receiving ostream. it puts everything back the way it found it, like a good houseguest π
β MEMBER FUNCTIONS β
All members of FBB::OFilterBuf, in particular its out() and reset members, are available, because FBB::OHexBuf inherits from this class. genetic inheritance but make it C++.
void eoi()β this member completes the current hexadecimal character conversion, clears the separator, and no longer uses a the maximum output line width. Instead of calling this member theeoimanipulator (see below) can be used. two paths, one destination π¦void separator(bool reset = true)β this member clears the separator that's inserted between hexadecimal character values. When the reset parameter is set totrue(which is the default), the currently used output width is reset to0.void separator(std::string const &separator, bool reset = true)β this member resets the separator that's inserted between hexadecimal character values to separator's value. When the reset parameter is set totrue(which is the default), the currently used output width is reset to0.void setWidth(size_t width)β this member sets the width of the generated output lines to width characters. No maximum line width is used whenwidth = 0is specified. so zero means "unlimited, live your truth".size_t size() constβ this member returns the next column offset where the next hexadecimal character will appear. If a maximum line length is requested andsize()does not return0, then the last line inserted was not terminated by a'\n'character. See also the example below π
ngl, this member's return value is undefined if no maximum line length was requested. so don't come crying to me, bestie, set that width first π
π MANIPULATOR π
FBB::eoiβ theeoimanipulator can be inserted into the ostream to complete the hexaecimal conversion. It acts identically to calling theendmember. If inserted into a plainstd::ostream, nothing happens. absolutely nothing. it just vibes. π«Ά
π STATIC MEMBER π
std::string text2bin(std::string const &in)β this static member converts a series of hexadecimal characters generated by aOHexBufobject back to their binary form. E.g., when called asOHexBuf::text2bin("736d616c6c206976"), then the returnedstd::stringwill contain 8 characters, having respectively the binary values0x73,0x6d,0x61,0x6c,0x6c,0x20,0x69, and0x76. it's the remix. the reverse. the un-hexing π
This function does not verify whether its argument is properly formed. A properly formed argument consists of an even number of hexadecimal number characters ('0'until'9','a'until'f'(or uppercase)). For improperly formed arguments the return value is undefined. so like... garbage in, mystery out. you've been warned π©·
π§ EXAMPLE π§
#include <iostream>
#include <bobcat/ohexbuf>
using namespace std;
using namespace FBB;
int main()
{
OHexBuf ohex(cout, 40);
ostream out(&ohex);
out << cin.rdbuf();
if (ohex.size())
cout << '\n';
}
see how it checks ohex.size() before adding that '\n'? that's the whole point of size(), bestie. main character behavior β¨
π FILES π
bobcat/ohexbufβ defines the class interface
π SEE ALSO π
π BUGS π
None Reported.
(the bug tracker is at peace. we love that for it. no cap.)
π 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. it's a backronym and it ate, honestly π₯
πΈ 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).
and that's the page, bestie π«Ά this was libbobcat-dev version 6.15.01, living its life from 2005-2026, and honestly? still slaying π
β¨π
π¦ 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