STD::CODECVT_BYNAME(3)
π NAME π
std::codecvt_byname< _InternT, _ExternT, _StateT > β okay so this is the codecvt_byname class, bestie. [22.2.1.6]. It lives in the Library Functions Manual and it's giving locale-aware character conversion realness. π
π¦ SYNOPSIS π¦
#include <locale>
It inherits from std::codecvt< _InternT, _ExternT, _StateT >. periodt. π
β¨ Public Types β¨
typedef _ExternT extern_typetypedef _InternT intern_typetypedef codecvt_base::result resulttypedef _StateT state_type
πΈ Public Member Functions πΈ
codecvt_byname (const char *__s, size_t __refs=0)codecvt_byname (const string &__s, size_t __refs=0)bool always_noconv () const throw ()int encoding () const throw ()result in (state_type &__state, const extern_type *__from, const extern_type *__from_end, const extern_type *&__from_next, intern_type *__to, intern_type *__to_end, intern_type *&__to_next) constβ converts from external to internal character set, no cap.int length (state_type &__state, const extern_type *__from, const extern_type *__end, size_t __max) constint max_length () const throw ()result out (state_type &__state, const intern_type *__from, const intern_type *__from_end, const intern_type *&__from_next, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) constβ converts from internal to external character set, iconic behaviour honestly.result unshift (state_type &__state, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) constβ resets the conversion state. π«Ά
π Static Public Attributes π
static locale::id id
π§ Protected Member Functions π§
virtual bool do_always_noconv () const throw ()virtual int do_encoding () const throw ()virtual result do_in (state_type &__state, const extern_type *__from, const extern_type *__from_end, const extern_type *&__from_next, intern_type *__to, intern_type *__to_end, intern_type *&__to_next) constvirtual int do_length (state_type &, const extern_type *__from, const extern_type *__end, size_t __max) constvirtual int do_max_length () const throw ()virtual result do_out (state_type &__state, const intern_type *__from, const intern_type *__from_end, const intern_type *&__from_next, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) constβ converts from internal to external character set.virtual result do_unshift (state_type &__state, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) const
π Static Protected Member Functions π
static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw ()static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0)static void _S_destroy_c_locale (__c_locale &__cloc)static __c_locale _S_get_c_locale ()static const char * _S_get_c_name () throw ()static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s)
π Protected Attributes π
__c_locale _M_c_locale_codecvt
π Detailed Description π
template<typename _InternT, typename _ExternT, typename _StateT>
class std::codecvt_byname< _InternT, _ExternT, _StateT >"class codecvt_byname [22.2.1.6].
π Member Function Documentation π
do_always_noconv π
template<typename _InternT, typename _ExternT, typename _StateT> virtual
bool std::codecvt< _InternT, _ExternT, _StateT >::do_always_noconv ()
const [protected], [virtual], [inherited]
Implements std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >.
do_encoding π
template<typename _InternT, typename _ExternT, typename _StateT> virtual int
std::codecvt< _InternT, _ExternT, _StateT >::do_encoding () const
[protected], [virtual], [inherited]
Implements std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >.
do_in π
template<typename _InternT, typename _ExternT, typename _StateT> virtual
result std::codecvt< _InternT, _ExternT, _StateT >::do_in (state_type &
__state, const extern_type * __from, const extern_type * __from_end,
const extern_type *& __from_next, intern_type * __to, intern_type *
__to_end, intern_type *& __to_next) const [protected], [virtual],
[inherited]
Implements std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >.
do_length β
template<typename _InternT, typename _ExternT, typename _StateT> virtual int
std::codecvt< _InternT, _ExternT, _StateT >::do_length (state_type & ,
const extern_type * __from, const extern_type * __end, size_t __max)
const [protected], [virtual], [inherited]
Implements std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >.
do_max_length π₯
template<typename _InternT, typename _ExternT, typename _StateT> virtual int
std::codecvt< _InternT, _ExternT, _StateT >::do_max_length () const
[protected], [virtual], [inherited]
Implements std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >.
do_out π«Ά
template<typename _InternT, typename _ExternT, typename _StateT> virtual
result std::codecvt< _InternT, _ExternT, _StateT >::do_out (state_type &
__state, const intern_type * __from, const intern_type * __from_end,
const intern_type *& __from_next, extern_type * __to, extern_type *
__to_end, extern_type *& __to_next) const [protected], [virtual],
[inherited]
Convert from internal to external character set. Converts input string of intern_type to output string of extern_type. This function is a hook for derived classes to change the value returned. π£
See also out for more information.
Implements std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >.
do_unshift π¦
template<typename _InternT, typename _ExternT, typename _StateT> virtual
result std::codecvt< _InternT, _ExternT, _StateT >::do_unshift
(state_type & __state, extern_type * __to, extern_type * __to_end,
extern_type *& __to_next) const [protected], [virtual], [inherited]
Implements std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >.
in π
template<typename _InternT, typename _ExternT, typename _StateT> result
std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >::in
(state_type & __state, const extern_type * __from, const extern_type *
__from_end, const extern_type *& __from_next, intern_type * __to,
intern_type * __to_end, intern_type *& __to_next) const [inline],
[inherited]
Convert from external to internal character set. Converts input string of extern_type to output string of intern_type. This is analogous to mbsrtowcs. It does this by calling codecvt::do_in. π
The source and destination character sets are determined by the facet's locale, internal and external types.
The characters in [from,from_end) are converted and written to [to,to_end). from_next and to_next are set to point to the character following the last successfully converted character, respectively. If the result needed no conversion, from_next and to_next are not affected.
The state argument should be initialized if the input is at the beginning and carried from a previous call if continuing conversion. There are no guarantees about how state is used. π
The result returned is a member of codecvt_base::result. If all the input is converted, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the input ends early or there is insufficient space in the output, returns codecvt_base::partial. Otherwise the conversion failed and codecvt_base::error is returned.
Parameters
__stateβ persistent conversion state data.__fromβ start of input.__from_endβ end of input.__from_nextβ returns start of unconverted data.__toβ start of output buffer.__to_endβ end of output buffer.__to_nextβ returns start of unused output area.
Returns
codecvt_base::result.
out πΈ
template<typename _InternT, typename _ExternT, typename _StateT> result
std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >::out
(state_type & __state, const intern_type * __from, const intern_type *
__from_end, const intern_type *& __from_next, extern_type * __to,
extern_type * __to_end, extern_type *& __to_next) const [inline],
[inherited]
Convert from internal to external character set. Converts input string of intern_type to output string of extern_type. This is analogous to wcsrtombs. It does this by calling codecvt::do_out. β¨
The source and destination character sets are determined by the facet's locale, internal and external types.
The characters in [from,from_end) are converted and written to [to,to_end). from_next and to_next are set to point to the character following the last successfully converted character, respectively. If the result needed no conversion, from_next and to_next are not affected.
The state argument should be initialized if the input is at the beginning and carried from a previous call if continuing conversion. There are no guarantees about how state is used. π
The result returned is a member of codecvt_base::result. If all the input is converted, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the input ends early or there is insufficient space in the output, returns codecvt_base::partial. Otherwise the conversion failed and codecvt_base::error is returned.
Parameters
__stateβ persistent conversion state data.__fromβ start of input.__from_endβ end of input.__from_nextβ returns start of unconverted data.__toβ start of output buffer.__to_endβ end of output buffer.__to_nextβ returns start of unused output area.
Returns
codecvt_base::result.
References do_out().
unshift π
template<typename _InternT, typename _ExternT, typename _StateT> result
std::__codecvt_abstract_base< _InternT, _ExternT, _StateT >::unshift
(state_type & __state, extern_type * __to, extern_type * __to_end,
extern_type *& __to_next) const [inline], [inherited]
Reset conversion state. Writes characters to output that would restore state to initial conditions. The idea is that if a partial conversion occurs, then the converting the characters written by this function would leave the state in initial conditions, rather than partial conversion state. It does this by calling codecvt::do_unshift(). π§
For example, if 4 external characters always converted to 1 internal character, and input to in() had 6 external characters with state saved, this function would write two characters to the output and set the state to initialized conditions.
The source and destination character sets are determined by the facet's locale, internal and external types.
The result returned is a member of codecvt_base::result. If the state could be reset and data written, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the output has insufficient space, returns codecvt_base::partial. Otherwise the reset failed and codecvt_base::error is returned.
Parameters
__stateβ persistent conversion state data.__toβ start of output buffer.__to_endβ end of output buffer.__to_nextβ returns start of unused output area.
Returns
codecvt_base::result.
β¨ AUTHOR β¨
ngl bestie, nobody sat down and hand-wrote this page over a matcha latte π΅ β it was generated automatically by Doxygen for libstdc++, pulled straight out of the source code. So if the prose is a little dry, that's why: it's giving robot-authored, no cap π€π
And that's a wrap on the whole page, fr fr π If you're ever scrolling past the footer and wondering who to blame β or who to thank β the bottom line credits libstdc++ as the source/version, and the page itself answers to the name std::codec... _StateT >(3). That's the whole vibe check, bestie β go forth and codecvt responsibly π¦β¨π
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- centos-stream 10: gcc-toolset-15-libstdc++-docs 15.2.1-8.1.el10 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- centos-stream 10: gcc-toolset-16-libstdc++-docs 16.2.1-1.3.el10 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- centos-stream 10: libstdc++-docs 14.4.1-4.el10 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 43: libstdc++-docs 15.2.1-2.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 43: libstdc++-docs 15.3.1-1.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms