std::codecvt::encoding, std::codecvt::do_encoding
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <locale>
|
||
public: int encoding() const |
(1) | |
protected: int do_encoding() const |
(2) | |
do_encoding
funzione membro della classe più derivata.do_encoding
of the most derived class.You can help to correct and verify the translation. Click here for instructions.
2) 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.
Indice |
[modifica] Valore di ritorno
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.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Eccezioni
[modifica] Esempio
#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'; }
Output:
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
[modifica] Vedi anche
MB_CUR_MAX |
numero massimo di byte in un carattere multibyte nella corrente C locale
(variabili macro) Original: maximum number of bytes in a multibyte character in the current C locale (variabili macro) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[virtuale] |
restituisce il numero massimo di caratteri externT che può essere convertito in un singolo carattere 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. (virtuale protetto funzione membro) |