# std::moneypunct< CharT, Intl > Class Template Reference

Facet for formatting data for money amounts. More...

`#include <locale_facets.h>`

Inheritance diagram for std::moneypunct< CharT, Intl >:

[legend]
Collaboration diagram for std::moneypunct< CharT, Intl >:

[legend]
List of all members.

## Public Types

typedef CharT | char_type
| Public typedefs.
typedef basic_string< CharT > | string_type
| Public typedefs.

## Public Member Functions

| moneypunct (size_t __refs=0)
| Constructor performs initialization.
| moneypunct (cache_type *cache, size_t __refs=0)
| Constructor performs initialization.
| moneypunct (c_locale cloc, const char *s, size_t __refs=0)
| Internal constructor. Not for general use.
char_type | decimal_point () const
| Return decimal point character.
char_type | thousands_sep () const
| Return thousands separator character.
string | grouping () const
| Return grouping specification.
string_type | curr_symbol () const
| Return currency symbol string.
string_type | positive_sign () const
| Return positive sign string.
string_type | negative_sign () const
| Return negative sign string.
int | frac_digits () const
| Return number of digits in fraction.
pattern | pos_format () const
| Return pattern for money values.
pattern | neg_format () const
| Return pattern for money values.

## Static Public Attributes

const bool | intl
| This value is provided by the standard, but no reason for its existence.
locale::id | id
| Numpunct facet id.

## Protected Member Functions

virtual | ~moneypunct ()
| Destructor.
virtual char_type | do_decimal_point () const
| Return decimal point character.
virtual char_type | do_thousands_sep () const
| Return thousands separator character.
virtual string | do_grouping () const
| Return grouping specification.
virtual string_type | do_curr_symbol () const
| Return currency symbol string.
virtual string_type | do_positive_sign () const
| Return positive sign string.
virtual string_type | do_negative_sign () const
| Return negative sign string.
virtual int | do_frac_digits () const
| Return number of digits in fraction.
virtual pattern | do_pos_format () const
| Return pattern for money values.
virtual pattern | do_neg_format () const
| Return pattern for money values.

## Detailed Description

### template<typename CharT, bool Intl>
class std::moneypunct< CharT, Intl >

Facet for formatting data for money amounts.

This facet encapsulates the punctuation, grouping and other formatting features of money amount string representations.

Definition at line 3538 of file locale_facets.h.

## Member Typedef Documentation

template<typename CharT, bool Intl>
typedef CharT std::moneypunct< CharT, Intl >::char_type

| Public typedefs. Definition at line 3544 of file locale_facets.h.

template<typename CharT, bool Intl>
typedef basic_string<CharT> std::moneypunct< CharT, Intl >::string_type

| Public typedefs. Definition at line 3545 of file locale_facets.h.

## Constructor & Destructor Documentation

template<typename CharT, bool Intl>
std::moneypunct< CharT, Intl >::moneypunct | ( | size_t | __refs = `0` | ) | `[inline, explicit]`

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters:

  | refs | Passed to the base facet class.

Definition at line 3567 of file locale_facets.h.

template<typename CharT, bool Intl>
std::moneypunct< CharT, Intl >::moneypunct | ( | cache_type * | cache,
|  | size_t | __refs = `0`
| ) | `[inline, explicit]`

Constructor performs initialization.

This is an internal constructor.

Parameters:

  | cache | Cache for optimization.
  | refs | Passed to the base facet class.

Definition at line 3579 of file locale_facets.h.

template<typename CharT, bool Intl>
std::moneypunct< CharT, Intl >::moneypunct | ( | c_locale | cloc,
|  | const char * | s,
|  | size_t | __refs = `0`
| ) | `[inline, explicit]`

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters:

  | cloc | The "C" locale.
  | s | The name of a locale.
  | refs | Passed to the base facet class.

Definition at line 3594 of file locale_facets.h.

std::moneypunct<>::~moneypunct | ( |  | ) | `[protected, virtual]`

| Destructor.

## Member Function Documentation

template<typename CharT, bool Intl>
string_type std::moneypunct< CharT, Intl >::curr_symbol | ( |  | ) | const`[inline]`

Return currency symbol string.

This function returns a string_type to use as a currency symbol. It does so by returning returning moneypunct<char_type>::do_curr_symbol().

Returns:
  string_type representing a currency symbol.

Definition at line 3663 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_curr_symbol().

template<typename CharT, bool Intl>
char_type std::moneypunct< CharT, Intl >::decimal_point | ( |  | ) | const`[inline]`

Return decimal point character.

This function returns a char_type to use as a decimal point. It does so by returning returning moneypunct<char_type>::do_decimal_point().

