std::moneypunct (3) - Linux Manuals

std::moneypunct: std::moneypunct


std::moneypunct - std::moneypunct


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
Four standalone (locale-independent) specializations are provided by the standard library:

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

In addition, every locale object constructed in a C++ program implements its own (locale-specific) versions of these specializations.

Member types

Member type Definition
char_type CharT
string_type std::basic_string<CharT>

Member functions

              constructs a new moneypunct facet
constructor (public member function)
              destructs a moneypunct facet
destructor (protected member function)
              invokes do_decimal_point
decimal_point (public member function)
              invokes do_thousands_sep
thousands_sep (public member function)
              invokes do_grouping
grouping (public member function)
              invokes do_curr_symbol
curr_symbol (public member function)
              invokes do_positive_sign or do_negative_sign
positive_sign (public member function)
              invokes do_frac_digits
frac_digits (public member function)
              invokes do_pos_format/do_neg_format
pos_format (public member function)

Protected member functions

do_decimal_point provides the character to use as decimal point
                 (virtual protected member function)

do_thousands_sep provides the character to use as thousands separator
                 (virtual protected member function)

do_grouping provides the numbers of digits between each pair of thousands separators
                 (virtual protected member function)

do_curr_symbol provides the string to use as the currency identifier
                 (virtual protected member function)

do_positive_sign provides the string to indicate a positive or negative value
do_negative_sign (virtual protected member function)


do_frac_digits provides the number of digits to display after the decimal point
                 (virtual protected member function)

do_pos_format provides the formatting pattern for currency values
do_neg_format (virtual protected member function)


Member constants

Member Definition
const bool intl (static) International

Member objects

                          id of the locale
static std::locale::id id (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 moneypunct::curr_symbol is required
sign the first of the characters returned by moneypunct::positive_sign or moneypunct::negative_sign is required
value the absolute numeric monetary value is required

See also

                  defines monetary formatting patterns
money_base (class)
                  represents the system-supplied std::moneypunct for the named locale
moneypunct_byname (class template)
                  parses and constructs a monetary value from an input character sequence
money_get (class template)
                  formats a monetary value for output as a character sequence
money_put (class template)