FBB::X2a(3bobcat)
β¨ FBB::X2a β¨
okay bestie, welcome to the bobcat manual page for FBB::X2a π (that's section 3 of the bobcat manuals, iykyk). sit down, grab a strawberry π, and let's talk about turning literally anything into text.
π NAME π
FBB::X2a β objects doing x-to-Ascii conversions, no cap π
π SYNOPSIS π
#include <bobcat/x2a>
Linking option: -lbobcat
π¦ DESCRIPTION π¦
so. FBB::X2a objects convert values of any (insertable) type into text. the text it gives back is automatically available as a standard C++ string. it's giving β¨effortlessβ¨.
real talk though: X2a was developed well before the std::to_string function even existed. in a lot of cases that newer function can just be used instead of X2a β it's available for standard types, and she ate. but if you need some other type, X2a may still come in handy π«Ά.
π NAMESPACE π
FBB
every constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. periodt.
πΈ INHERITS FROM πΈ
std::ostringstream
like, the whole thing. main character energy inherited π
π CONSTRUCTORS π
X2a(T const &value)β in this constructorTmay be any type that can be inserted into ano[string]stream. anything. insertable. slay.X2a(double value, size_t behind)β thedouble valueis truncated tobehinddigits behind the decimal dot. if a value doesn't fill upbehinddigits behind the decimal point, then the missing digits get added as0. for example, a value of7.1will be displayed as7.10if two digits behind the decimal dot are requested. a value of7will be displayed as7.00. the padding is iconic πβ¨X2a(double value, size_t width, size_t behind, std::ios::fmtflags flags = std::ios::right)β the value is displayed overwidthcharacter positions, extending the amount if the value so requires. the converted value is placed right-aligned into the field ofwidthcharacters.
also!! the copy constructor and the copy assignment operator are available. you can copy her, she doesn't mind π«Ά
β STATIC MEMBER FUNCTION β
bool lastFail()β this member returnstrueif the last conversion failed (i.e., the object'sfail()member returnedtrue, and returnsfalseotherwise). this member lets you check on the success of the extraction/conversion when you're using anonymous A2x objects. it also returnstruewhen no conversions have as yet been performed. π
β οΈ warning bestie: note that this member is a thread-unsafe static member. in a multithreaded program, locks may be required to make sure the proper conversion result is inspected. don't be messy about it π
π§ MEMBER FUNCTIONS π§
all members of std::ostringstream are available, because FBB::X2a inherits from this class. in particular ostringstream::str() can be used to obtain the content of an X2a object's text buffer. easy access, she's generous π
π₯ OVERLOADED OPERATORS π₯
operator std::ostream &operator<<(std::ostream &ostr, X2a const &x2a)β this conversion operator inserts the textual representation of thex2aparameter value into the provided ostream.operator std::string const() constβ this conversion operator returns the information stored inside theFBB::X2aobject.
π EXAMPLE π
string is(X2a(5)); // initializes `isβ with "5"
string ds(X2a(5.25)); // initializes `dsβ with "5.25"
cout << X2a(7.0 / 3, 4) << endl;
// display a value using 4 digits behind the
// decimal dot.
cout << X2a(7.0 / 3, 8, 4) << endl;
// display a value over 8 positions, right
// adjusted, 4 digits behind the decimal dot.
cout << X2a(7.0 / 3, 8, 4, std::ios::left) << endl;
// display a value over 8 positions, left
// adjusted, 4 digits behind the decimal dot.
like, look at her go π₯Ήβ¨
π FILES π
bobcat/x2a β defines the class interface
π¦ SEE ALSO π¦
(the reverse direction!! the sequel!! obsessed π )
π BUGS π
none reported
literally flawless, not a single bug on the record π
π 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β. iconic naming, no notes π
π COPYRIGHT π
this is free software, distributed under the terms of the GNU General Public License (GPL). free as in freedom, babe ποΈ
π«Ά AUTHOR π«Ά
Frank B. Brokken (f.b.brokken@rug.nl).
and that's the whole page, bestie!! this one's from libbobcat-dev_6.15.01, dated 2005-2026 β yeah she's been serving across the decades πβ¨ go forth and convert literally anything into ascii, you've got this π
π
π¦ 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