[ Web Proxy ]
URL:
Viewing: https://fr.cppreference.com/cpp/locale/codecvt/length [Back]  [Original]

std::codecvt::length, std::codecvt::do_length cppreference.com
cppreference.com
Espaces de noms
Variantes

std::codecvt::length, std::codecvt::do_length

De cppreference.com

<metanoindex/>

 
 
Bibliothque localisations
Locales et facettes
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
Classification des caractres
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.
Conversions
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classes de facettes catgorie de 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.
Catgories de facettes
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.
Spcifique aux paramtres rgionaux facettes
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.
Facettes de conversion de code
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.
 
 
<tbody> </tbody>
Dclar dans l'en-tte <locale>
public: int length( stateT& state, const externT* from, const externT* from_end, std::size_t max ) const
(1)
protected: int do_length( stateT& state, const externT* from, const externT* from_end, std::size_t max ) const
(2)

1)

fonction de membre du public, appelle le do_length fonction membre de la classe la plus drive .
Original:
public member function, calls the member function do_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.

2)

tente de convertir les caractres externT du tableau de caractres dfini par [from, from_end), compte tenu de l'tat initial state la conversion, la plupart des max internT caractres, et renvoie le nombre de caractres externT que cette conversion serait consomment. Modifie state comme si en excutant do_in(state, from, from_end, from, to, to+max, to) pour certains tampon de sortie [to, to+max) imaginaire .
Original:
attempts to convert the externT characters from the character array defined by [from, from_end), given initial conversion state state, to at most max internT characters, and returns the number of externT characters that such conversion would consume. Modifies state as if by executing do_in(state, from, from_end, from, to, to+max, to) for some imaginary [to, to+max) output buffer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Retourne la valeur

Le nombre de caractres externT qui seraient consomms en cas de conversion par do_in() jusqu' ce que soit tous les caractres from_end-from ont t consommes ou max internT personnages taient un producteur ou une erreur de conversion produit .
Original:
The number of externT characters that would be consumed if converted by do_in() until either all from_end-from characters were consumed or max internT characters were producer, or a conversion error occurred.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La spcialisation non-conversion std::codecvt<char, char, std::mbstate_t> retours std::min(max, from_end-from)
Original:
The non-converting specialization std::codecvt<char, char, std::mbstate_t> returns std::min(max, from_end-from)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemple

#include <locale>
#include <string>
#include <iostream>
int main()
{
    //  narrow multibyte encoding
    std::string s = "z\u00df\u6c34\U0001d10b"; // or u8"z"
                      // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9d\x84\x8b";
    std::mbstate_t mb = std::mbstate_t();
    std::cout << "Only the first " <<
              std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(
                    std::locale("en_US.utf8")
              ).length(mb, &s[0], &s[s.size()], 2)
              << " bytes out of " << s.size() << " would be consumed "
                 " to produce the first 2 characters\n";
}

Rsultat :

Only the first 3 bytes out of 10 would be consumed to produce the first 2 characters

Voir aussi

[
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.
]
convertit une chane de Externt internt, comme lors de la lecture du fichier
Original:
converts a string from externT to internT, such as when reading from file
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 protge) [edit]

Web Proxy Viewer  |  New URL  |  Original Page