Returns:
  char_type representing a decimal point.

Definition at line 3608 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_decimal_point().

template<typename CharT, bool Intl>
virtual string_type std::moneypunct< CharT, Intl >::do_curr_symbol | ( |  | ) | const`[inline, protected, virtual]`

Return currency symbol string.

This function returns a string_type to use as a currency symbol. This function is a hook for derived classes to change the value returned.

See also:
  curr_symbol() for details.

Returns:
  string_type representing a currency symbol.

Definition at line 3808 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::curr_symbol().

template<typename CharT, bool Intl>
virtual char_type std::moneypunct< CharT, Intl >::do_decimal_point | ( |  | ) | const`[inline, protected, virtual]`

Return decimal point character.

Returns a char_type to use as a decimal point. This function is a hook for derived classes to change the value returned.

Returns:
  char_type representing a decimal point.

Definition at line 3770 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::decimal_point().

template<typename CharT, bool Intl>
virtual int std::moneypunct< CharT, Intl >::do_frac_digits | ( |  | ) | const`[inline, protected, virtual]`

Return number of digits in fraction.

This function returns the exact number of digits that make up the fractional part of a money amount. This function is a hook for derived classes to change the value returned.

See also:
  frac_digits() for details.

Returns:
  Number of digits in amount fraction.

Definition at line 3848 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::frac_digits().

template<typename CharT, bool Intl>
virtual string std::moneypunct< CharT, Intl >::do_grouping | ( |  | ) | const`[inline, protected, virtual]`

Return grouping specification.

Returns a string representing groupings for the integer part of a number. This function is a hook for derived classes to change the value returned.

See also:
  grouping() for details.

Returns:
  String representing grouping specification.

Definition at line 3795 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::grouping().

template<typename CharT, bool Intl>
virtual pattern std::moneypunct< CharT, Intl >::do_neg_format | ( |  | ) | const`[inline, protected, virtual]`

Return pattern for money values.

This function returns a pattern describing the formatting of a negative valued money amount. This function is a hook for derived classes to change the value returned.

See also:
  neg_format() for details.

Returns:
  Pattern for money values.

Definition at line 3876 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::neg_format().

template<typename CharT, bool Intl>
virtual string_type std::moneypunct< CharT, Intl >::do_negative_sign | ( |  | ) | const`[inline, protected, virtual]`

Return negative sign string.

This function returns a string_type to use as a sign for negative amounts. This function is a hook for derived classes to change the value returned.

See also:
  negative_sign() for details.

Returns:
  string_type representing a negative sign.

Definition at line 3834 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::negative_sign().

template<typename CharT, bool Intl>
virtual pattern std::moneypunct< CharT, Intl >::do_pos_format | ( |  | ) | const`[inline, protected, virtual]`

Return pattern for money values.

This function returns a pattern describing the formatting of a positive valued money amount. This function is a hook for derived classes to change the value returned.

See also:
  pos_format() for details.

Returns:
  Pattern for money values.

Definition at line 3862 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::pos_format().

template<typename CharT, bool Intl>
virtual string_type std::moneypunct< CharT, Intl >::do_positive_sign | ( |  | ) | const`[inline, protected, virtual]`

Return positive sign string.

This function returns a string_type to use as a sign for positive amounts. This function is a hook for derived classes to change the value returned.

See also:
  positive_sign() for details.

Returns:
  string_type representing a positive sign.

Definition at line 3821 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::positive_sign().

template<typename CharT, bool Intl>
virtual char_type std::moneypunct< CharT, Intl >::do_thousands_sep | ( |  | ) | const`[inline, protected, virtual]`

Return thousands separator character.

Returns a char_type to use as a thousands separator. This function is a hook for derived classes to change the value returned.

Returns:
  char_type representing a thousands separator.

Definition at line 3782 of file locale_facets.h.

Referenced by std::moneypunct< CharT, Intl >::thousands_sep().

template<typename CharT, bool Intl>
int std::moneypunct< CharT, Intl >::frac_digits | ( |  | ) | const`[inline]`

Return number of digits in fraction.

This function returns the exact number of digits that make up the fractional part of a money amount. It does so by returning returning moneypunct<char_type>::do_frac_digits().

The fractional part of a money amount is optional. But if it is present, there must be frac_digits() digits.

Returns:
  Number of digits in amount fraction.

Definition at line 3713 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_frac_digits().

template<typename CharT, bool Intl>
string std::moneypunct< CharT, Intl >::grouping | ( |  | ) | const`[inline]`

Return grouping specification.

This function returns a string representing groupings for the integer part of an amount. Groupings indicate where thousands separators should be inserted.

Each char in the return string is interpret as an integer rather than a character. These numbers represent the number of digits in a group. The first char in the string represents the number of digits in the least significant group. If a char is negative, it indicates an unlimited number of digits for the group. If more chars from the string are required to group a number, the last char is used repeatedly.

For example, if the grouping() returns "\003\002" and is applied to the number 123456789, this corresponds to 12,34,56,789. Note that if the string was "32", this would put more than 50 digits into the least significant group if the character set is ASCII.

The string is returned by calling moneypunct<char_type>::do_grouping().

Returns:
  string representing grouping specification.

Definition at line 3650 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_grouping().

template<typename CharT, bool Intl>
pattern std::moneypunct< CharT, Intl >::neg_format | ( |  | ) | const`[inline]`

Return pattern for money values.

This function returns a pattern describing the formatting of a positive or negative valued money amount. It does so by returning returning moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format().

The pattern has 4 fields describing the ordering of symbol, sign, value, and none or space. There must be one of each in the pattern. The none and space enums may not appear in the first field and space may not appear in the final field.

The parts of a money string must appear in the order indicated by the fields of the pattern. The symbol field indicates that the value of curr_symbol() may be present. The sign field indicates that the value of positive_sign() or negative_sign() must be present. The value field indicates that the absolute value of the money amount is present. none indicates 0 or more whitespace characters, except at the end, where it permits no whitespace. space indicates that 1 or more whitespace characters must be present.

For example, for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() == '+', and value 10.01, and options set to force the symbol, the corresponding string is "$+10.01".

Returns:
  Pattern for money values.

Definition at line 3752 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_neg_format().

template<typename CharT, bool Intl>
string_type std::moneypunct< CharT, Intl >::negative_sign | ( |  | ) | const`[inline]`

Return negative sign string.

This function returns a string_type to use as a sign for negative amounts. It does so by returning returning moneypunct<char_type>::do_negative_sign().

If the return value contains more than one character, the first character appears in the position indicated by neg_format() and the remainder appear at the end of the formatted string.

Returns:
  string_type representing a negative sign.

Definition at line 3697 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_negative_sign().

template<typename CharT, bool Intl>
pattern std::moneypunct< CharT, Intl >::pos_format | ( |  | ) | const`[inline]`

Return pattern for money values.

This function returns a pattern describing the formatting of a positive or negative valued money amount. It does so by returning returning moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format().

The pattern has 4 fields describing the ordering of symbol, sign, value, and none or space. There must be one of each in the pattern. The none and space enums may not appear in the first field and space may not appear in the final field.

The parts of a money string must appear in the order indicated by the fields of the pattern. The symbol field indicates that the value of curr_symbol() may be present. The sign field indicates that the value of positive_sign() or negative_sign() must be present. The value field indicates that the absolute value of the money amount is present. none indicates 0 or more whitespace characters, except at the end, where it permits no whitespace. space indicates that 1 or more whitespace characters must be present.

For example, for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() == '+', and value 10.01, and options set to force the symbol, the corresponding string is "$+10.01".

Returns:
  Pattern for money values.

Definition at line 3748 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_pos_format().

template<typename CharT, bool Intl>
string_type std::moneypunct< CharT, Intl >::positive_sign | ( |  | ) | const`[inline]`

Return positive sign string.

This function returns a string_type to use as a sign for positive amounts. It does so by returning returning moneypunct<char_type>::do_positive_sign().

If the return value contains more than one character, the first character appears in the position indicated by pos_format() and the remainder appear at the end of the formatted string.

Returns:
  string_type representing a positive sign.

Definition at line 3680 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_positive_sign().

template<typename CharT, bool Intl>
char_type std::moneypunct< CharT, Intl >::thousands_sep | ( |  | ) | const`[inline]`

Return thousands separator character.

This function returns a char_type to use as a thousands separator. It does so by returning returning moneypunct<char_type>::do_thousands_sep().

Returns:
  char_type representing a thousands separator.

Definition at line 3621 of file locale_facets.h.

References std::moneypunct< CharT, Intl >::do_thousands_sep().

## Member Data Documentation

template<typename CharT, bool Intl>
locale::id std::moneypunct< CharT, Intl >::id`[static]`

| Numpunct facet id. Definition at line 3886 of file locale_facets.h.

template<typename CharT, bool Intl>
const bool std::moneypunct< CharT, Intl >::intl`[static]`

| This value is provided by the standard, but no reason for its existence. Definition at line 3889 of file locale_facets.h.

The documentation for this class was generated from the following file:

- locale_facets.h