579 lines
25 KiB
Markdown
579 lines
25 KiB
Markdown
[category.monetary]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.3 Localization library [[localization]](localization#category.monetary)
|
||
|
||
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#category.monetary)
|
||
|
||
#### 28.3.4.7 The monetary category [category.monetary]
|
||
|
||
#### [28.3.4.7.1](#general) General [[category.monetary.general]](category.monetary.general)
|
||
|
||
[1](#general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4113)
|
||
|
||
These templates handle monetary formats[.](#general-1.sentence-1)
|
||
|
||
A template parameter indicates
|
||
whether local or international monetary formats are to be used[.](#general-1.sentence-2)
|
||
|
||
[2](#general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4118)
|
||
|
||
All specifications of member functions
|
||
for money_put and money_get in the subclauses of [category.monetary] only apply to
|
||
the specializations required in Tables [91](locale.category#tab:locale.category.facets "Table 91: Locale category facets") and [92](locale.category#tab:locale.spec "Table 92: Required specializations") ([[locale.category]](locale.category "28.3.3.1.2.1 Type locale::category"))[.](#general-2.sentence-1)
|
||
|
||
Their members use their ios_base&, ios_base::iostate&,
|
||
and fill arguments as described in [[locale.categories]](locale.categories "28.3.4 Standard locale categories"), and
|
||
the moneypunct<> and ctype<> facets,
|
||
to determine formatting details[.](#general-2.sentence-2)
|
||
|
||
#### [28.3.4.7.2](#locale.money.get) Class template money_get [[locale.money.get]](locale.money.get)
|
||
|
||
#### [28.3.4.7.2.1](#locale.money.get.general) General [[locale.money.get.general]](locale.money.get.general)
|
||
|
||
[ð](#lib:money_get)
|
||
|
||
namespace std {template<class charT, class InputIterator = istreambuf_iterator<charT>>class money_get : public locale::facet {public:using char_type = charT; using iter_type = InputIterator; using string_type = basic_string<charT>; explicit money_get(size_t refs = 0);
|
||
|
||
iter_type get(iter_type s, iter_type end, bool intl,
|
||
ios_base& f, ios_base::iostate& err, long double& units) const;
|
||
iter_type get(iter_type s, iter_type end, bool intl,
|
||
ios_base& f, ios_base::iostate& err,
|
||
string_type& digits) const; static locale::id id; protected:~money_get(); virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
|
||
ios_base::iostate& err, long double& units) const; virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
|
||
ios_base::iostate& err, string_type& digits) const; };}
|
||
|
||
#### [28.3.4.7.2.2](#locale.money.get.members) Members [[locale.money.get.members]](locale.money.get.members)
|
||
|
||
[ð](#lib:money_get,get)
|
||
|
||
`iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
||
ios_base::iostate& err, long double& quant) const;
|
||
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
||
ios_base::iostate& err, string_type& quant) const;
|
||
`
|
||
|
||
[1](#locale.money.get.members-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4175)
|
||
|
||
*Returns*: do_get(s, end, intl, f, err, quant)[.](#locale.money.get.members-1.sentence-1)
|
||
|
||
#### [28.3.4.7.2.3](#locale.money.get.virtuals) Virtual functions [[locale.money.get.virtuals]](locale.money.get.virtuals)
|
||
|
||
[ð](#lib:money_get,do_get)
|
||
|
||
`iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
||
ios_base::iostate& err, long double& units) const;
|
||
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
||
ios_base::iostate& err, string_type& digits) const;
|
||
`
|
||
|
||
[1](#locale.money.get.virtuals-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4191)
|
||
|
||
*Effects*: Reads characters from s to parse and construct a monetary value
|
||
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(), andstr.flags()[.](#locale.money.get.virtuals-1.sentence-1)
|
||
|
||
If a valid sequence is recognized, does not change err;
|
||
otherwise, sets err to (err | str.failbit), or(err | str.failbit | str.eofbit) if no more characters are available,
|
||
and does not change units or digits[.](#locale.money.get.virtuals-1.sentence-2)
|
||
|
||
Uses the pattern returned by mp.neg_format() to parse all values[.](#locale.money.get.virtuals-1.sentence-3)
|
||
|
||
The result is returned as an integral value stored in units or as a sequence of digits possibly preceded by a minus sign
|
||
(as produced by ct.widen(c) where c is '-' or
|
||
in the range from '0' through '9' (inclusive))
|
||
stored in digits[.](#locale.money.get.virtuals-1.sentence-4)
|
||
|
||
[*Example [1](#locale.money.get.virtuals-example-1)*:
|
||
|
||
The sequence $1,056.23 in a common United States locale would yield,
|
||
for units, 105623, or,
|
||
for digits, "105623"[.](#locale.money.get.virtuals-1.sentence-5)
|
||
|
||
â *end example*]
|
||
|
||
If mp.grouping() indicates that no thousands separators are permitted,
|
||
any such characters are not read, and
|
||
parsing is terminated at the point where they first appear[.](#locale.money.get.virtuals-1.sentence-6)
|
||
|
||
Otherwise, thousands separators are optional;
|
||
if present, they are checked for correct placement only after
|
||
all format components have been read[.](#locale.money.get.virtuals-1.sentence-7)
|
||
|
||
[2](#locale.money.get.virtuals-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4223)
|
||
|
||
Where money_base::space or money_base::none appears as the last element in the format pattern,
|
||
no whitespace is consumed[.](#locale.money.get.virtuals-2.sentence-1)
|
||
|
||
Otherwise, where money_base::space appears in any of
|
||
the initial elements of the format pattern,
|
||
at least one whitespace character is required[.](#locale.money.get.virtuals-2.sentence-2)
|
||
|
||
Where money_base::none appears
|
||
in any of the initial elements of the format pattern,
|
||
whitespace is allowed but not required[.](#locale.money.get.virtuals-2.sentence-3)
|
||
|
||
If (str.flags() & str.showbase) is false,
|
||
the currency symbol is optional and
|
||
is consumed only if other characters are needed to complete the format;
|
||
otherwise, the currency symbol is required[.](#locale.money.get.virtuals-2.sentence-4)
|
||
|
||
[3](#locale.money.get.virtuals-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4238)
|
||
|
||
If the first character (if any) in
|
||
the string pos returned by mp.positive_sign() or
|
||
the string neg returned by mp.negative_sign() is recognized in the position indicated by sign in the format pattern,
|
||
it is consumed and
|
||
any remaining characters in the string are required
|
||
after all the other format components[.](#locale.money.get.virtuals-3.sentence-1)
|
||
|
||
[*Example [2](#locale.money.get.virtuals-example-2)*:
|
||
|
||
If showbase is off,
|
||
then for a neg value of "()" and
|
||
a currency symbol of "L",
|
||
in "(100 L)" the "L" is consumed;
|
||
but if neg is "-",
|
||
the "L" in "-100 L" is not consumed[.](#locale.money.get.virtuals-3.sentence-2)
|
||
|
||
â *end example*]
|
||
|
||
If pos or neg is empty,
|
||
the sign component is optional, and
|
||
if no sign is detected,
|
||
the result is given the sign that corresponds to the source of the empty string[.](#locale.money.get.virtuals-3.sentence-3)
|
||
|
||
Otherwise,
|
||
the character in the indicated position must match
|
||
the first character of pos or neg,
|
||
and the result is given the corresponding sign[.](#locale.money.get.virtuals-3.sentence-4)
|
||
|
||
If the first character of pos is equal to
|
||
the first character of neg,
|
||
or if both strings are empty,
|
||
the result is given a positive sign[.](#locale.money.get.virtuals-3.sentence-5)
|
||
|
||
[4](#locale.money.get.virtuals-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4267)
|
||
|
||
Digits in the numeric monetary component are extracted and
|
||
placed in digits, or into a character buffer buf1 for conversion to produce a value for units,
|
||
in the order in which they appear,
|
||
preceded by a minus sign if and only if the result is negative[.](#locale.money.get.virtuals-4.sentence-1)
|
||
|
||
The value units is produced as if by[229](#footnote-229 "The semantics here are different from ct.narrow.")for (int i = 0; i < n; ++i) buf2[i] = src[find(atoms, atoms + sizeof(src), buf1[i]) - atoms];
|
||
buf2[n] = 0;
|
||
sscanf(buf2, "%Lf", &units); where n is the number of characters placed in buf1,buf2 is a character buffer, and
|
||
the values src and atoms are defined as if bystatic const char src[] = "0123456789-";
|
||
charT atoms[sizeof(src)];
|
||
ct.widen(src, src + sizeof(src) - 1, atoms);
|
||
|
||
[5](#locale.money.get.virtuals-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4292)
|
||
|
||
*Returns*: An iterator pointing immediately beyond
|
||
the last character recognized as part of a valid monetary quantity[.](#locale.money.get.virtuals-5.sentence-1)
|
||
|
||
[229)](#footnote-229)[229)](#footnoteref-229)
|
||
|
||
The semantics here are different from ct.narrow[.](#footnote-229.sentence-1)
|
||
|
||
#### [28.3.4.7.3](#locale.money.put) Class template money_put [[locale.money.put]](locale.money.put)
|
||
|
||
#### [28.3.4.7.3.1](#locale.money.put.general) General [[locale.money.put.general]](locale.money.put.general)
|
||
|
||
[ð](#lib:money_put)
|
||
|
||
namespace std {template<class charT, class OutputIterator = ostreambuf_iterator<charT>>class money_put : public locale::facet {public:using char_type = charT; using iter_type = OutputIterator; using string_type = basic_string<charT>; explicit money_put(size_t refs = 0);
|
||
|
||
iter_type put(iter_type s, bool intl, ios_base& f,
|
||
char_type fill, long double units) const;
|
||
iter_type put(iter_type s, bool intl, ios_base& f,
|
||
char_type fill, const string_type& digits) const; static locale::id id; protected:~money_put(); virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill, long double units) const; virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill, const string_type& digits) const; };}
|
||
|
||
#### [28.3.4.7.3.2](#locale.money.put.members) Members [[locale.money.put.members]](locale.money.put.members)
|
||
|
||
[ð](#lib:money_put,put)
|
||
|
||
`iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
|
||
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
|
||
`
|
||
|
||
[1](#locale.money.put.members-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4340)
|
||
|
||
*Returns*: do_put(s, intl, f, fill, quant)[.](#locale.money.put.members-1.sentence-1)
|
||
|
||
#### [28.3.4.7.3.3](#locale.money.put.virtuals) Virtual functions [[locale.money.put.virtuals]](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](#locale.money.put.virtuals-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()[.](#locale.money.put.virtuals-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[.](#locale.money.put.virtuals-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()[.](#locale.money.put.virtuals-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[.](#locale.money.put.virtuals-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[.](#locale.money.put.virtuals-1.sentence-5)
|
||
|
||
Calls str.width(0)[.](#locale.money.put.virtuals-1.sentence-6)
|
||
|
||
[2](#locale.money.put.virtuals-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4390)
|
||
|
||
*Returns*: An iterator pointing immediately after the last character produced[.](#locale.money.put.virtuals-2.sentence-1)
|
||
|
||
[3](#locale.money.put.virtuals-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[.](#locale.money.put.virtuals-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[.](#locale.money.put.virtuals-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[.](#locale.money.put.virtuals-3.sentence-3)
|
||
|
||
[*Note [1](#locale.money.put.virtuals-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[.](#locale.money.put.virtuals-3.sentence-4)
|
||
|
||
â *end note*]
|
||
|
||
#### [28.3.4.7.4](#locale.moneypunct) Class template moneypunct [[locale.moneypunct]](locale.moneypunct)
|
||
|
||
#### [28.3.4.7.4.1](#locale.moneypunct.general) General [[locale.moneypunct.general]](locale.moneypunct.general)
|
||
|
||
[ð](#lib:moneypunct)
|
||
|
||
namespace std {class money_base {public:enum part { none, space, symbol, sign, value }; struct pattern { char field[4]; }; }; template<class charT, bool International = false>class moneypunct : public locale::facet, public money_base {public:using char_type = charT; using string_type = basic_string<charT>; explicit moneypunct(size_t refs = 0);
|
||
|
||
charT decimal_point() const;
|
||
charT thousands_sep() const;
|
||
string grouping() const;
|
||
string_type curr_symbol() const;
|
||
string_type positive_sign() const;
|
||
string_type negative_sign() const; int frac_digits() const;
|
||
pattern pos_format() const;
|
||
pattern neg_format() const; static locale::id id; static const bool intl = International; protected:~moneypunct(); virtual charT do_decimal_point() const; virtual charT do_thousands_sep() const; virtual string do_grouping() const; virtual string_type do_curr_symbol() const; virtual string_type do_positive_sign() const; virtual string_type do_negative_sign() const; virtual int do_frac_digits() const; virtual pattern do_pos_format() const; virtual pattern do_neg_format() const; };}
|
||
|
||
[1](#locale.moneypunct.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4465)
|
||
|
||
The moneypunct<> facet defines monetary formatting parameters
|
||
used by money_get<> and money_put<>[.](#locale.moneypunct.general-1.sentence-1)
|
||
|
||
A monetary format is a sequence of four components,
|
||
specified by a pattern value p,
|
||
such that the part value static_cast<part>(p.field[i]) determines the ith component of the format[.](#locale.moneypunct.general-1.sentence-2)[230](#footnote-230 "An array of char, rather than an array of part, is specified for pattern::field purely for efficiency.")
|
||
|
||
In the field member of a pattern object,
|
||
each value symbol, sign, value, and
|
||
either space or none appears exactly once[.](#locale.moneypunct.general-1.sentence-3)
|
||
|
||
The value none, if present, is not first;
|
||
the value space, if present, is neither first nor last[.](#locale.moneypunct.general-1.sentence-4)
|
||
|
||
[2](#locale.moneypunct.general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4484)
|
||
|
||
Where none or space appears,
|
||
whitespace is permitted in the format,
|
||
except where none appears at the end,
|
||
in which case no whitespace is permitted[.](#locale.moneypunct.general-2.sentence-1)
|
||
|
||
The value space indicates that
|
||
at least one space is required at that position[.](#locale.moneypunct.general-2.sentence-2)
|
||
|
||
Where symbol appears,
|
||
the sequence of characters returned by curr_symbol() is permitted, and
|
||
can be required[.](#locale.moneypunct.general-2.sentence-3)
|
||
|
||
Where sign appears,
|
||
the first (if any) of the sequence of characters returned bypositive_sign() or negative_sign() (respectively as the monetary value is non-negative or negative) is required[.](#locale.moneypunct.general-2.sentence-4)
|
||
|
||
Any remaining characters of the sign sequence are required after
|
||
all other format components[.](#locale.moneypunct.general-2.sentence-5)
|
||
|
||
Where value appears, the absolute numeric monetary value is required[.](#locale.moneypunct.general-2.sentence-6)
|
||
|
||
[3](#locale.moneypunct.general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4502)
|
||
|
||
The format of the numeric monetary value is a decimal number:
|
||
|
||
value :
|
||
units fractionalopt
|
||
decimal-point digits
|
||
|
||
fractional :
|
||
decimal-point digitsopt
|
||
|
||
if frac_digits() returns a positive value, or
|
||
|
||
value :
|
||
units
|
||
|
||
otherwise[.](#locale.moneypunct.general-3.sentence-1)
|
||
|
||
The symbol *decimal-point* indicates the character returned by decimal_point()[.](#locale.moneypunct.general-3.sentence-2)
|
||
|
||
The other symbols are defined as follows:
|
||
|
||
units :
|
||
digits
|
||
digits thousands-sep units
|
||
|
||
digits :
|
||
adigit digitsopt
|
||
|
||
In the syntax specification,
|
||
the symbol *adigit* is any of the values ct.widen(c) for c in the range '0' through '9' (inclusive) andct is a reference of type const ctype<charT>& obtained as described in the definitions
|
||
of money_get<> and money_put<>[.](#locale.moneypunct.general-3.sentence-4)
|
||
|
||
The symbol *thousands-sep* is the character returned by thousands_sep()[.](#locale.moneypunct.general-3.sentence-5)
|
||
|
||
The space character used is the value ct.widen(' ')[.](#locale.moneypunct.general-3.sentence-6)
|
||
|
||
Whitespace characters are those characters c for which ci.is(space, c) returns true[.](#locale.moneypunct.general-3.sentence-7)
|
||
|
||
The number of digits required after the decimal point (if any)
|
||
is exactly the value returned by frac_digits()[.](#locale.moneypunct.general-3.sentence-8)
|
||
|
||
[4](#locale.moneypunct.general-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4548)
|
||
|
||
The placement of thousands-separator characters (if any)
|
||
is determined by the value returned by grouping(),
|
||
defined identically as the member numpunct<>::do_grouping()[.](#locale.moneypunct.general-4.sentence-1)
|
||
|
||
[230)](#footnote-230)[230)](#footnoteref-230)
|
||
|
||
An array of char,
|
||
rather than an array of part,
|
||
is specified for pattern::field purely for efficiency[.](#footnote-230.sentence-1)
|
||
|
||
#### [28.3.4.7.4.2](#locale.moneypunct.members) Members [[locale.moneypunct.members]](locale.moneypunct.members)
|
||
|
||
[ð](#lib:moneypunct,decimal_point)
|
||
|
||
charT decimal_point() const;
|
||
charT thousands_sep() const;
|
||
string grouping() const;
|
||
string_type curr_symbol() const;
|
||
string_type positive_sign() const;
|
||
string_type negative_sign() const;int frac_digits() const;
|
||
pattern pos_format() const;
|
||
pattern neg_format() const;
|
||
|
||
[1](#locale.moneypunct.members-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4576)
|
||
|
||
Each of these functions *F* returns the result of calling the corresponding
|
||
virtual member functiondo_*F*()[.](#locale.moneypunct.members-1.sentence-1)
|
||
|
||
#### [28.3.4.7.4.3](#locale.moneypunct.virtuals) Virtual functions [[locale.moneypunct.virtuals]](locale.moneypunct.virtuals)
|
||
|
||
[ð](#lib:moneypunct,do_decimal_point)
|
||
|
||
`charT do_decimal_point() const;
|
||
`
|
||
|
||
[1](#locale.moneypunct.virtuals-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4590)
|
||
|
||
*Returns*: The radix separator to use
|
||
in case do_frac_digits() is greater than zero[.](#locale.moneypunct.virtuals-1.sentence-1)[231](#footnote-231 "In common U.S. locales this is '.'.")
|
||
|
||
[ð](#lib:moneypunct,do_thousands_sep)
|
||
|
||
`charT do_thousands_sep() const;
|
||
`
|
||
|
||
[2](#locale.moneypunct.virtuals-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4605)
|
||
|
||
*Returns*: The digit group separator to use
|
||
in case do_grouping() specifies a digit grouping pattern[.](#locale.moneypunct.virtuals-2.sentence-1)[232](#footnote-232 "In common U.S. locales this is ','.")
|
||
|
||
[ð](#lib:moneypunct,do_grouping)
|
||
|
||
`string do_grouping() const;
|
||
`
|
||
|
||
[3](#locale.moneypunct.virtuals-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4620)
|
||
|
||
*Returns*: A pattern defined identically as, but not necessarily equal to,
|
||
the result of numpunct<charT>::do_grouping()[.](#locale.moneypunct.virtuals-3.sentence-1)[233](#footnote-233 "To specify grouping by 3s, the value is "\003" not "3".")
|
||
|
||
[ð](#lib:moneypunct,do_curr_symbol)
|
||
|
||
`string_type do_curr_symbol() const;
|
||
`
|
||
|
||
[4](#locale.moneypunct.virtuals-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4636)
|
||
|
||
*Returns*: A string to use as the currency identifier symbol[.](#locale.moneypunct.virtuals-4.sentence-1)
|
||
|
||
[*Note [1](#locale.moneypunct.virtuals-note-1)*:
|
||
|
||
For specializations where the second template parameter is true,
|
||
this is typically four characters long:
|
||
a three-letter code as specified by ISO 4217[[bib]](bibliography#bib:iso4217 "Bibliography") followed by a space[.](#locale.moneypunct.virtuals-4.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
[ð](#lib:moneypunct,do_positive_sign)
|
||
|
||
`string_type do_positive_sign() const;
|
||
string_type do_negative_sign() const;
|
||
`
|
||
|
||
[5](#locale.moneypunct.virtuals-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4655)
|
||
|
||
*Returns*: do_positive_sign() returns the string to use to indicate a positive monetary value;[234](#footnote-234 "This is usually the empty string.")do_negative_sign() returns the string to use to indicate a negative value[.](#locale.moneypunct.virtuals-5.sentence-1)
|
||
|
||
[ð](#lib:moneypunct,do_frac_digits)
|
||
|
||
`int do_frac_digits() const;
|
||
`
|
||
|
||
[6](#locale.moneypunct.virtuals-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4672)
|
||
|
||
*Returns*: The number of digits after the decimal radix separator, if any[.](#locale.moneypunct.virtuals-6.sentence-1)[235](#footnote-235 "In common U.S. locales, this is 2.")
|
||
|
||
[ð](#lib:moneypunct,do_pos_format)
|
||
|
||
`pattern do_pos_format() const;
|
||
pattern do_neg_format() const;
|
||
`
|
||
|
||
[7](#locale.moneypunct.virtuals-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4688)
|
||
|
||
*Returns*: The specializations required in Table [92](locale.category#tab:locale.spec "Table 92: Required specializations") ([[locale.category]](locale.category "28.3.3.1.2.1 Type locale::category")), namely
|
||
|
||
- [(7.1)](#locale.moneypunct.virtuals-7.1)
|
||
|
||
moneypunct<char>,
|
||
|
||
- [(7.2)](#locale.moneypunct.virtuals-7.2)
|
||
|
||
moneypunct<wchar_t>,
|
||
|
||
- [(7.3)](#locale.moneypunct.virtuals-7.3)
|
||
|
||
moneypunct<char, true>, and
|
||
|
||
- [(7.4)](#locale.moneypunct.virtuals-7.4)
|
||
|
||
moneypunct<wchar_t, true>,
|
||
|
||
return an object of type pattern initialized to { symbol, sign, none, value }[.](#locale.moneypunct.virtuals-7.sentence-1)[236](#footnote-236 "Note that the international symbol returned by do_curr_symbol() usually contains a space, itself; for example, "USD ".")
|
||
|
||
[231)](#footnote-231)[231)](#footnoteref-231)
|
||
|
||
In common U.S. locales this is '.'[.](#footnote-231.sentence-1)
|
||
|
||
[232)](#footnote-232)[232)](#footnoteref-232)
|
||
|
||
In common U.S. locales this is ','[.](#footnote-232.sentence-1)
|
||
|
||
[233)](#footnote-233)[233)](#footnoteref-233)
|
||
|
||
To specify grouping by 3s,
|
||
the value is "\003" *not* "3"[.](#footnote-233.sentence-1)
|
||
|
||
[234)](#footnote-234)[234)](#footnoteref-234)
|
||
|
||
This is usually the empty string[.](#footnote-234.sentence-1)
|
||
|
||
[235)](#footnote-235)[235)](#footnoteref-235)
|
||
|
||
In common U.S. locales, this is 2[.](#footnote-235.sentence-1)
|
||
|
||
[236)](#footnote-236)[236)](#footnoteref-236)
|
||
|
||
Note that the international symbol returned by do_curr_symbol() usually contains a space, itself;
|
||
for example, "USD "[.](#footnote-236.sentence-1)
|
||
|
||
#### [28.3.4.7.5](#locale.moneypunct.byname) Class template moneypunct_byname [[locale.moneypunct.byname]](locale.moneypunct.byname)
|
||
|
||
[ð](#lib:moneypunct_byname)
|
||
|
||
namespace std {template<class charT, bool Intl = false>class moneypunct_byname : public moneypunct<charT, Intl> {public:using pattern = money_base::pattern; using string_type = basic_string<charT>; explicit moneypunct_byname(const char*, size_t refs = 0); explicit moneypunct_byname(const string&, size_t refs = 0); protected:~moneypunct_byname(); };}
|