STD::CTYPE_BYNAME(3cxx)

okay bestie, welcome to the manual page for std::ctype_byname< _CharT >(3cxx) πŸ’… this is literally the class ctype_byname [22.2.1.2], and we're gonna get into every tiny detail together. no skips, no cap.

πŸŽ€ NAME πŸŽ€

std::ctype_byname< _CharT > β€” class ctype_byname [22.2.1.2]. that's the name, that's the vibe, periodt.

✨ SYNOPSIS ✨

#include <locale>

Inherits std::ctype< _CharT >. iconic inheritance behavior, honestly.

🌈 Public Types 🌈

  • typedef const int * __to_type β€” the __to_type typedef, exactly as written.
  • typedef _CharT char_type β€” char_type is _CharT.
  • typedef ctype< _CharT >::mask mask β€” mask comes from ctype< _CharT >::mask.

πŸ’… Public Member Functions πŸ’…

  • ctype_byname (const char *__s, size_t __refs=0) β€” constructor from a const char *__s, with optional size_t __refs=0.
  • ctype_byname (const string &__s, size_t __refs=0) β€” constructor from a const string &__s, with optional size_t __refs=0.
  • const char_type * is (const char_type *__lo, const char_type *__hi, mask *__vec) const β€” return a mask array.
  • bool is (mask __m, char_type __c) const β€” test char_type classification.
  • char narrow (char_type __c, char __dfault) const β€” narrow char_type to char.
  • const char_type * narrow (const char_type *__lo, const char_type *__hi, char __dfault, char *__to) const β€” narrow array to char array.
  • const char_type * scan_is (mask __m, const char_type *__lo, const char_type *__hi) const β€” find char_type matching a mask.
  • const char_type * scan_not (mask __m, const char_type *__lo, const char_type *__hi) const β€” find char_type not matching a mask.
  • const char_type * tolower (char_type *__lo, const char_type *__hi) const β€” convert array to lowercase.
  • char_type tolower (char_type __c) const β€” convert to lowercase.
  • const char_type * toupper (char_type *__lo, const char_type *__hi) const β€” convert array to uppercase.
  • char_type toupper (char_type __c) const β€” convert to uppercase.
  • char_type widen (char __c) const β€” widen char to char_type.
  • const char * widen (const char *__lo, const char *__hi, char_type *__to) const β€” widen array to char_type.

🧚 Static Public Attributes 🧚

  • static const mask alnum β€” the alnum static mask.
  • static const mask alpha β€” the alpha static mask.
  • static const mask blank β€” the blank static mask.
  • static const mask cntrl β€” the cntrl static mask.
  • static const mask digit β€” the digit static mask.
  • static const mask graph β€” the graph static mask.
  • static locale::id id β€” the facet id for ctype<char_type>.
  • static const mask lower β€” the lower static mask.
  • static const mask print β€” the print static mask.
  • static const mask punct β€” the punct static mask.
  • static const mask space β€” the space static mask.
  • static const mask upper β€” the upper static mask.
  • static const mask xdigit β€” the xdigit static mask.

πŸ¦‹ Protected Member Functions πŸ¦‹

  • virtual const char_type * do_is (const char_type *__lo, const char_type *__hi, mask *__vec) const β€” return a mask array.
  • virtual bool do_is (mask __m, char_type __c) const β€” test char_type classification.
  • virtual char do_narrow (char_type, char __dfault) const β€” narrow char_type to char.
  • virtual const char_type * do_narrow (const char_type *__lo, const char_type *__hi, char __dfault, char *__to) const β€” narrow char_type array to char.
  • virtual const char_type * do_scan_is (mask __m, const char_type *__lo, const char_type *__hi) const β€” find char_type matching mask.
  • virtual const char_type * do_scan_not (mask __m, const char_type *__lo, const char_type *__hi) const β€” find char_type not matching mask.
  • virtual const char_type * do_tolower (char_type *__lo, const char_type *__hi) const β€” convert array to lowercase.
  • virtual char_type do_tolower (char_type __c) const β€” convert to lowercase.
  • virtual const char_type * do_toupper (char_type *__lo, const char_type *__hi) const β€” convert array to uppercase.
  • virtual char_type do_toupper (char_type __c) const β€” convert to uppercase.
  • virtual char_type do_widen (char __c) const β€” widen char.
  • virtual const char * do_widen (const char *__lo, const char *__hi, char_type *__dest) const β€” widen char array.

