virtual iter_type do_put(iter_type next, ios_base& x,
E fill, long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, unsigned long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, double val) const;
virtual iter_type do_put(iter_type nextp ios_base& x,
E fill, long double val) const;
virtual iter_type do_put(iter_type nextp ios_base& x,
E fill, const void *val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, bool val) const;
The first virtual protected member function generates sequential elements beginning at next
to produce an integer
output field from the value of val
. The function returns an iterator designating the next place to insert an element
beyond the generated integer output field.
The integer output field is generated by the same rules used by the print functions for generating a series of char
elements to a file. (Each such char element is assumed to map to an equivalent element of type E
by a simple,
one-to-one, mapping.) Where a print function pads a field with either spaces or the digit 0
, however, do_put
instead
uses fill
. The equivalent print conversion specification is determined as follows:
x.
flags
() & ios_base::
basefield
== ios_base::
oct
, the conversion specification is lo
.x.flags() & ios_base::basefield == ios_base::
hex
, the conversion specification is lx
.ld
.If x.
width
()
is nonzero, a field width of this value is prepended. The function then calls x.width(0)
to reset the field
width to zero.
Padding occurs only if the minimum number of elements N
required to specify the output field is less than x.
width
()
.
Such padding consists of a sequence of N - width()
copies of fill
. Padding then occurs as follows:
x.flags() & ios_base::
adjustfield
== ios_base::
left
, the flag -
is prepended. (Padding occurs
after the generated text.) x.flags() & ios_base::adjustfield == ios_base::
internal
, the flag 0
is prepended. (For a
numeric output field, padding occurs where the print functions pad with 0
.)Finally:
x.flags() & ios_base::
showpos
is nonzero, the flag +
is prepended to the conversion specification.x.flags() & ios_base::
showbase
is nonzero, the flag #
is prepended to the conversion specification.The format of an integer output field is further determined by the locale facet fac
returned by the call use_facet
<
numpunct
<E>(x.
getloc
())
. Specifically:
fac.
grouping
()
determines how digits are grouped to the left of any decimal pointfac.
thousands_sep
()
determines the sequence that separates groups of digits to the left of any decimal pointIf no grouping constraints are imposed by fac.grouping()
(its first element has the value CHAR_MAX
) then no
instances of fac.thousands_sep()
are generated in the output field. Otherwise, separators are inserted after the
print conversion occurs.
The second virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, unsigned long val) const;
behaves the same as the first, except that it replaces a conversion specification of ld
with lu
.
The third virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, double val) const;
behaves the same as the first, except that it produces a floating-point output field from the value of val
.
fac.
decimal_point
()
determines the sequence that separates the integer digits from the fraction digits. The
equivalent print conversion specifier is determined as follows:
x.flags() & ios_base::
floatfield
== ios_base::
fixed
, the conversion specification is lf
.x.flags() & ios_base::floatfield == ios_base::
scientific
, the conversion specification is le
.
If x.flags() & ios_base::
uppercase
is nonzero, e
is replaced with E
.lg
. If x.flags() & ios_base::uppercase
is nonzero, g
is
replaced with G
.If x.flags() & ios_base::fixed
is nonzero, or if x.
precision
()
is greater than zero, a precision with the value
x.precision()
is prepended to the conversion specification. Any padding behaves the same as for an integer output
field. The padding character is fill
. Finally:
x.flags() & ios_base::
showpos
is nonzero, the flag +
is prepended to the conversion specification.x.flags() & ios_base::
showpoint
is nonzero, the flag #
is prepended to the conversion specification.The fourth virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, long double val) const;
behaves the same as the third, except that the qualifier l
in the conversion specification is replaced with L
.
The fifth virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, const void *val) const;
behaves the same as the first, except that the conversion specification is p
, plus any qualifier needed to specify padding.
The sixth virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, bool val) const;
behaves the same as the first, except that it generates a Boolean output field from val
.
A Boolean output field takes one of two forms. If x.flags() & ios_base::
boolalpha
is false, the generated
sequence is either 0
(for false) or 1
(for true). Otherwise, the generated sequence is either fac.
falsename
()
(for
false), or fac.
truename
()
(for true).