STD::MONEYPUNCT(3cxx)

🌸 NAME 🌸

okay so welcome to the 3cxx manual page for std::moneypunct< _CharT, _Intl > β€” part 1 of 2, bestie, and we are absolutely not done yet. This is the Primary class template moneypunct πŸ’…, and it is literally the main character of money punctuation.


✨ SYNOPSIS ✨

#include <locale>

Inherits std::locale::facet, and std::money_base.

Inherited by std::moneypunct_byname< _CharT, _Intl >.

πŸ’– Public Types πŸ’–

  • enum { _S_minus, _S_zero, _S_end } β€” the little enum trio, exactly as listed.
  • typedef __moneypunct_cache< _CharT, _Intl > __cache_type β€” cache type bestie.
  • enum part { none, space, symbol, sign, value } β€” the part enum, full set of values included.
  • typedef _CharT char_type β€” Public typedefs.
  • typedef basic_string< _CharT > string_type β€” Public typedefs.

🧚 Public Member Functions 🧚

  • moneypunct (__c_locale __cloc, const char *__s, size_t __refs=0) β€” Internal constructor. Not for general use.
  • moneypunct (__cache_type *__cache, size_t __refs=0) β€” Constructor performs initialization.
  • moneypunct (size_t __refs=0) β€” Constructor performs initialization.
  • string_type curr_symbol () const β€” Return currency symbol string.
  • char_type decimal_point () const β€” Return decimal point character.
  • int frac_digits () const β€” Return number of digits in fraction.
  • string grouping () const β€” Return grouping specification.
  • string_type negative_sign () const β€” Return negative sign string.
  • string_type positive_sign () const β€” Return positive sign string.
  • char_type thousands_sep () const β€” Return thousands separator character.
  • pattern pos_format () const β€” Return pattern for money values.
  • pattern neg_format () const β€” Return pattern for money values.

🌈 Static Public Member Functions 🌈

  • static pattern _S_construct_pattern (char __precedes, char __space, char __posn) throw () β€” the static pattern constructor, throw () and all.

πŸ¦‹ Static Public Attributes πŸ¦‹

  • static const char * _S_atoms β€” the atoms pointer.
  • static const pattern _S_default_pattern β€” the default pattern.
  • static locale::id id β€” Numpunct facet id.
  • static const bool intl β€” This value is provided by the standard, but no reason for its existence.

πŸŽ€ Protected Member Functions πŸŽ€

  • virtual ~moneypunct () β€” Destructor.
  • void _M_initialize_moneypunct (__c_locale __cloc=0, const char *__name=0) β€” initialization helper, defaults included.
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” same signature listed again, no cap.
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” and again.
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” and again.
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” and one more time, exactly as the page gives it.
  • virtual string_type do_curr_symbol () const β€” Return currency symbol string.
  • virtual char_type do_decimal_point () const β€” Return decimal point character.
  • virtual int do_frac_digits () const β€” Return number of digits in fraction.
  • virtual string do_grouping () const β€” Return grouping specification.
  • virtual pattern do_neg_format () const β€” Return pattern for money values.
  • virtual string_type do_negative_sign () const β€” Return negative sign string.
  • virtual pattern do_pos_format () const β€” Return pattern for money values.
  • virtual string_type do_positive_sign () const β€” Return positive sign string.
  • virtual char_type do_thousands_sep () const β€” Return thousands separator character.

πŸ’œ Static Protected Member Functions πŸ’œ

  • static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw () β€” clone that C locale.
  • static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0) β€” create that C locale, default __old=0 included.
  • static void _S_destroy_c_locale (__c_locale &__cloc) β€” destroy that C locale.
  • static __c_locale _S_get_c_locale () β€” get that C locale.
  • static const char * _S_get_c_name () throw () β€” get that C name.
  • static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s) β€” the LC_CTYPE C locale helper.

πŸ¦‹ Detailed Description πŸ¦‹

template<typename _CharT, bool _Intl>
class std::moneypunct< _CharT, _Intl >

This is the Primary class template moneypunct. ✨

This facet encapsulates the punctuation, grouping and other formatting features of money amount string representations. It is giving money formatting lore, and we are seated. 🫢


🌸 Member Typedef Documentation 🌸

char_type

template<typename _CharT , bool _Intl> typedef _CharT std::moneypunct<
_CharT, _Intl >::char_type

Public typedefs. simple, iconic, done. πŸ’…

string_type

template<typename _CharT , bool _Intl> typedef basic_string<_CharT>
std::moneypunct< _CharT, _Intl >::string_type

Public typedefs. periodt. πŸŽ€


✨ Constructor & Destructor Documentation ✨

moneypunct (size_t __refs = 0)

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.

moneypunct (__cache_type * __cache, size_t __refs = 0)

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.

moneypunct (__c_locale __cloc, const char * __s, size_t __refs = 0)

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.

~moneypunct ()

template<typename _CharT , bool _Intl> virtual std::moneypunct< _CharT,
_Intl >::~moneypunct () [protected],  [virtual]

Destructor. 🫑


πŸ’– Member Function Documentation πŸ’–

curr_symbol()

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 moneypunct<char_type>::do_curr_symbol().

  • Returns β€” string_type representing a currency symbol.
  • References β€” std::moneypunct< _CharT, _Intl >::do_curr_symbol().

decimal_point()

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 moneypunct<char_type>::do_decimal_point().

  • Returns β€” char_type representing a decimal point.
  • References β€” std::moneypunct< _CharT, _Intl >::do_decimal_point().

do_curr_symbol()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::curr_symbol().

do_decimal_point()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::decimal_point().

do_frac_digits()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::frac_digits().

do_grouping()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::grouping().

do_neg_format()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::neg_format().