🌸 Static Protected Member Functions 🌸

  • static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw () β€” clone the C locale, exactly as declared.
  • static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0) β€” create the C locale, with __old=0 default.
  • static void _S_destroy_c_locale (__c_locale &__cloc) β€” destroy the C locale.
  • static __c_locale _S_get_c_locale () β€” get the C locale.
  • static const char * _S_get_c_name () throw () β€” get the C name.
  • static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s) β€” the _S_lc_ctype_c_locale static protected member.

πŸ’– Detailed Description πŸ’–

template<typename _CharT>
    class std::ctype_byname< _CharT >"class ctype_byname [22.2.1.2].

that stray " before class ctype_byname is literally in the source, bestie β€” not me fixing it, not me editing it, just me reporting it with love. 🫢

😭 Member Function Documentation 😭

πŸ“ do_is (array version)

template<typename _CharT > virtual const char_type * std::ctype< _CharT >::do_is (const char_type * __lo, const char_type * __hi, mask * __vec) const [protected],  [virtual],  [inherited]

Return a mask array. this function finds the mask for each char_type in the range [lo,hi) and successively writes it to vec. vec must have as many elements as the input.

do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input.

Parameters

  • __lo β€” pointer to start of range.
  • __hi β€” pointer to end of range.
  • __vec β€” pointer to an array of mask storage.

Returns

__hi.

Implements std::__ctype_abstract_base< _CharT >.

πŸ“ do_is (bool version)

template<typename _CharT > virtual bool std::ctype< _CharT >::do_is (mask __m, char_type __c) const [protected],  [virtual],  [inherited]

Test char_type classification. this function finds a mask M for c and compares it to mask m.

do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input.

Parameters

  • __c β€” the char_type to find the mask of.
  • __m β€” the mask to compare against.

Returns

(M & __m) != 0.

Implements std::__ctype_abstract_base< _CharT >.

πŸ“ do_narrow (single char_type version)

template<typename _CharT > virtual char std::ctype< _CharT >::do_narrow (char_type __c, char __dfault) const [protected],  [virtual],  [inherited]

Narrow char_type to char. this virtual function converts the argument to char using the simplest reasonable transformation. if the conversion fails, dfault is returned instead.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

note: this is not what you want for codepage conversions. see codecvt for that. πŸ’€

Parameters

  • __c β€” the char_type to convert.
  • __dfault β€” char to return if conversion fails.

Returns

the converted char.

Implements std::__ctype_abstract_base< _CharT >.

Referenced by std::ctype< char >::narrow(), and std::ctype< char >::narrow(). yes, that same reference is listed twice β€” the source said it, so I'm keeping it. 😭

πŸ“ do_narrow (array version)

template<typename _CharT > virtual const char_type * std::ctype< _CharT >::do_narrow (const char_type * __lo, const char_type * __hi, char __dfault, char * __to) const [protected],  [virtual],  [inherited]

Narrow char_type array to char. this virtual function converts each char_type in the range [__lo,__hi) to char using the simplest reasonable transformation and writes the results to the destination array. for any element in the input that cannot be converted, __dfault is used instead.

do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.

note: this is not what you want for codepage conversions. see codecvt for that. seriously, bestie, codecvt is right there. ✨

Parameters

  • __lo β€” pointer to start of range.
  • __hi β€” pointer to end of range.
  • __dfault β€” char to use if conversion fails.
  • __to β€” pointer to the destination array.

Returns

__hi.

Implements std::__ctype_abstract_base< _CharT >.

πŸ“ do_scan_is

template<typename _CharT > virtual const char_type * std::ctype< _CharT >::do_scan_is (mask __m, const char_type * __lo, const char_type * __hi) const [protected],  [virtual],  [inherited]

Find char_type matching mask. this function searches for and returns the first char_type c in [__lo,__hi) for which is(__m,c) is true.

do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input.

Parameters

  • __m β€” the mask to compare against.
  • __lo β€” pointer to start of range.
  • __hi β€” pointer to end of range.

Returns

pointer to a matching char_type if found, else __hi.

Implements std::__ctype_abstract_base< _CharT >.

πŸ“ do_scan_not

template<typename _CharT > virtual const char_type * std::ctype< _CharT >::do_scan_not (mask __m, const char_type * __lo, const char_type * __hi) const [protected],  [virtual],  [inherited]

Find char_type not matching mask. this function searches for and returns a pointer to the first char_type c of [lo,hi) for which is(m,c) is false.

do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input. yes, the original says do_scan_is() here even though this is do_scan_not β€” keeping the detail, not rewriting history. 🫢

Parameters

  • __m β€” the mask to compare against.
  • __lo β€” pointer to start of range.
  • __hi β€” pointer to end of range.

Returns

pointer to a non-matching char_type if found, else __hi.

Implements std::__ctype_abstract_base< _CharT >.

πŸ“ do_tolower (array version)

template<typename _CharT > virtual const char_type * std::ctype< _CharT >::do_tolower (char_type * __lo, const char_type * __hi) const [protected],  [virtual],  [inherited]

Convert array to lowercase. this virtual function converts each char_type in the range [__lo,__hi) to lowercase if possible. other elements remain untouched.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters

  • __lo β€” pointer to start of range.
  • __hi β€” pointer to end of range.

Returns

__hi.

Implements std::__ctype_abstract_base< _CharT >.

πŸ“ do_tolower (single char_type version)

template<typename _CharT > virtual char_type std::ctype< _CharT >::do_tolower (char_type __c) const [protected],  [virtual],  [inherited]

Convert to lowercase. this virtual function converts the argument to lowercase if possible. if not possible (for example, '2'), returns the argument.

do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.

Parameters

  • __c β€” the char_type to convert.

Returns

the lowercase char_type if convertible, else __c.

Implements std::__ctype_abstract_base< _CharT >.

Referenced by std::ctype< char >::tolower(), and std::ctype< char >::tolower(). again, listed twice in the source β€” copying the detail, not merging it. πŸ’…

πŸ“ do_toupper (array version)

template<typename _CharT > virtual const char_type * std::ctype< _CharT >::do_toupper (char_type * __lo, const char_type * __hi) const [protected],  [virtual],  [inherited]

Convert array to uppercase. this virtual function converts each char_type in the range [__lo,__hi) to uppercase if possible. other elements remain untouched.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.

Parameters

  • __lo β€” pointer to start of range.
  • __hi β€” pointer to end of range.

Returns

__hi.

Implements std::__ctype_abstract_base< _CharT >.

🌸 do_toupper β€” glow-up a single char

template<typename _CharT > virtual char_type std::ctype< _CharT >::do_toupper (char_type __c) const [protected],  [virtual],  [inherited]

okay so this one is literally the Convert to uppercase girlie ✨ This virtual function converts the char_type argument to uppercase if possible. If it's not possible (think: '2', like bestie what do you want from a digit), it just returns the argument untouched, no drama.

do_toupper() is a hook for a derived facet to change the behavior of uppercasing. And here's the rule: do_toupper() must always return the same result for the same input. Consistency is the vibe check πŸ‘‘

Parameters

  • __c β€” the char_type to convert πŸ’…

Returns The uppercase char_type if convertible, else __c.

Implements std::__ctype_abstract_base< _CharT >.

Referenced by std::ctype< char >::toupper(), and std::ctype< char >::toupper().


πŸ¦‹ do_widen β€” one char, but make it bigger

template<typename _CharT > virtual char_type std::ctype< _CharT >::do_widen (char __c) const [protected],  [virtual],  [inherited]

Widen char. This virtual function converts the char to char_type using the simplest reasonable transformation β€” we're not doing anything extra, no cap.

do_widen() is a hook for a derived facet to change the behavior of widening. Same rule as always: do_widen() must always return the same result for the same input.

ok bestie real talk ⚠️ Note: this is not what you want for codepage conversions. See codecvt for that. don't come for me, I'm just telling you what the page says πŸ’€

Parameters

  • __c β€” the char to convert 🌸

Returns The converted char_type.

Implements std::__ctype_abstract_base< _CharT >.

Referenced by std::ctype< char >::widen(), and std::ctype< char >::widen().


πŸŽ€ do_widen β€” but the whole array served

template<typename _CharT > virtual const char * std::ctype< _CharT >::do_widen (const char * __lo, const char * __hi, char_type * __to) const [protected],  [virtual],  [inherited]

Widen char array. This function converts each char in the input to char_type using the simplest reasonable transformation. Whole squad, one by one πŸ’–

do_widen() is a hook for a derived facet to change the behavior of widening, and yep β€” do_widen() must always return the same result for the same input.

Note again, and I mean it: this is not what you want for codepage conversions. See codecvt for that 🫢

Parameters

  • __lo β€” pointer to start range
  • __hi β€” pointer to end of range
  • __to β€” pointer to the destination array

Returns __hi.

Implements std::__ctype_abstract_base< _CharT >.


