Espaços nominais
Variantes
Acções

std::codecvt_mode

Da cppreference.com
< cpp‎ | locale

 
 
Biblioteca localizações
Localidades e facetas
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
Classificação de caracteres
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.
Conversões
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 classes base da categoria
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.
Categorias faceta
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.
Específicos da localidade facetas
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.
Facetas de conversão de código
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)
codecvt_utf8_utf16(C++11)
codecvt_mode(C++11)
C localidade
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.
 
Defined in header <locale>
enum codecvt_mode {

    consume_header = 4,
    generate_header = 2,
    little_endian = 1

};
As facetas std::codecvt_utf8, std::codecvt_utf16, e std::codecvt_utf8_utf16 aceitar um valor opcional de std::codecvt_mode tipo como um argumento de modelo, que especifica os recursos opcionais da conversão string unicode.
Original:
The facets std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16 accept an optional value of type std::codecvt_mode as a template argument, which specifies optional features of the unicode string conversion.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Constantes

Defined in header <locale>
Valor
Original:
Value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Meaning
little_endian
assumir a entrada é em little-endian ordem de byte (aplica-se a UTF-16 única entrada, o padrão é big-endian)
Original:
assume the input is in little-endian byte order (applies to UTF-16 input only, the default is big-endian)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
consume_header
consumir a marca de ordem de byte, se presente no início da sequência de entrada, e (no caso de UTF-16), contam com a ordem de byte que especifica para descodificar o resto da entrada
Original:
consume the byte order mark, if present at the start of input sequence, and (in case of UTF-16), rely on the byte order it specifies for decoding the rest of the input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
generate_header
a saída do sinal de ordem de byte no início da sequência de saída
Original:
output the byte order mark at the start of the output sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
As marcas de ordem de byte são reconhecidos:
Original:
The recognized byte order marks are:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
0xfe 0xff
UTF-16 big-endian
Original:
UTF-16 big-endian
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
0xff 0xfe
UTF-16 little-endian
Original:
UTF-16 little-endian
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
0xef 0xbb 0xbf
UTF-8 (nenhum efeito na ordenação)
Original:
UTF-8 (no effect on endianness)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se não for selecionado std::consume_header ao ler um arquivo com início marca de ordem de byte, o caractere Unicode U + FEFF (Zero largura do espaço não-quebra) será lido como o primeiro caractere do conteúdo da string.
Original:
If std::consume_header is not selected when reading a file beginning with byte order mark, the Unicode character U+FEFF (Zero width non-breaking space) will be read as the first character of the string content.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

O exemplo a seguir demonstra a consumir a UTF-8 BOM
Original:
The following example demonstrates consuming the UTF-8 BOM
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <fstream>
#include <iostream>
#include <string>
#include <locale>
#include <codecvt>
int main()
{
    // UTF-8 data with BOM
    std::ofstream("text.txt") << u8"\ufeffz\u6c34\U0001d10b";
    // read the UTF8 file, skipping the BOM
    std::wifstream fin("text.txt");
    fin.imbue(std::locale(fin.getloc(),
                          new std::codecvt_utf8<wchar_t, 0x10ffff, std::consume_header>));
    for(wchar_t c; fin.get(c); )
        std::cout << std::hex << std::showbase << c << '\n';
}

Output:

0x7a
0x6c34
0x1d10b

[editar] Veja também

Converte entre codificações de caracteres, incluindo 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.

(modelo de classe) [edit]
converte entre UTF-8 e UCS2/UCS4
Original:
converts between UTF-8 and UCS2/UCS4
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de classe) [edit]
converte entre UTF-16 e UCS2/UCS4
Original:
converts between UTF-16 and UCS2/UCS4
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de classe) [edit]
converts between UTF-8 and UTF-16
(modelo de classe) [edit]