Espaces de noms
Variantes
Affichages
Actions

std::num_get::get, std::num_get::do_get

De cppreference.com
< cpp‎ | locale‎ | num get

 
 
Bibliothèque 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 caractères
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 catégorie 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.
Catégories 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.
Spécifique aux paramètres régionaux 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.
 
std::num_get
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
num_get::num_get
num_get::~num_get
num_get::get
num_get::do_get
 
Defined in header <locale>
public:

iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, bool& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, long& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, long long& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, unsigned short& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, unsigned int& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, unsigned long& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, unsigned long long& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, float& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, double& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,
               std::ios_base::iostate& err, long double& v );
iter_type get( iter_type in, iter_type end, std::ios_base& str,

               std::ios_base::iostate& err, void*& v );
(1)
protected:

iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, bool& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, long& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, long long& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, unsigned short& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, unsigned int& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, unsigned long& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, unsigned long long& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, float& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, double& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,
                  std::ios_base::iostate& err, long double& v );
iter_type do_get( iter_type in, iter_type end, std::ios_base& str,

                  std::ios_base::iostate& err, void*& v );
(2)
1)
fonction de membre du public, appelle le do_get fonction membre de la classe la plus dérivée .
Original:
public member function, calls the member function do_get 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)
lit les caractères à partir de la in itérateur d'entrée et génère la valeur du type de v, en tenant compte des drapeaux d'entrée-sortie de flux de mise en page à partir de str.flags(), à partir de règles de classification de caractères std::use_facet<std::ctype<charT>>(str.getloc()), et les signes de ponctuation numériques à partir std::use_facet<std::numpunct<charT>>(str.getloc()). Cette fonction est appelée par tous les opérateurs format de flux d'entrée tels que std::cin >> n; .
Original:
reads characters from the input iterator in and generates the value of the type of v, taking into account IO stream formatting flags from str.flags(), character classification rules from std::use_facet<std::ctype<charT>>(str.getloc()), and numeric punctuation characters from std::use_facet<std::numpunct<charT>>(str.getloc()). This function is called by all formatted input stream operators such as std::cin >> n;.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversion a lieu en trois étapes
Original:
Conversion occurs in three stages
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Sommaire

[modifier] Étape 1: spécificateur de conversion de sélection

  • I / O indicateurs de format sont obtenus, comme par
    Original:
    I/O format flags are obtained, as if by
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
fmtflags basefield = (str.flags() & std::ios_base::basefield);
fmtflags boolalpha = (str.flags() & std::ios_base::boolalpha);
  • Si le type de v est un type entier, le choix du premier lieu des cinq suivantes est sélectionnée:
    Original:
    If the type of v is an integer type, the the first applicable choice of the following five is selected:
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Si basefield == oct, utilisera spécificateur de conversion %o
Original:
If basefield == oct, will use conversion specifier %o
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si basefield == hex, utilisera spécificateur de conversion %X
Original:
If basefield == hex, will use conversion specifier %X
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si basefield == 0, utilisera spécificateur de conversion %i
Original:
If basefield == 0, will use conversion specifier %i
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si le type de v est signé, va utiliser spécificateur de conversion %d
Original:
If the type of v is signed, will use conversion specifier %d
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si le type de v n'est pas signé, utilisera spécificateur de conversion %u
Original:
If the type of v is unsigned, will use conversion specifier %u
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Pour les types entiers, modificateur de longueur est ajoutée à la spécification de conversion si nécessaire: h pour short et unsigned short, l pour long et unsigned long, ll pour long long et unsigned long long
    Original:
    For integer types, length modifier is added to the conversion specification if necessary: h for short and unsigned short, l for long and unsigned long, ll for long long and unsigned long long
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si le type de v est float, utilisera spécificateur de conversion %g
    Original:
    If the type of v is float, will use conversion specifier %g
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si le type de v est double, utilisera spécificateur de conversion %lg
    Original:
    If the type of v is double, will use conversion specifier %lg
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si le type de v est long double, utilisera spécificateur de conversion %Lg
    Original:
    If the type of v is long double, will use conversion specifier %Lg
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si le type de v est void*, utilisera spécificateur de conversion %p
    Original:
    If the type of v is void*, will use conversion specifier %p
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si le type de v est bool et boolalpha==0, procède comme si le type de v est long, à l'exception de la valeur à stocker dans v l'étape 3 .
    Original:
    If the type of v is bool and boolalpha==0, proceeds as if the type of v is long, except for the value to be stored in v in stage 3.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si le type de v est bool et boolalpha!=0, les dispositions suivantes remplacent les étapes 2 et 3:
    Original:
    If the type of v is bool and boolalpha!=0, the following replaces stages 2 and 3:
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Caractères successifs obtenus à partir de l'itérateur d'entrée in sont comparés aux séquences de caractères obtenus à partir de std::use_facet<std::numpunct<charT>>(str.getloc()).falsename() et std::use_facet<std::numpunct<charT> >(str.getloc()).truename() seulement comme nécessaire pour identifier la correspondance unique. Le in itérateur d'entrée est comparée à end uniquement lorsque c'est nécessaire pour obtenir un caractère .
    Original:
    * Successive characters obtained from the input iterator in are matched against the character sequences obtained from std::use_facet<std::numpunct<charT>>(str.getloc()).falsename() and std::use_facet<std::numpunct<charT> >(str.getloc()).truename() only as necessary as to identify the unique match. The input iterator in is compared to end only when necessary to obtain a character.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Si la séquence cible est idéalement adapté, v est réglé sur la valeur bool correspondant. Sinon false est stocké dans v et std::ios_base::failbit est attribué à err. Si le match exceptionnel ne peut être trouvée avant l'entrée terminée (in==end), err|=std::ios_base::eofbit est exécuté .
    Original:
    * If the target sequence is uniquely matched, v is set to the corresponding bool value. Otherwise false is stored in v and std::ios_base::failbit is assigned to err. If unique match could not be found before the input ended (in==end), err|=std::ios_base::eofbit is executed.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[modifier] Etape 2: extraction de caractères

  • Si in==end, étape 2 est immédiatement terminée, sans autres caractères sont extraits
    Original:
    If in==end, Stage 2 is terminated immediately, no further characters are extracted
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Le caractère suivant est extrait de in comme par char_type ct = *in;
    Original:
    The next character is extracted from in as if by char_type ct = *in;
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Si le caractère correspond à l'une des "0123456789abcdefxABCDEFX+-", élargie à type_caractere l'environnement local, comme par std::use_facet<std::ctype<charT>>(str.getloc()).widen(), il est converti à l'char correspondante .
    Original:
    * If the character matches one of "0123456789abcdefxABCDEFX+-", widened to the locale's char_type as if by std::use_facet<std::ctype<charT>>(str.getloc()).widen(), it is converted to the corresponding char.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Si le caractère correspond au séparateur décimal (std::use_facet<std::numpunct<charT>>(str.getloc()).decimal_point())), il est remplacé par '.' .
    Original:
    * If the character matches the decimal point separator (std::use_facet<std::numpunct<charT>>(str.getloc()).decimal_point())), it is replaced by '.'.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Si le caractère correspond au séparateur de milliers (std::use_facet<std::numpunct<charT>>(str.getloc()).thousands_sep()) et le séparateur de milliers est utilisé à toutes les std::use_facet<std::numpunct<charT>>(str.getloc()).grouping().length() != 0, alors si le '.' point décimal n'a pas encore été accumulées, la position du personnage est rememebered, mais le personnage est autrement ignorés. Si la virgule a déjà été accumulé, le personnage est éliminé et la phase 2 se termine .
    Original:
    * If the character matches the thousands separator (std::use_facet<std::numpunct<charT>>(str.getloc()).thousands_sep()) and the thousands separation is in use at all std::use_facet<std::numpunct<charT>>(str.getloc()).grouping().length() != 0, then if the decimal point '.' has not yet been accumulated, the position of the character is rememebered, but the character is otherwise ignored. If the decimal point has already been accumulated, the character is discarded and Stage 2 terminates.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Dans tous les cas, le contrôle est effectué si le char obtenus à partir des étapes précédentes est autorisé dans le champ de saisie qui serait analysé par std::scanf donné le spécificateur de conversion sélectionné à l'étape 1. Si elle est autorisée, il est accumulée dans un tampon temporaire et l'étape 2 répétitions. Si ce n'est pas permis, étape 2 se termine .
    Original:
    * In any case, the check is made whether the char obtained from the previous steps is allowed in the input field that would be parsed by std::scanf given the conversion specifier selected in Stage 1. If it is allowed, it is accumulated in a temporary buffer and Stage 2 repeats. If it is not allowed, Stage 2 terminates.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[modifier] Étape 3: conversion et le stockage

  • La séquence de chars accumulées dans l'étape 2 est converti en une valeur numérique
    Original:
    The sequence of chars accumulated in Stage 2 is converted to a numeric value
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * L'entrée est analysé comme par std::scanf avec le spécificateur de conversion sélectionné à l'étape 1 (avant C++11)
    Original:
    * The input is parsed as if by std::scanf with the conversion specifier selected in Stage 1 (avant C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * L'entrée est analysé comme par std::strtoll entier signé pour v, std::strtoull pour v entier non signé, ou std::strtold en virgule flottante v (depuis C++11)
    Original:
    * The input is parsed as if by std::strtoll for signed integer v, std::strtoull for unsigned integer v, or std::strtold for floating-point v (depuis C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si la fonction de conversion ne parvient pas à convertir la totalité du champ, le 0 valeur est stockée dans v (depuis C++11)
    Original:
    If the conversion function fails to convert the entire field, the value 0 is stored in v (depuis C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si les résultats de la fonction de conversion en une valeur positive trop volumineux pour tenir dans le type de v, la valeur la plus positive représentable est stocké dans v (depuis C++11)
    Original:
    If the conversion function results in a positive value too large to fit in the type of v, the most positive representable value is stored in v (depuis C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si les résultats de la fonction de conversion en une valeur négative trop volumineux pour tenir dans le type de v, la valeur la plus négative représentable est stocké dans v (depuis C++11)
    Original:
    If the conversion function results in a negative value too large to fit in the type of v, the most negative representable value is stored in v (depuis C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Dans tous les cas, si la fonction de conversion échoue std::ios_base::failbit est attribué à err
    Original:
    In any case, if the conversion function fails std::ios_base::failbit is assigned to err
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Dans le cas contraire, le résultat de la conversion numérique est stockée dans v
    Original:
    Otherwise, the numeric result of the conversion is stored in v
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Si le type de v est bool et boolalpha n'est pas définie, alors si la valeur à stocker est 0, false est stockée, si la valeur à stocker est 1, true est stocké, pour tout std::ios_base::failbit autre valeur est affectée à err .
    Original:
    * If the type of v is bool and boolalpha is not set, then if the value to be stored is 0, false is stored, if the value to be stored is 1, true is stored, for any other value std::ios_base::failbit is assigned to err.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Après cela, groupement des chiffres est cochée. si la position selon l'une quelconque des séparateurs de milliers de rebut de l'étape 2 ne correspond pas à l'groupement fourni par std::use_facet<std::numpunct<charT>>(str.getloc()).grouping(), std::ios_base::failbit est affecté à err .
    Original:
    After this, digit grouping is checked. if the position of any of the thousands separators discarded in Stage 2 does not match the grouping provided by std::use_facet<std::numpunct<charT>>(str.getloc()).grouping(), std::ios_base::failbit is assigned to err.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Si l'étape 2 a été résilié par le test in==end, err|=std::ios_base::eofbit est exécuté pour positionner le bit .. eof
    Original:
    If Stage 2 was terminated by the test in==end, err|=std::ios_base::eofbit is executed to set the eof bit.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[modifier] Retourne la valeur

in

[modifier] Notes

En C + 98 / C + +03, si une erreur se produit, v reste inchangé. En C + +11, il est réglé à une valeur telle que décrite ci-dessus .
Original:
In C++98/C++03, if an error occurs, v is left unchanged. In C++11, it is set to a value as described above.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Exemple

[modifier] Voir aussi

extraits des données formatées
Original:
extracts formatted data
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique de std::basic_istream) [edit]