.TH "FBB::X2a" "3bobcat" "2005\-2020" "libbobcat\-dev_5\&.07\&.00" "X\-to\-ASCII conversions" .PP .SH "NAME" FBB::X2a \- Objects performing x\-to\-Ascii conversions .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" \fBFBB:X2a\fP objects convert values of any (insertable) type to text\&. The returned text is automatically made available as a standard \fBC++\fP string\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \fBstd::ostringstream\fP .PP .SH "CONSTRUCTORS" .IP o \fBX2a(T const &value)\fP: .br In this constructor \fIT\fP may be any type that can be inserted into an \fIo[string]stream\fP\&. .IP o \fBX2a(double value, size_t behind)\fP: .br Double \fIvalue\fP is truncated to \fIbehind\fP digits behind the decimal dot\&. If a value doesn\(cq\&t occupy \fIbehind\fP digits behind the decimal point, then missing digits are added as \fI0\fP\&. 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\&. .IP .IP o \fBX2a(double value, size_t width, size_t behind, std::ios::fmtflags flags = std::ios::right)\fP: .br The value is displayed over \fIwidth\fP character positions, extending the amount if the value so requires\&. The converted value is placed right\-aligned into the field of \fIwidth\fP characters\&. .PP The copy constructor and the copy assignment operator are available\&. .PP .SH "STATIC MEMBER FUNCTION" .IP o \fBbool lastFail()\fP: .br This member returns \fItrue\fP if the last conversion failed (i\&.e\&., the object\(cq\&s \fIfail()\fP member returned \fItrue\fP and returns \fIfalse\fP otherwise)\&. This member allows checks on the success of the extraction/conversion using anonymous \fIA2x\fP objects\&. The member also returns \fItrue\fP when no conversions have as yet been performed\&. .br Note that this member is a thread\-unsafe \fIstatic\fP member: in a multithreaded program locks may be required to ensure that the proper conversion result is inspected\&. .PP .SH "MEMBER FUNCTIONS" All members of \fBstd::ostringstream\fP are available, as \fBFBB::X2a\fP inherits from this class\&. In particular \fIostringstream::str()\fP can be used to obtain the content of an \fIX2a\fP object\(cq\&s text buffer\&. .PP .SH "OVERLOADED OPERATORS" .IP o \fBoperator std::ostream &operator<<(std::ostream &ostr, X2a const &x2a)\fP: .br This conversion operator inserts the textual representation of the \fIx2a\fP parameter value into the provided \fIostream\fP\&. .IP o \fBoperator std::string const() const\fP: .br this conversion operator returns the information stored inside the \fBFBB::X2a\fP object\&. .PP .SH "EXAMPLE" .nf string is(X2a(5)); // initializes `is\(cq\& with \(dq\&5\(dq\& string ds(X2a(5\&.25)); // initializes `ds\(cq\& with \(dq\&5\&.25\(dq\& 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\&. .fi .PP .SH "FILES" \fIbobcat/x2a\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBa2x\fP(3bobcat) .PP .SH "BUGS" The functionality of this class is to a large extent also offered by the \fBC++\fP function \fIstd::to_string\fP\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_5\&.07\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_5\&.07\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_5\&.07\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_5\&.07\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_5\&.07\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP