89 lines
3.2 KiB
Markdown
89 lines
3.2 KiB
Markdown
[locale.money.put.virtuals]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.3 Localization library [[localization]](localization#locale.money.put.virtuals)
|
||
|
||
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.money.put.virtuals)
|
||
|
||
#### 28.3.4.7 The monetary category [[category.monetary]](category.monetary#locale.money.put.virtuals)
|
||
|
||
#### 28.3.4.7.3 Class template money_put [[locale.money.put]](locale.money.put#virtuals)
|
||
|
||
#### 28.3.4.7.3.3 Virtual functions [locale.money.put.virtuals]
|
||
|
||
[ð](#lib:money_put,do_put)
|
||
|
||
`iter_type do_put(iter_type s, bool intl, ios_base& str,
|
||
char_type fill, long double units) const;
|
||
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
||
char_type fill, const string_type& digits) const;
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4356)
|
||
|
||
*Effects*: Writes characters to s according to
|
||
the format specified by
|
||
a moneypunct<charT, Intl> facet reference mp and
|
||
the character mapping specified by
|
||
a ctype<charT> facet reference ct obtained from the locale returned by str.getloc(),
|
||
and str.flags()[.](#1.sentence-1)
|
||
|
||
The argument units is transformed into
|
||
a sequence of wide characters as if byct.widen(buf1, buf1 + sprintf(buf1, "%.0Lf", units), buf2) for character buffers buf1 and buf2[.](#1.sentence-2)
|
||
|
||
If the first character in digits or buf2 is equal to ct.widen('-'),
|
||
then the pattern used for formatting is the result of mp.neg_format();
|
||
otherwise the pattern is the result of mp.pos_format()[.](#1.sentence-3)
|
||
|
||
Digit characters are written,
|
||
interspersed with any thousands separators and decimal point
|
||
specified by the format,
|
||
in the order they appear (after the optional leading minus sign) indigits or buf2[.](#1.sentence-4)
|
||
|
||
In digits,
|
||
only the optional leading minus sign and
|
||
the immediately subsequent digit characters
|
||
(as classified according to ct)
|
||
are used;
|
||
any trailing characters
|
||
(including digits appearing after a non-digit character)
|
||
are ignored[.](#1.sentence-5)
|
||
|
||
Calls str.width(0)[.](#1.sentence-6)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4390)
|
||
|
||
*Returns*: An iterator pointing immediately after the last character produced[.](#2.sentence-1)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4394)
|
||
|
||
*Remarks*: The currency symbol is generated
|
||
if and only if (str.flags() & str.showbase) is nonzero[.](#3.sentence-1)
|
||
|
||
If the number of characters generated for the specified format
|
||
is less than the value returned by str.width() on entry to the function,
|
||
then copies of fill are inserted as necessary
|
||
to pad to the specified width[.](#3.sentence-2)
|
||
|
||
For the value af equal to (str.flags() & str.adjustfield),
|
||
if (af == str.internal) is true,
|
||
the fill characters are placed
|
||
where none or space appears in the formatting pattern;
|
||
otherwise if (af == str.left) is true,
|
||
they are placed after the other characters;
|
||
otherwise, they are placed before the other characters[.](#3.sentence-3)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
It is possible, with some combinations of format patterns and flag values,
|
||
to produce output that cannot be parsed using num_get<>::get[.](#3.sentence-4)
|
||
|
||
â *end note*]
|