STD::MONEYPUNCT_BYNAME(3cxx)

πŸ’– std::moneypunct_byname< _CharT, _Intl > β€” class moneypunct_byname [22.2.6.4] πŸ’–

okay bestie, listen up, because we are about to get deep into the <locale> docs and honestly? it's giving "niche but iconic." no cap, this is the manual page for std::moneypunct_byname< _CharT, _Intl >, and i'm gonna walk you through every single thing on here so you don't miss a crumb. πŸ“


🌸 SYNOPSIS 🌸

#include <locale>

Inherits std::moneypunct< _CharT, _Intl >. periodt, that's the family tree, she's a derived class and she knows it. πŸ’…


✨ Public Types ✨

  • enum { _S_minus, _S_zero, _S_end } β€” the little internal enum, keep it close.
  • typedef __moneypunct_cache< _CharT, _Intl > __cache_type β€” her cache type, the backbone, the storage bestie.
  • typedef _CharT char_type β€” the character type, literally the building block of everything here.
  • enum part { none, space, symbol, sign, value } β€” the parts of a money pattern, so you can describe where each bit goes.
  • typedef basic_string< _CharT > string_type β€” the string type, she's a whole vibe.

πŸŽ€ Public Member Functions πŸŽ€

  • moneypunct_byname (const char *__s, size_t __refs=0) β€” the constructor, takes a C-string name and a ref count defaulting to 0.
  • moneypunct_byname (const string &__s, size_t __refs=0) β€” the other constructor, takes a string name, ref count still 0.
  • string_type curr_symbol () const β€” Return currency symbol string. (we stan a currency icon πŸ’°)
  • 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 () β€” static helper, builds the pattern, throws nothing (those empty parens after throw are doing their thing).

πŸ¦‹ Static Public Attributes πŸ¦‹

  • static const char * _S_atoms β€” the atoms, static and const, living her truth.
  • static const pattern _S_default_pattern β€” the default pattern, also static, also const.
  • static locale::id id β€” Numpunct facet id. (yes, the manpage says "Numpunct," that's exactly what it says, we're not fixing it, that's canon. πŸ™ˆ)
  • static const bool intl β€” international flag, static const bool, no notes.

🧚 Protected Member Functions 🧚

  • void _M_initialize_moneypunct (__c_locale __cloc=0, const char *__name=0) β€” init helper, with __cloc defaulting to 0 and __name defaulting to 0.
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” another overload, same name, just locale and name.
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” yes, again, this list literally repeats it, we're keeping every single one because every detail matters. πŸ’–
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” still here, still iconic.
  • void _M_initialize_moneypunct (__c_locale, const char *) β€” and one more, because the original says so, and we don't skip.
  • 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, throws nothing, takes a reference.
  • static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0) β€” creates a C locale from a string __s, with __old defaulting to 0.
  • static void _S_destroy_c_locale (__c_locale &__cloc) β€” destroys it, bye bestie πŸ‘‹
  • static __c_locale _S_get_c_locale () β€” gets the C locale, no args, just vibes.
  • static const char * _S_get_c_name () throw () β€” gets the C name, static const char ptr, throws nothing.
  • static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s) β€” the LC_CTYPE locale helper, takes a locale and a name.

✨ DESCRIPTION ✨

template<typename _CharT, bool _Intl> class std::moneypunct_byname< _CharT, _Intl > "class moneypunct_byname [22.2.6.4]."

basically, bestie, this is the named-locale version of moneypunct β€” you give it a locale name in the constructor and it pulls all the money-formatting details from that locale. she's the "byname" queen, and she's serving inherited functionality with a whole lot of hooks for derived classes. πŸ‘‘


πŸ”₯ Member Function Documentation πŸ”₯

πŸ’° curr_symbol πŸ’°

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

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(). (yes, "returning returning," the manpage said it twice, we're preserving that energy, it's part of the lore. πŸ’€)

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], [inherited]

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.

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], [inherited]

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], [inherited]

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], [inherited]

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], [inherited]

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], [inherited]

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], [inherited]

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], [inherited]

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], [inherited]

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], [inherited]

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().


(part 1 done bestie, but hold on β€” more is coming, don't go anywhere πŸ’–)

So yeah β€” the pattern has 4 fields and they describe the ordering of symbol, sign, value, and none or space. There has to be exactly one of each in the pattern, no skipping, no doubling up πŸ’…. And heads up: the none and space enums may not appear in the first field, and space may not appear in the final field. That's the rule, bestie.

The parts of a money string have to show up in the order the pattern's fields say. Here's the tea on what each field means:

  • The symbol field = the value of curr_symbol() may be present.
  • The sign field = the value of positive_sign() or negative_sign() must be present.
  • The value field = the absolute value of the money amount is present.
  • none = 0 or more whitespace characters, except at the end, where it permits no whitespace.
  • space = 1 or more whitespace characters must be present.
Example time, because ngl this is the part that makes it click: for the US locale and the 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. Cute, right? ✨

Returns Pattern for money values.

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


πŸ¦‹ negative_sign()

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

Return negative sign string 🫢. This one hands you a string_type to use as the sign for negative amounts, and it does that by returning moneypunct<char_type>::do_negative_sign().

Real talk though: 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. So like, it splits. Keep that in mind, iykyk.

Returns string_type representing a negative sign.

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


🌸 pos_format()

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

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 moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format().

Okay so, same deal as before β€” 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. No cap, those are hard constraints.

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.
Same iconic example: for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$', positive_sign() == '+', and value 10.01, with 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()

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

Return positive sign string πŸ‘‘. Gives you a string_type to use as a sign for positive amounts, by returning moneypunct<char_type>::do_positive_sign().

And fr fr, same multi-character situation: 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()

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

Return thousands separator character 🧚. This one gives you a char_type to use as a thousands separator, and it does that by returning moneypunct<char_type>::do_thousands_sep(). That's literally it, she's simple and she slays.

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], [inherited]

Numpunct facet id. (Yes, that's what it says β€” iconic little naming moment, we don't question it πŸ’€)


πŸ¦‹ Author πŸ¦‹

Generated automatically by Doxygen for libstdc++ from the source code. Not me writing love letters, just Doxygen doing its thing πŸ™ˆ.


And that's the whole page, bestie! 🌈 This little beauty is the libstdc++ man page for std::moneypunct< _CharT, _Intl >, living in section 3cxx β€” auto-generated from the source code, so go thank the source code (and Doxygen) next time your money formatting looks correct πŸ’–βœ¨ 🫢

πŸ“¦ where this page comes from