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_typetypedef, exactly as written.typedef _CharT char_typeβchar_typeis_CharT.typedef ctype< _CharT >::mask maskβmaskcomes fromctype< _CharT >::mask.
π Public Member Functions π
ctype_byname (const char *__s, size_t __refs=0)β constructor from aconst char *__s, with optionalsize_t __refs=0.ctype_byname (const string &__s, size_t __refs=0)β constructor from aconst string &__s, with optionalsize_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β testchar_typeclassification.char narrow (char_type __c, char __dfault) constβ narrowchar_typetochar.const char_type * narrow (const char_type *__lo, const char_type *__hi, char __dfault, char *__to) constβ narrow array tochararray.const char_type * scan_is (mask __m, const char_type *__lo, const char_type *__hi) constβ findchar_typematching a mask.const char_type * scan_not (mask __m, const char_type *__lo, const char_type *__hi) constβ findchar_typenot 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β widenchartochar_type.const char * widen (const char *__lo, const char *__hi, char_type *__to) constβ widen array tochar_type.
π§ Static Public Attributes π§
static const mask alnumβ thealnumstatic mask.static const mask alphaβ thealphastatic mask.static const mask blankβ theblankstatic mask.static const mask cntrlβ thecntrlstatic mask.static const mask digitβ thedigitstatic mask.static const mask graphβ thegraphstatic mask.static locale::id idβ the facet id forctype<char_type>.static const mask lowerβ thelowerstatic mask.static const mask printβ theprintstatic mask.static const mask punctβ thepunctstatic mask.static const mask spaceβ thespacestatic mask.static const mask upperβ theupperstatic mask.static const mask xdigitβ thexdigitstatic 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β testchar_typeclassification.virtual char do_narrow (char_type, char __dfault) constβ narrowchar_typetochar.virtual const char_type * do_narrow (const char_type *__lo, const char_type *__hi, char __dfault, char *__to) constβ narrowchar_typearray tochar.virtual const char_type * do_scan_is (mask __m, const char_type *__lo, const char_type *__hi) constβ findchar_typematching mask.virtual const char_type * do_scan_not (mask __m, const char_type *__lo, const char_type *__hi) constβ findchar_typenot 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β widenchar.virtual const char * do_widen (const char *__lo, const char *__hi, char_type *__dest) constβ widenchararray.
πΈ 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=0default.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_localestatic 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β thechar_typeto 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β thechar_typeto 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. seecodecvtfor that. seriously, bestie,codecvtis 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β thechar_typeto 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β thechar_typeto 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β thecharto 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 ofmaskstorage
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β thechar_typeto 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β thechar_typeto convert__dfaultβcharto 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βcharto 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β thechar_typeto 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β thechar_typeto 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β thecharto 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
- 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