Difference between revisions of "cpp/locale/moneypunct"
From cppreference.com
(-example (it was purely a curr_symbol example)) |
Andreas Krug (Talk | contribs) m (fmt) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | {{cpp/title | moneypunct}} | + | {{cpp/title|moneypunct}} |
{{cpp/locale/moneypunct/navbar}} | {{cpp/locale/moneypunct/navbar}} | ||
{{dcl begin}} | {{dcl begin}} | ||
− | {{dcl header | locale}} | + | {{dcl header|locale}} |
− | {{dcl | 1= | + | {{dcl|1= |
template< class CharT, bool International = false > | template< class CharT, bool International = false > | ||
class moneypunct; | class moneypunct; | ||
Line 9: | Line 9: | ||
{{dcl end}} | {{dcl end}} | ||
− | The facet {{ | + | The facet {{tt|std::moneypunct}} encapsulates monetary value format preferences. Stream I/O manipulators {{lc|std::get_money}} and {{lc|std::put_money}} use {{tt|std::moneypunct}} through {{lc|std::money_get}} and {{lc|std::money_put}} for parsing monetary value input and formatting monetary value output. |
{{inheritance diagram/std-moneypunct}} | {{inheritance diagram/std-moneypunct}} | ||
− | + | ===Specializations=== | |
− | + | The standard library is guaranteed to provide the following specializations (they are {{rlp|locale|required to be implemented by any locale object}}): | |
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc header | locale }} | + | {{dsc header|locale}} |
− | {{dsc | {{c|std::moneypunct<char>}} | + | {{dsc|{{c/core|std::moneypunct<char>}}|provides equivalents of the "C" locale preferences}} |
− | {{dsc | {{c|std::moneypunct<wchar_t>}} | + | {{dsc|{{c/core|std::moneypunct<wchar_t>}}|provides wide character equivalents of the "C" locale preferences}} |
− | {{dsc | {{c|std::moneypunct<char, true>}} | + | {{dsc|{{c/core|std::moneypunct<char, true>}}|provides equivalents of the "C" locale preferences, with international currency symbols}} |
− | {{dsc | {{c|std::moneypunct<wchar_t, true>}} | provides wide character equivalents of the "C" locale preferences, with international currency symbols }} | + | {{dsc|{{c/core|std::moneypunct<wchar_t, true>}}|provides wide character equivalents of the "C" locale preferences, with international currency symbols}} |
{{dsc end}} | {{dsc end}} | ||
===Member types=== | ===Member types=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc hitem | Member type | Definition}} | + | {{dsc hitem|Member type|Definition}} |
− | {{dsc | {{tt|char_type}} | {{tt|CharT}}}} | + | {{dsc|{{tt|char_type}}|{{tt|CharT}}}} |
− | {{dsc | {{tt|string_type}} | {{c|std::basic_string<CharT>}}}} | + | {{dsc|{{tt|string_type}}|{{c/core|std::basic_string<CharT>}}}} |
{{dsc end}} | {{dsc end}} | ||
===Member functions=== | ===Member functions=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/locale/moneypunct/dsc constructor | + | {{dsc inc|cpp/locale/moneypunct/dsc constructor}} |
− | + | {{dsc inc|cpp/locale/moneypunct/dsc decimal_point}} | |
− | {{dsc inc | cpp/locale/moneypunct/dsc decimal_point}} | + | {{dsc inc|cpp/locale/moneypunct/dsc thousands_sep}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc thousands_sep}} | + | {{dsc inc|cpp/locale/moneypunct/dsc grouping}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc grouping}} | + | {{dsc inc|cpp/locale/moneypunct/dsc curr_symbol}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc curr_symbol}} | + | {{dsc inc|cpp/locale/moneypunct/dsc positive_sign}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc positive_sign | + | {{dsc inc|cpp/locale/moneypunct/dsc frac_digits}} |
− | + | {{dsc inc|cpp/locale/moneypunct/dsc pos_format}} | |
− | {{dsc inc | cpp/locale/moneypunct/dsc frac_digits}} | + | |
− | {{dsc inc | cpp/locale/moneypunct/dsc pos_format | + | |
− | + | ||
{{dsc end}} | {{dsc end}} | ||
===Protected member functions=== | ===Protected member functions=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/locale/moneypunct/dsc | + | {{dsc inc|cpp/locale/moneypunct/dsc destructor}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc | + | {{dsc inc|cpp/locale/moneypunct/dsc do_decimal_point}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc | + | {{dsc inc|cpp/locale/moneypunct/dsc do_thousands_sep}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc | + | {{dsc inc|cpp/locale/moneypunct/dsc do_grouping}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc | + | {{dsc inc|cpp/locale/moneypunct/dsc do_curr_symbol}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc | + | {{dsc inc|cpp/locale/moneypunct/dsc do_positive_sign}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc do_frac_digits}} | + | {{dsc inc|cpp/locale/moneypunct/dsc do_frac_digits}} |
− | {{dsc inc | cpp/locale/moneypunct/dsc do_pos_format | + | {{dsc inc|cpp/locale/moneypunct/dsc do_pos_format}} |
− | + | ||
{{dsc end}} | {{dsc end}} | ||
===Member constants=== | ===Member constants=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc hitem | Member | Definition}} | + | {{dsc hitem|Member|Definition}} |
− | {{dsc | {{dsc small|const bool}} {{tt|intl}} {{mark|static}} | {{tt|International}} }} | + | {{dsc|{{dsc small|const bool}} {{tt|intl}} {{mark|static}}|{{tt|International}}}} |
{{dsc end}} | {{dsc end}} | ||
===Member objects=== | ===Member objects=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc mem obj | nolink=true | {{dsc small|static std::locale::id}} id | ''id'' of the locale }} | + | {{dsc mem obj|nolink=true|{{dsc small|static std::locale::id}} id|''id'' of the locale}} |
{{dsc end}} | {{dsc end}} | ||
− | {{include | cpp/locale/money_base/inherit}} | + | {{include|cpp/locale/money_base/inherit}} |
===See also=== | ===See also=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/locale/dsc money_base}} | + | {{dsc inc|cpp/locale/dsc money_base}} |
− | {{dsc inc | cpp/locale/dsc moneypunct_byname}} | + | {{dsc inc|cpp/locale/dsc moneypunct_byname}} |
− | {{dsc inc | cpp/locale/dsc money_get}} | + | {{dsc inc|cpp/locale/dsc money_get}} |
− | {{dsc inc | cpp/locale/dsc money_put}} | + | {{dsc inc|cpp/locale/dsc money_put}} |
{{dsc end}} | {{dsc end}} | ||
− | + | {{langlinks|de|es|fr|it|ja|pt|ru|zh}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 01:27, 13 December 2023
Defined in header <locale>
|
||
template< class CharT, bool International = false > class moneypunct; |
||
The facet std::moneypunct
encapsulates monetary value format preferences. Stream I/O manipulators std::get_money and std::put_money use std::moneypunct
through std::money_get and std::money_put for parsing monetary value input and formatting monetary value output.
Inheritance diagram
Contents |
[edit] Specializations
The standard library is guaranteed to provide the following specializations (they are required to be implemented by any locale object):
Defined in header
<locale> | |
std::moneypunct<char> | provides equivalents of the "C" locale preferences |
std::moneypunct<wchar_t> | provides wide character equivalents of the "C" locale preferences |
std::moneypunct<char, true> | provides equivalents of the "C" locale preferences, with international currency symbols |
std::moneypunct<wchar_t, true> | provides wide character equivalents of the "C" locale preferences, with international currency symbols |
[edit] Member types
Member type | Definition |
char_type
|
CharT
|
string_type
|
std::basic_string<CharT> |
[edit] Member functions
constructs a new moneypunct facet (public member function) | |
invokes do_decimal_point (public member function) | |
invokes do_thousands_sep (public member function) | |
invokes do_grouping (public member function) | |
invokes do_curr_symbol (public member function) | |
invokes do_positive_sign or do_negative_sign (public member function) | |
invokes do_frac_digits (public member function) | |
invokes do_pos_format /do_neg_format (public member function) |
[edit] Protected member functions
destructs a moneypunct facet (protected member function) | |
[virtual] |
provides the character to use as decimal point (virtual protected member function) |
[virtual] |
provides the character to use as thousands separator (virtual protected member function) |
[virtual] |
provides the numbers of digits between each pair of thousands separators (virtual protected member function) |
[virtual] |
provides the string to use as the currency identifier (virtual protected member function) |
[virtual] |
provides the string to indicate a positive or negative value (virtual protected member function) |
[virtual] |
provides the number of digits to display after the decimal point (virtual protected member function) |
[virtual] |
provides the formatting pattern for currency values (virtual protected member function) |
[edit] Member constants
Member | Definition |
const bool intl (static)
|
International
|
[edit] Member objects
static std::locale::id id |
id of the locale (public member object) |
Inherited from std::money_base
Member type | Definition |
enum part { none, space, symbol, sign, value }; | unscoped enumeration type |
struct pattern { char field[4]; }; | the monetary format type |
Enumeration constant | Definition |
none
|
whitespace is permitted but not required except in the last position, where whitespace is not permitted |
space
|
one or more whitespace characters are required |
symbol
|
the sequence of characters returned by std::moneypunct::curr_symbol is required |
sign
|
the first of the characters returned by std::moneypunct::positive_sign or std::moneypunct::negative_sign is required |
value
|
the absolute numeric monetary value is required |
[edit] See also
defines monetary formatting patterns (class) | |
represents the system-supplied std::moneypunct for the named locale (class template) | |
parses and constructs a monetary value from an input character sequence (class template) | |
formats a monetary value for output as a character sequence (class template) |