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 to0.moneypunct_byname (const string &__s, size_t __refs=0)β the other constructor, takes astringname, ref count still0.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 afterthroware 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__clocdefaulting to0and__namedefaulting to0.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__olddefaulting to0.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)β theLC_CTYPElocale 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()ornegative_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 thepos_format()pattern{symbol,sign,value,none}, withcurr_symbol() == '$',positive_sign() == '+', value10.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()ornegative_sign()must be present. - The value field indicates that the absolute value of the money amount is present.
noneindicates 0 or more whitespace characters, except at the end, where it permits no whitespace.spaceindicates that 1 or more whitespace characters must be present.
Same iconic example: for the US locale andpos_format()pattern{symbol,sign,value,none},curr_symbol() == '$',positive_sign() == '+', and value10.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
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms