|
<locale>
template <class internT, class externT, class stateT> class codecvt;
Convert codeset facet
|  |
codecvt |
|  |
|
The codecvt standard facet is used to translate between different character encoding systems (such as multi-byte, UTF-16, ...)
codecvt objects are prevented to be locally constructed by having a protected destructor. Only those installed in locale objects should be used through mechanisms such as use_facet.
This template class has three template parameters, representing the internal character type, the external character type and the conversion state type. They are referred inside this entire reference as internT, externT and unshift, respectively:
|
template <class internT, class externT, class stateT> codecvt;
|
The class defines three member aliases for these types: codecvt::intern_type, codecvt::extern_type and codecvt::state_type.
The internal character type is the base type used for translations, while the external character type is its counterpart in the translation. Translations can be performed in either direction with member functions codecvt::in and codecvt::out.
The conversion state type is the type of the object used to keep the state status in a particular translation, more generally used in variable-width character encodings. It is generally mbstate_t or some other compatible type.
Public members
It includes the following public member functions:
Conversion functions:
in | Translate in characters (public member function) |
out | Translate out characters (public member function) |
unshift | Unshift translation state (public member function) |
Character encoding properties:
always_noconv | Return noconv characteristics (public member function) |
encoding | Return encoding width (public member function) |
length | Return length of translated sequence (public member function) |
max_length | Return max length of one character (public member function) |
Along with the following public member types:
result | Operation result type (public member type) |
intern_type | Internal character type (public member type) |
extern_type | External character type (public member type) |
state_type | Conversion state type (public member type) |
Virtual protected members
The class defines the virtual protected members in charge of implementing the expected behavior of their corresponding public member functions:
do_always_noconv | Return noconv characteristics [virtual] (virtual protected member function) |
do_encoding | Return encoding width [virtual] (virtual protected member function) |
do_in | Translate in characters [virtual] (virtual protected member function) |
do_length | Return length of translated sequence [virtual] (public member function) |
do_max_length | Return max length of one character [virtual] (virtual protected member function) |
do_out | Translate out characters [virtual] (virtual protected member function) |
do_unshift | Unshift translation state [virtual] (virtual protected member function) |
Including the class destructor
codecvt specialization: codecvt<char,char,mbstate_t>
Both the internal and external types are the narrow character type. This specialization performs no conversions at all
codecvt specialization: codecvt<wchar_t,char,mbstate_t>
Converts between the two fundamental character types using the system's native character set equivalences.
|