Varianti

std::codecvt_byname

Da cppreference.com.

<metanoindex/>

 
 
Localizzazioni libreria
Impostazioni internazionali e sfaccettature
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
Carattere classificazione
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.
Conversioni
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Facet categoria classi di 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.
Facet categorie
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.
Locale specifici aspetti
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.
Codice di conversione sfaccettature
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.
 
<tbody> </tbody>
Elemento definito nell'header <locale>
template< class internT, class externT, class stateT > class codecvt_byname : public std::codecvt<internT, externT, stateT>;
std::codecvt_byname è un aspetto std::codecvt che incapsula multibyte / gamma regole carattere di conversione di un locale di cui alla sua costruzione.
Original:
std::codecvt_byname is a std::codecvt facet which encapsulates multibyte/wide character conversion rules of a locale specified at its construction.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Quattro specializzazioni sono forniti dalla libreria standard
Original:
Four specializations are provided by the standard library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definizione nell'header <locale>
std::codecvt_byname<char, char, std::mbstate_t>
identità conversione
Original:
identity conversion
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::codecvt_byname<char16_t, char, std::mbstate_t>
conversione tra UTF-16 e UTF-8 (dal C++11)
Original:
conversion between UTF-16 and UTF-8 (dal C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::codecvt_byname<char32_t, char, std::mbstate_t>
conversione tra UTF-32 e UTF-8 (dal C++11)
Original:
conversion between UTF-32 and UTF-8 (dal C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::codecvt_byname<wchar_t, char, std::mbstate_t>
specifica delle impostazioni internazionali conversione tra stringa larga e stretta, eventualmente multibyte, stringa
Original:
locale-specific conversion between wide string and narrow, possibly multibyte, string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Membri funzioni

costruisce un nuovo aspetto codecvt_byname
Original:
constructs a new codecvt_byname facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico)
distrugge un aspetto codecvt_byname
Original:
destructs a codecvt_byname facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(protetto funzione membro)

Inherited from std::codecvt

Member types

Membro tipo
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
intern_type internT
extern_type externT
state_type stateT

Member objects

Persona
Original:
Member name
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type
id (statico) std::locale::id

Member functions

Invoca do_out
Original:
invokes do_out
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [modifica]
Invoca do_in
Original:
invokes do_in
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [modifica]
Invoca do_unshift
Original:
invokes do_unshift
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [modifica]
Invoca do_encoding
Original:
invokes do_encoding
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [modifica]
Invoca do_always_noconv
Original:
invokes do_always_noconv
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [modifica]
Invoca do_length
Original:
invokes do_length
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [modifica]
Invoca do_max_length
Original:
invokes do_max_length
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [modifica]

Protected member functions

[virtuale]
converte una stringa da internt a externT, come ad esempio durante la scrittura su file
Original:
converts a string from internT to externT, such as when writing to file
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuale protetto funzione of std::codecvt membro) [modifica]
[virtuale]
converte una stringa da externT a internt, come ad esempio durante la lettura dal file
Original:
converts a string from externT to internT, such as when reading from file
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuale protetto funzione of std::codecvt membro) [modifica]
[virtuale]
genera la sequenza di caratteri di terminazione di caratteri externT per la conversione incompleta
Original:
generates the termination character sequence of externT characters for incomplete conversion
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuale protetto funzione of std::codecvt membro) [modifica]
[virtuale]
restituisce il numero di caratteri externT necessari a produrre un carattere internt, se costante
Original:
returns the number of externT characters necessary to produce one internT character, if constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuale protetto funzione of std::codecvt membro) [modifica]
Verifica se la faccetta codifica una conversione di identità per tutti i valori degli argomenti validi
Original:
tests if the facet encodes an identity conversion for all valid argument values
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuale protetto funzione of std::codecvt membro) [modifica]
[virtuale]
calcola la lunghezza della stringa externT che sarebbe consumata dalla conversione in tampone internt dato
Original:
calculates the length of the externT string that would be consumed by conversion into given internT buffer
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuale protetto funzione of std::codecvt membro) [modifica]
[virtuale]
restituisce il numero massimo di caratteri externT che può essere convertito in un singolo carattere internt
Original:
returns the maximum number of externT characters that could be converted into a single internT character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuale protetto funzione of std::codecvt membro) [modifica]


Inherited from std::codecvt_base

Membro tipo
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
enum result { ok, partial, error, noconv };
Enumerazione senza ambito
Original:
Unscoped enumeration type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Enumerazione costante
Original:
Enumeration constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
ok
conversione è stata completata senza errori
Original:
conversion was completed with no error
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
partial
non tutti i caratteri di origine sono stati convertiti
Original:
not all source characters were converted
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
error
rilevato un carattere non valido
Original:
encountered an invalid character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
noconv
non essere effettuata la conversione, di ingresso e di tipi di output sono gli stessi
Original:
no conversion required, input and output types are the same
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Esempio

Questo esempio mostra la lettura di un file con codifica GB18030 utilizzando il facet codecvt da un GB18030-aware locale
Original:
This example demonstrates reading a GB18030-encoded file using the codecvt facet from a GB18030-aware locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <fstream>
#include <string>
#include <locale>
int main()
{
    // GB18030 narrow multibyte encoding
    std::ofstream("text.txt") << "\x7a"              // letter 'z', U+007a
                                 "\x81\x30\x89\x38"  // letter 'ß', U+00df
                                 "\xcb\xae"          // CJK ideogram '水' (water), U+6c34
                                 "\x94\x32\xbc\x35"; // musical sign '𝄋' (segno), U+1d10b
    std::wifstream fin("text.txt");
    fin.imbue(std::locale(fin.getloc(),
              new std::codecvt_byname<wchar_t, char, std::mbstate_t>("zh_CN.gb18030")));
    for(wchar_t c; fin.get(c); )
        std::cout << std::hex << std::showbase << c << '\n';
}

Output:

0x7a
0xdf
0x6c34
0x1d10b

Vedi anche

converte tra codifiche dei caratteri, tra cui UTF-8, UTF-16, UTF-32
Original:
converts between character encodings, including UTF-8, UTF-16, UTF-32
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe template) [modifica]