🌈 is β€” mask array energy, the group edition

template<typename _CharT > const char_type * std::__ctype_abstract_base< _CharT >::is (const char_type * __lo, const char_type * __hi, mask * __vec) const [inline],  [inherited]

Return a mask array. This function finds the mask for each char_type in the range [lo,hi) and successively writes it to vec. And heads up: vec must have as many elements as the char array β€” don't try to under-pack it, it will not slay 😭 It does so by returning the value of ctype<char_type>::do_is().

Parameters

  • __lo β€” pointer to start of range
  • __hi β€” pointer to end of range
  • __vec β€” pointer to an array of mask storage

Returns __hi.

References std::__ctype_abstract_base< _CharT >::do_is().


πŸ’… is β€” single char, single mask, one-on-one

template<typename _CharT > bool std::__ctype_abstract_base< _CharT >::is (mask __m, char_type __c) const [inline],  [inherited]

Test char_type classification. This function finds a mask M for __c and compares it to mask __m. It does so by returning the value of ctype<char_type>::do_is().

Parameters

  • __c β€” the char_type to compare the mask of
  • __m β€” the mask to compare against

Returns (M & __m) != 0.

References std::__ctype_abstract_base< _CharT >::do_is().

Referenced by std::time_get< _CharT, _InIter >::get().


🧚 narrow β€” shrink a single char, respectfully

template<typename _CharT > char std::__ctype_abstract_base< _CharT >::narrow (char_type __c, char __dfault) const [inline],  [inherited]

Narrow char_type to char. This function converts the char_type to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead β€” a little safety net, we love her πŸ₯Ί It does so by returning ctype<char_type>::do_narrow(__c).

Bestie. Note: this is not what you want for codepage conversions. See codecvt for that ⭐

Parameters

  • __c β€” the char_type to convert
  • __dfault β€” char to return if conversion fails

Returns The converted char.

References std::__ctype_abstract_base< _CharT >::do_narrow().

