std::codecvt::max_length, std::codecvt::do_max_length
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| Déclaré dans l'en-tête <locale>
|
||
public: int max_length() const |
(1) | |
protected: int do_max_length() const |
(2) | |
1)
fonction de membre du public, appelle le
do_max_length fonction membre de la classe la plus dérivée .Original:
public member function, calls the member function
do_max_length 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.
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.
Retourne la valeur
The maximum number of externT characters that could be consumed if converted by do_in() to produce one internT character.
La spécialisation non-conversion
std::codecvt<char, char, std::mbstate_t> retours 1Original:
The non-converting specialization
std::codecvt<char, char, std::mbstate_t> returns 1The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Notes
If the encoding is state-dependent (encoding() == -1), then more than max_length() external characters may be consumed to produce one internal character
Exceptions
Exemple
#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";
}
Résultat :
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
Voir aussi
MB_CUR_MAX |
nombre maximal d'octets dans un caractère multi-octets dans le courant C locale
( variable de macro ) Original: macro variable The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. Original: maximum number of bytes in a multibyte character in the current C locale ( variable de macro ) Original: macro variable The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
retourne le nombre de caractères Externt nécessaires pour produire une Internt caractère, si 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. (fonction membre virtuelle protégée) |