std::codecvt::encoding, std::codecvt::do_encoding
De cppreference.com
(Redirigé depuis cpp/locale/codecvt/do encoding)
|
|
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 encoding() const |
(1) | |
protected: int do_encoding() const |
(2) | |
1)
fonction de membre du public, appelle le
do_encoding fonction membre de la classe la plus dérivée .Original:
public member function, calls the member function
do_encoding 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)
si le codage représenté par cette facette codecvt mappe chaque caractère interne de la même, le nombre de caractères externes constant, le rendement de ce nombre. Si le codage est de longueur variable (par exemple UTF-8 ou UTF-16), retourne
0. Si le codage est dépendant de l'état, -1 retour .Original:
if the encoding represented by this codecvt facet maps each internal character to the same, constant number of external characters, returns that number. If the encoding is variable-length (e.g. UTF-8 or UTF-16), returns
0. If the encoding is state-dependent, returns -1.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.
Retourne la valeur
Le nombre exact de caractères
externT qui correspondent à un caractère internT, s'il est constant. 0 si le nombre varie, -1 si l'encodage est dépendant de l'état .Original:
The exact number of
externT characters that correspond to one internT character, if constant. 0 if the number varies, -1 if the encoding is state-dependent.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.
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.
Exceptions
Exemple
#include <locale>
#include <iostream>
int main()
{
std::cout << "en_US.utf8 is a variable-length encoding, encoding() returns "
<< std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(
std::locale("en_US.utf8")
).encoding() << '\n';
std::cout << "zh_CN.gb18030 is also variable-length, encoding() == "
<< std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(
std::locale("zh_CN.gb18030")
).encoding() << '\n';
std::cout << "ru_RU.koi8r is a single-byte encoding encoding() == "
<< std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(
std::locale("ru_RU.koi8r")
).encoding() << '\n';
}
Résultat :
en_US.utf8 is a variable-length encoding, encoding() returns 0
zh_CN.gb18030 is also variable-length, encoding() == 0
ru_RU.koi8r is a single-byte encoding encoding() == 1
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 maximum Externt qui pourraient être transformés en un seul caractère 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. (fonction membre virtuelle protégée) |