STD::CODECVT_BYNAME(3)

πŸ“¦
version 16.2.1+r23+gd564253eb6c8 Β· 7 versions
, in arch rolling, centos-stream 10, fedora 43, fedora 44

πŸ’– 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_type
  • typedef _InternT intern_type
  • typedef codecvt_base::result result
  • typedef _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) const
  • int 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) const
  • virtual int do_length (state_type &, const extern_type *__from, const extern_type *__end, size_t __max) const
  • virtual 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