do_negative_sign()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::negative_sign().

do_pos_format()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::pos_format().

do_positive_sign()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::positive_sign().

do_thousands_sep()

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.
  • Referenced by β€” std::moneypunct< _CharT, _Intl >::thousands_sep().

πŸ’Έ frac_digits() β€” the fractional digit count πŸ’Έ

template<typename _CharT , bool _Intl> int std::moneypunct< _CharT, _Intl >::frac_digits () const [inline]

This one tells you the exact number of digits that make up the fractional part of a money amount. It gets that info by calling moneypunct<char_type>::do_frac_digits().

The fractional part of a money amount is optional. But if it is there, it must have exactly frac_digits() digits β€” no improvising, bestie 😀.

Returns: number of digits in the amount fraction.

References: std::moneypunct< _CharT, _Intl >::do_frac_digits().


πŸŽ€ grouping() β€” where the thousands separators go πŸŽ€

template<typename _CharT , bool _Intl> string std::moneypunct< _CharT, _Intl >::grouping () const [inline]

Returns a string that represents the groupings for the integer part of an amount. Groupings literally tell you where thousands separators should be inserted, iykyk ✨.

Each char in the returned string is interpreted as an integer, not as a character. Those numbers represent how many digits are in a group. The first char in the string is the number of digits in the least significant group. If a char is negative, it means an unlimited number of digits for that group. If more chars from the string are required to group a number, the last char gets used repeatedly πŸ”.

Example time, because yes: if grouping() returns \003\002 and you apply it to the number 123456789, that 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 the grouping specification.

References: std::moneypunct< _CharT, _Intl >::do_grouping().


πŸ”₯ neg_format() β€” the pattern for negative money values πŸ”₯

template<typename _CharT , bool _Intl> pattern std::moneypunct< _CharT, _Intl >::neg_format () const [inline]

This returns a pattern describing how a positive or negative valued money amount gets formatted. It does that by 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:

  • symbol means the value of curr_symbol() may be present.
  • sign means the value of positive_sign() or negative_sign() must be present.
  • value means the absolute value of the money amount is present.
  • none means 0 or more whitespace characters, except at the end, where it permits no whitespace.
  • space means 1 or more whitespace characters must be present.

Example: for the US locale and pos_format() pattern {symbol,sign,value,none}, with curr_symbol() == '$', positive_sign() == '+', value 10.01, and options set to force the symbol, the corresponding string is $+10.01 πŸ’΅.

Returns: pattern for money values.

References: std::moneypunct< _CharT, _Intl >::do_neg_format().


πŸ™ˆ negative_sign() β€” the string for negative amounts πŸ™ˆ

template<typename _CharT , bool _Intl> string_type std::moneypunct< _CharT, _Intl >::negative_sign () const [inline]

Returns the string_type to use as the sign for negative amounts. It does this by returning moneypunct<char_type>::do_negative_sign().

If the return value has more than one character, the first character appears in the position indicated by neg_format(), and the remainder appears at the end of the formatted string. Cute little sign-string choreography, honestly πŸ’….

Returns: string_type representing a negative sign.

References: std::moneypunct< _CharT, _Intl >::do_negative_sign().


⭐ pos_format() β€” the pattern for positive money values ⭐

template<typename _CharT , bool _Intl> pattern std::moneypunct< _CharT, _Intl >::pos_format () const [inline]

Same pattern energy as neg_format(), bestie: this returns a pattern describing how a positive or negative valued money amount gets formatted. It does this by 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:

  • symbol means the value of curr_symbol() may be present.
  • sign means the value of positive_sign() or negative_sign() must be present.
  • value means the absolute value of the money amount is present.
  • none means 0 or more whitespace characters, except at the end, where it permits no whitespace.
  • space means 1 or more whitespace characters must be present.

Example: for the US locale and pos_format() pattern {symbol,sign,value,none}, with curr_symbol() == '$', positive_sign() == '+', value 10.01, and options set to force the symbol, the corresponding string is $+10.01 πŸ’΅.

Returns: pattern for money values.

References: std::moneypunct< _CharT, _Intl >::do_pos_format().


🫢 positive_sign() β€” the string for positive amounts 🫢

template<typename _CharT , bool _Intl> string_type std::moneypunct< _CharT, _Intl >::positive_sign () const [inline]

Returns the string_type to use as the sign for positive amounts. It does so by 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.

References: std::moneypunct< _CharT, _Intl >::do_positive_sign().


🌸 thousands_sep() β€” the separator character 🌸

template<typename _CharT , bool _Intl> char_type std::moneypunct< _CharT, _Intl >::thousands_sep () const [inline]

Returns the char_type to use as a thousands separator. It gets it by returning moneypunct<char_type>::do_thousands_sep().

Returns: char_type representing a thousands separator.

References: std::moneypunct< _CharT, _Intl >::do_thousands_sep().


πŸ—ƒοΈ Member Data Documentation πŸ—ƒοΈ

πŸ¦‹ id

template<typename _CharT , bool _Intl> locale::id std::moneypunct< _CharT, _Intl >::id [static]

Numpunct facet id. Yes, the docs literally say Numpunct here, and I am not gonna gaslight you about it 😭.

πŸ‘‘

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. The standard really said β€œhere’s a static bool” and then refused to elaborate πŸ’€.


πŸ’– Author πŸ’–

Generated automatically by Doxygen for libstdc++ from the source code.


Mwah πŸ’‹ β€” source/version tea: this page is from libstdc++ with the 3cxx marker, and the footer doesn’t show a separate date in this part, so I’m not inventing one, bestie 🌈. Generated by Doxygen, slaying automatically, periodt 🫢.

πŸ“¦ where this page comes from