Espacios de nombres
Variantes
Acciones

std::codecvt::in, std::codecvt::do_in

De cppreference.com
< cpp‎ | locale‎ | codecvt

 
 
Localizaciones biblioteca
Locales y 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
Carácter clasificación
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.
Conversiones
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 clases categoría 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.
Categorías 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ífico de la localidad 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 código de conversión
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.
 
 
Defined in header <locale>
public:

result in( stateT& state,
           const externT* from,
           const externT* from_end,
           const externT*& from_next,
           internT* to,
           internT* to_end,

           internT*& to_next ) const;
(1)
protected:

result do_in( stateT& state,
              const externT* from,
              const externT* from_end,
              const externT*& from_next,
              internT* to,
              internT* to_end,

              internT*& to_next ) const;
(2)
1)
función miembro pública, llama a la función do_in miembro de la clase más derivada .
Original:
public member function, calls the member function do_in of the most derived class.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Si esta faceta codecvt define una conversión, convierte los caracteres externos de la [from, from_end) rango de origen a los caracteres internos, colocando los resultados en las ubicaciones siguientes a partir de to. Convierte no más de from_end - from caracteres externos y no escribe más caracteres to_end - to internos. Hojas from_next y to_next señalando un más allá del último elemento convertido con éxito .
Original:
If this codecvt facet defines a conversion, translates the external characters from the source range [from, from_end) to internal characters, placing the results in the subsequent locations starting at to. Converts no more than from_end - from external characters and writes no more than to_end - to internal characters. Leaves from_next and to_next pointing one beyond the last element successfully converted.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si esta faceta codecvt no define una conversión, sin caracteres se convierten. to_next se fija para ser igual a to, state es invariable, y se devuelve std::codecvt_base::noconv .
Original:
If this codecvt facet does not define a conversion, no characters are converted. to_next is set to be equal to to, state is unchanged, and std::codecvt_base::noconv is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Valor de retorno

Un valor de std::codecvt_base::result tipo, que indica el estado de éxito de la siguiente manera:
Original:
A value of type std::codecvt_base::result, indicating the success status as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ok
conversión completa
Original:
conversion completed
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
partial
no hay suficiente espacio en la memoria intermedia de salida o final inesperado de buffer fuente
Original:
not enough space in the output buffer or unexpected end of source buffer
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
error
encontrado un carácter que no se pudo convertir
Original:
encountered a character that could not be converted
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
noconv
esta faceta no es la conversión, no hay salida por escrito
Original:
this facet is non-converting, no output written
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La especialización no convertir std::codecvt<char, char, std::mbstate_t> siempre devuelve std::codecvt_base::noconv
Original:
The non-converting specialization std::codecvt<char, char, std::mbstate_t> always returns std::codecvt_base::noconv
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Notas

Requiere que from <= from_end && to <= to_end state y que, o bien que representa el estado inicial de cambios o los obtenidos mediante la conversión de los caracteres anteriores en la secuencia .
Original:
Requires that from <= from_end && to <= to_end and that state either representing the initial shift state or obtained by converting the preceding characters in the sequence.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
El efecto sobre state es deliberadamente no especificado. En las facetas estándar, que se utiliza para mantener un estado de cambios como cuando se llama a std::mbsrtowcs, y por tanto se actualiza para reflejar el estado de conversión después del último carácter de procesado externo, sino una faceta definida por el usuario es libre de usarlo para mantener cualquier otro estado, por ejemplo, contar el número de caracteres especiales se encuentran .
Original:
The effect on state is deliberately unspecified. In standard facets, it is used to maintain shift state like when calling std::mbsrtowcs, and is therefore updated to reflect the conversion state after the last processed external character, but a user-defined facet is free to use it to maintain any other state, e.g. count the number of special characters encountered.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ejemplo

#include <iostream>
#include <string>
#include <locale>
int main()
{
    std::locale::global(std::locale("en_US.utf8"));
    auto& f = std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(std::locale());
    std::string external = u8"z\u00df\u6c34\U0001d10b"; // or u8"zß水𝄋"
                          // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9d\x84\x8b";
 
    // note that the following can be done with wstring_convert
    std::mbstate_t mb = std::mbstate_t(); // initial shift state
    std::wstring internal(external.size(), '\0'); 
    const char* from_next;
    wchar_t* to_next;
    f.in(mb, &external[0], &external[external.size()], from_next,
             &internal[0], &internal[internal.size()], to_next);
    // error checking skipped for brevity
    internal.resize(to_next - &internal[0]);
 
    std::wcout << L"The string in wide encoding: " << internal << '\n';
}

Output:

The string in wide encoding: zß水𝄋

[editar] Ver también

[virtual]
lee el archivo asociado
Original:
reads from the associated file
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuales protegidos of std::basic_filebuf miembro de función) [edit]
convierte una cadena de bytes en una cadena de ancho
Original:
converts a byte string into a wide string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público of std::wstring_convert función) [edit]
convierte una cadena de caracteres multibyte estrecho a la cadena de ancho, estado dado
Original:
converts a narrow multibyte character string to wide string, given state
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [edit]
[virtual]
convierte una cadena de internt a externT, tales como cuando se escribe en el archivo
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.

(virtuales protegidos miembro de función) [edit]