std::codecvt::max_length, std::codecvt::do_max_length
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
| Definido en el archivo de encabezado <locale>
|
||
public:
int max_length() const
|
(1) | |
protected:
int do_max_length() const
|
(2) | |
1)
do_max_length miembro de la clase más derivada .do_max_length of the most derived class.You can help to correct and verify the translation. Click here for instructions.
2) returns the maximum value that do_length(state, from, from_end, 1) can return for any valid range [from, from_end) and any valid state.
Valor de retorno
The maximum number of externT characters that could be consumed if converted by do_in() to produce one internT character.
std::codecvt<char, char, std::mbstate_t> vuelve 1std::codecvt<char, char, std::mbstate_t> returns 1You can help to correct and verify the translation. Click here for instructions.
Notas
If the encoding is state-dependent (encoding() == -1), then more than max_length() external characters may be consumed to produce one internal character
Excepciones
Ejemplo
#include <locale>
#include <iostream>
#include <codecvt>
int main()
{
std::cout << "In codecvt_utf8, the longest multibyte character is "
<< std::codecvt_utf8<wchar_t>().max_length() << " bytes long\n";
std::cout << "In header-consuming codecvt_utf8, the longest multibyte character is "
<< std::codecvt_utf8<wchar_t,
0x10ffff,
std::consume_header>().max_length() << " bytes long\n";
std::cout << "In this system's en_US.utf8, the longest multibyte character is "
<< std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(
std::locale("en_US.utf8")
).max_length() << " bytes long\n";
std::cout << "In this system's zh_CN.gb18030, the longest multibyte character is "
<< std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(
std::locale("zh_CN.gb18030")
).max_length() << " bytes long\n";
}
Salida:
In codecvt_utf8, the longest multibyte character is 4 bytes long
In header-consuming codecvt_utf8, the longest multibyte character is 7 bytes long
In this system's en_US.utf8, the longest multibyte character is 6 bytes long
In this system's zh_CN.gb18030, the longest multibyte character is 4 bytes long
Ver también
MB_CUR_MAX |
número máximo de bytes en un carácter multibyte en la actual C locale
(variables macro) Original: maximum number of bytes in a multibyte character in the current C locale (variables macro) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[virtual] |
devuelve el número de caracteres externT necesarias para producir un carácter internt, si es constante 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. (función miembro virtual protegida) |