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 constructor T may be any type that can be inserted into an o[string]stream. anything. insertable. slay.
  • X2a(double value, size_t behind) β€” the double value is truncated to behind digits behind the decimal dot. if a value doesn't fill up behind digits behind the decimal point, then the missing digits get added as 0. for example, a value of 7.1 will be displayed as 7.10 if two digits behind the decimal dot are requested. a value of 7 will be displayed as 7.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 over width character positions, extending the amount if the value so requires. the converted value is placed right-aligned into the field of width characters.
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 returns true if the last conversion failed (i.e., the object's fail() member returned true, and returns false otherwise). this member lets you check on the success of the extraction/conversion when you're using anonymous A2x objects. it also returns true when 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 the x2a parameter value into the provided ostream.
  • operator std::string const() const β€” this conversion operator returns the information stored inside the FBB::X2a object.

🌈 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 πŸ¦‹

bobcat(7), a2x(3bobcat)

(the reverse direction!! the sequel!! obsessed πŸ’…)


πŸ’€ BUGS πŸ’€

none reported

literally flawless, not a single bug on the record πŸ‘‘


🌟 BOBCAT PROJECT FILES 🌟

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 πŸ’–


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