Difference between revisions of "cpp/locale/wstring convert"
m (own sidebar) |
m (Text replace - "{{mark c++11 feature}}" to "{{mark since c++11}}") |
||
Line 3: | Line 3: | ||
{{ddcl list begin}} | {{ddcl list begin}} | ||
{{ddcl list header | locale}} | {{ddcl list header | locale}} | ||
− | {{ddcl list item | notes={{mark c++11 | + | {{ddcl list item | notes={{mark since c++11}} | 1= |
template< class Codecvt, | template< class Codecvt, | ||
class Elem = wchar_t, | class Elem = wchar_t, |
Revision as of 14:52, 24 December 2011
Template:cpp/locale/wstring convert/sidebar Template:ddcl list begin <tr class="t-dsc-header">
<td><locale>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td > class Elem = wchar_t,
class Wide_alloc = std::allocator<Elem>,
class Byte_alloc = std::allocator<char> >
<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> Template:ddcl list end
Class template Template:cpp performs conversions between byte string Template:cpp and wide string Template:cpp, using an individual code conversion facet Codecvt
. Template:cpp assumes ownership of the conversion facet, and cannot use a facet managed by a locale. The standard facets suitable for use with Template:cpp are Template:cpp for UTF-8/UCS2 and UTF-8/UCS4 conversions and Template:cpp for UTF-8/UTF-16 conversions.
Contents |
Member types
Template:tdcl list begin Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list end
Member functions
constructs a new wstring_convert (public member function) | |
destructs the wstring_convert and its conversion facet (public member function) | |
converts a byte string into a wide string (public member function) | |
converts a wide string into a byte string (public member function) | |
returns the number of input characters successfully converted (public member function) | |
returns the current shift state (public member function) |
Example
See also
Character conversions |
locale-defined multibyte (UTF-8, GB18030) |
UTF-8 |
UTF-16 |
---|---|---|---|
UTF-16 | mbrtoc16 / c16rtomb (with C11's DR488) |
codecvt<char16_t,char,mbstate_t> |
N/A |
UCS-2 | c16rtomb (without C11's DR488) | codecvt_utf8<char16_t> | codecvt_utf16<char16_t> |
UTF-32 |
codecvt<char32_t,char,mbstate_t> |
codecvt_utf16<char32_t> | |
system wchar_t:
UTF-32 (non-Windows) |
mbsrtowcs / wcsrtombs |
codecvt_utf8<wchar_t> | codecvt_utf16<wchar_t> |