Espaces de noms
Variantes
Affichages
Actions

std::wbuffer_convert::wbuffer_convert

De cppreference.com

 
 
Bibliothèque localisations
Locales et facettes
Original:
Locales and facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale
Classification des caractères
Original:
Character classification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversions
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classes de facettes catégorie de base
Original:
Facet category base classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Catégories de facettes
Original:
Facet categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Spécifique aux paramètres régionaux facettes
Original:
Locale-specific facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Facettes de conversion de code
Original:
Code conversion facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
codecvt_utf8 (C++11)
codecvt_utf16 (C++11)
C locale
Original:
C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::wbuffer_convert
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
wbuffer_convert::wbuffer_convert
wbuffer_convert::~wbuffer_convert
wbuffer_convert::rdbuf
wbuffer_convert::state
 
wbuffer_convert( std::streambuf* bytebuf = 0,

                 Codecvt* pcvt = new Codecvt,

                 state_type state = state_type() );
(1)
Construit l'objet wbuffer_convert avec le flux d'octets sous-jacent déterminé, facette codecvt spécifié et déterminé l'état de conversion initial (tous les paramètres sont optionnels)
Original:
Constructs the wbuffer_convert object with the specified underlying byte stream, specified codecvt facet, and specified initial conversion state (all parameters are optional)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Paramètres

bytebuf -
pointeur sur std :: streambuf pour servir le flux de caractères étroite sous-jacent
Original:
pointer to std::streambuf to serve as the underlying narrow character stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pcvt -
pointeur vers un standalone (non géré par un paramètre régional) std::codecvt facette
Original:
pointer to a standalone (not managed by a locale) std::codecvt facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
state -
la valeur initiale de l'état de conversion de caractères
Original:
the initial value of the character conversion state
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Exemple

#include <iostream>
#include <sstream>
#include <locale>
#include <codecvt>
int main()
{
    // wrap a UTF-8 string stream in a UCS4 wbuffer_convert
    std::stringbuf utf8buf(u8"z\u00df\u6c34\U0001d10b");  // or u8"zß水𝄋"
                       // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9d\x84\x8b";
    std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv_in(&utf8buf);
    std::wistream ucsbuf(&conv_in);
    std::cout << "Reading from a UTF-8 stringbuf via wbuffer_convert:\n";
    for(wchar_t c; ucsbuf.get(c); )
        std::cout << std::hex << std::showbase << c << '\n';
 
    // wrap a UTF-8 aware std::cout in a UCS4 wbuffer_convert to output UCS4
    std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv_out(std::cout.rdbuf());
    std::wostream out(&conv_out);
    std::cout << "Sending UCS4 data to std::cout via wbuffer_convert:\n";
    out << L"z\u00df\u6c34\U0001d10b\n";
}

Résultat :

Reading from a UTF-8 stringbuf via wbuffer_convert produces
0x7a
0xdf
0x6c34
0x1d10b
Sending UCS4 data to std::cout via wbuffer_convert:
zß水𝄋