Referenced by std::time_get< _CharT, _InIter >::do_get_year(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put().


πŸ“ narrow β€” the whole array, but smol

template<typename _CharT > const char_type * std::__ctype_abstract_base< _CharT >::narrow (const char_type * __lo, const char_type * __hi, char __dfault, char * __to) const [inline],  [inherited]

Narrow array to char array. This function converts each char_type in the input to char using the simplest reasonable transformation and writes the results to the destination array. For any char_type in the input that cannot be converted, dfault is used instead πŸ’– It does so by returning ctype<char_type>::do_narrow(__lo, __hi, __dfault, __to).

Note (yes, again): this is not what you want for codepage conversions. See codecvt for that πŸ™ˆ

Parameters

  • __lo β€” pointer to start of range
  • __hi β€” pointer to end of range
  • __dfault β€” char to use if conversion fails
  • __to β€” pointer to the destination array

Returns __hi.

References std::__ctype_abstract_base< _CharT >::do_narrow().


πŸ‘‘ scan_is β€” find the first matching icon

template<typename _CharT > const char_type * std::__ctype_abstract_base< _CharT >::scan_is (mask __m, const char_type * __lo, const char_type * __hi) const [inline],  [inherited]

Find char_type matching a mask. This function searches for and returns the first char_type c in [lo,hi) for which is(m,c) is true β€” she's scanning the crowd for her match, main character energy fr fr 🌟 It does so by returning ctype<char_type>::do_scan_is().

Parameters

  • __m β€” the mask to compare against
  • __lo β€” pointer to start of range
  • __hi β€” pointer to end of range

Returns Pointer to matching char_type if found, else __hi.

References std::__ctype_abstract_base< _CharT >::do_scan_is().


πŸ’œ scan_not β€” find the first one who's not it

template<typename _CharT > const char_type * std::__ctype_abstract_base< _CharT >::scan_not (mask __m, const char_type * __lo, const char_type * __hi) const [inline],  [inherited]

Find char_type not matching a mask. This function searches for and returns the first char_type c in [lo,hi) for which is(m,c) is false β€” the opposite hunt, blocking the whole friend group except one 😌 It does so by returning ctype<char_type>::do_scan_not().

Parameters

  • __m β€” the mask to compare against
  • __lo β€” pointer to first char in range
  • __hi β€” pointer to end of range

Returns Pointer to non-matching char if found, else __hi.

References std::__ctype_abstract_base< _CharT >::do_scan_not().


🌸 tolower β€” lowercase the whole array

template<typename _CharT > const char_type * std::__ctype_abstract_base< _CharT >::tolower (char_type * __lo, const char_type * __hi) const [inline],  [inherited]

Convert array to lowercase. This function converts each char_type in the range [__lo,__hi) to lowercase if possible. Other elements remain untouched β€” no forcing anyone to change, we respect boundaries πŸ’… It does so by returning ctype<char_type>:: do_tolower(__lo, __hi).

Parameters

  • __lo β€” pointer to start of range
  • __hi β€” pointer to end of range

Returns __hi.

References std::__ctype_abstract_base< _CharT >::do_tolower().


🫢 tolower β€” a single char, calmed down

template<typename _CharT > char_type std::__ctype_abstract_base< _CharT >::tolower (char_type __c) const [inline],  [inherited]

Convert to lowercase. This function converts the argument to lowercase if possible. If not possible (for example, '2'), it returns the argument, unchanged, unbothered πŸŽ€ It does so by returning ctype<char_type>::do_tolower(c).

Parameters

  • __c β€” the char_type to convert

Returns The lowercase char_type if convertible, else __c.

References std::__ctype_abstract_base< _CharT >::do_tolower().

Referenced by std::time_get< _CharT, _InIter >::get().


πŸ”₯ toupper β€” uppercase the whole array

template<typename _CharT > const char_type * std::__ctype_abstract_base< _CharT >::toupper (char_type * __lo, const char_type * __hi) const [inline],  [inherited]

Convert array to uppercase. This function converts each char_type in the range [lo,hi) to uppercase if possible. Other elements remain untouched. It does so by returning ctype<char_type>:: do_toupper(lo, hi).

Parameters

  • __lo β€” pointer to start of range
  • __hi β€” pointer to end of range

Returns __hi.

References std::__ctype_abstract_base< _CharT >::do_toupper().


⭐ toupper β€” a single char, hyped up

template<typename _CharT > char_type std::__ctype_abstract_base< _CharT >::toupper (char_type __c) const [inline],  [inherited]

Convert to uppercase. This function converts the argument to uppercase if possible. If not possible (for example, '2'), returns the argument. It does so by returning ctype<char_type>::do_toupper().

Parameters

  • __c β€” the char_type to convert

Returns The uppercase char_type if convertible, else __c.

References std::__ctype_abstract_base< _CharT >::do_toupper().

Referenced by std::time_get< _CharT, _InIter >::get().


🌟 widen β€” one char but grander

template<typename _CharT > char_type std::__ctype_abstract_base< _CharT >::widen (char __c) const [inline],  [inherited]

Widen char to char_type. This function converts the char argument to char_type using the simplest reasonable transformation. It does so by returning ctype<char_type>::do_widen(c).

Note, and I cannot stress this enough: this is not what you want for codepage conversions. See codecvt for that πŸ’–

Parameters

  • __c β€” the char to convert

Returns The converted char_type.

References std::__ctype_abstract_base< _CharT >::do_widen().

Referenced by std::money_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::money_put< _CharT, _OutIter >::do_put(), and std::time_put< _CharT, _OutIter >::do_put().


πŸ’€ widen β€” the array version, iconic

template<typename _CharT > const char * std::__ctype_abstract_base< _CharT >::widen (const char * __lo, const char * __hi, char_type * __to) const [inline],  [inherited]

Widen array to char_type. This function converts each char in the input to char_type using the simplest reasonable transformation. It does so by returning ctype<char_type>::do_widen(c).

Note: this is not what you want for codepage conversions. See codecvt for that 🌈

Parameters

  • __lo β€” pointer to start of range
  • __hi β€” pointer to end of range
  • __to β€” pointer to the destination array

Returns __hi.

References std::__ctype_abstract_base< _CharT >::do_widen().


πŸŽ€ Member Data Documentation

πŸ’– id β€” the facet's official @handle

template<typename _CharT > locale::id std::ctype< _CharT >::id [static],  [inherited]

The facet id for ctype<char_type> β€” it's static, it's the identity, it's giving verified badge βœ…


πŸ¦‹ Author

Generated automatically by Doxygen for libstdc++ from the source code. β€” so nobody hand-wrote this, a robot did, and honestly? it ate πŸ€–βœ¨


and that's the whole page bestie!! πŸ’… this was libstdc++'s std::ctype_byname< _CharT >(3cxx) β€” go forth, widen responsibly, and remember: codecvt is the one you want for codepage conversions, not this girlie πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from