Namensräume
Varianten
Aktionen

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

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

 
 
Lokalisierungen Bibliothek
Locales und Facetten
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
Buchstaben-Klassifikation
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.
Facet Kategorie Basisklassen
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.
Facet Kategorien
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.
Locale-spezifische Facetten
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.
Code-Konvertierung Facetten
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
Member-Funktionen
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)
öffentliche Member-Funktion ruft die Member-Funktion do_get der am meisten abgeleiteten Klasse .
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)
liest Zeichen aus dem Eingabe-Iterator in und erzeugt den Wert von der Art der v unter Berücksichtigung IO-Stream Formatierung Flaggen aus str.flags(), Charakter Klassifizierung Regeln std::use_facet<std::ctype<charT>>(str.getloc()) und numerische Satzzeichen aus std::use_facet<std::numpunct<charT>>(str.getloc()). Diese Funktion wird von allen formatierte Eingabe-Stream Operatoren wie std::cin >> n; genannt .
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.
Umsetzung erfolgt in drei Stufen
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.

Inhaltsverzeichnis

[Bearbeiten] Stufe 1: Konvertierungsspezifizierer Auswahl

  • I / O-Format Flags erhalten werden, wie durch
    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);
  • Wenn die Art der v ist ein Integer-Typ, wird die die erste anwendbare Wahl der folgenden fünf ausgewählt
    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.
Wenn basefield == oct, verwenden Konvertierungsspezifizierer %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.
Wenn basefield == hex, verwenden Konvertierungsspezifizierer %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.
Wenn basefield == 0, verwenden Konvertierungsspezifizierer %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.
Wenn die Art der v unterzeichnet wird, verwenden Konvertierungsspezifizierer %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.
Wenn die Art der v unsigned ist, wird verwendet Konvertierungsspezifizierer %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.
  • Für Integer-Typen wird die Länge Modifier für die Umwandlung Spezifikation, falls erforderlich: h für short und unsigned short, l für long und unsigned long, ll für long long und 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.
  • Wenn die Art der v ist float, verwenden Konvertierungsspezifizierer %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.
  • Wenn die Art der v ist double, verwenden Konvertierungsspezifizierer %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.
  • Wenn die Art der v ist long double, verwenden Konvertierungsspezifizierer %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.
  • Wenn die Art der v ist void*, verwenden Konvertierungsspezifizierer %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.
  • Wenn der Typ der v ist bool und boolalpha==0, verläuft, als ob der Typ des v ist long, außer dem Wert, der in v in Stufe 3 gespeichert werden .
    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.
  • Wenn die Art der v ist bool und boolalpha!=0 der folgende Text ersetzt die Stufen 2 und 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.
  • * Nachfolgende Zeichen aus dem Eingabe-Iterator in erhalten werden gegen die Zeichenfolgen aus std::use_facet<std::numpunct<charT>>(str.getloc()).falsename() und std::use_facet<std::numpunct<charT> >(str.getloc()).truename() nur nach Bedarf erhalten, um die eindeutige Übereinstimmung zu identifizieren abgestimmt. Die Eingabe Iterator in wird end nur bei Bedarf, um ein Zeichen zu erhalten verglichen .
    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.
  • * Wenn die Zielsequenz eindeutig abgestimmt wird, wird auf die entsprechende v bool Wert eingestellt. Andernfalls wird in false v gespeichert und std::ios_base::failbit wird err zugeordnet. Wenn eindeutige Übereinstimmung nicht gefunden werden konnte, bevor die Eingabe beendet (in==end), wird err|=std::ios_base::eofbit ausgeführt .
    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.

[Bearbeiten] Stufe 2: Charakter-Extraktion

  • Wenn in==end, Stufe 2 sofort beendet wird, werden keine weiteren Zeichen extrahiert
    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.
  • Das nächste Zeichen wird von in extrahiert, wie wenn sie von 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.
  • * Wenn die Zeichen entspricht einem "0123456789abcdefxABCDEFX+-", erweitert, um der Ländereinstellung char_type wie von std::use_facet<std::ctype<charT>>(str.getloc()).widen(), wird es an die entsprechende char umgewandelt .
    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.
  • * Wenn der Charakter entspricht dem Dezimaltrennzeichen (std::use_facet<std::numpunct<charT>>(str.getloc()).decimal_point())), wird es durch '.' ersetzt .
    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.
  • * Wenn die Zeichen entspricht das Tausendertrennzeichen (std::use_facet<std::numpunct<charT>>(str.getloc()).thousands_sep()) und die Tausende Trennung in Gebrauch ist überhaupt std::use_facet<std::numpunct<charT>>(str.getloc()).grouping().length() != 0, dann, wenn der Dezimalpunkt '.' wurde noch nicht angesammelt, wird die Position des Zeichens rememebered, aber der Charakter ansonsten ignoriert. Wenn der Dezimalpunkt bereits angesammelt, wird das Zeichen verworfen und Stage 2 endet .
    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.
  • * Auf jeden Fall wird die Prüfung durchgeführt, ob die char aus den vorherigen Schritten erhalten wird in dem Eingabefeld die durch die gegebene std::scanf Konvertierungsspezifizierer in Stufe 1 ausgewählt geparst werden würde, erlaubt. Wenn es erlaubt ist, wird es in einem temporären Puffer und Stufe 2 Wiederholungen akkumuliert. Wenn es nicht erlaubt ist, endet Stage 2 .
    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.

[Bearbeiten] Stufe 3: Umwandlung und Speicherung

  • Die Sequenz des in Stufe 2 chars akkumuliert wird, um einen numerischen Wert umgewandelt
    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.
  • * Die Eingabe erfolgt wie von std::scanf mit der Umwandlung Spezifizierer in Stage 1 (bis C + +11) gewählt analysiert
    Original:
    * The input is parsed as if by std::scanf with the conversion specifier selected in Stage 1 (bis C + +11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Die Eingabe erfolgt wie von std::strtoll für Ganzzahl analysiert v, std::strtoull für unsigned integer v oder std::strtold für Fließkomma-v (seit 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 (seit C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Wenn die Umwandlung Funktion ausfällt, um das gesamte Feld zu überführen, wird der Wert in 0 v (seit C++11) gespeichert
    Original:
    If the conversion function fails to convert the entire field, the value 0 is stored in v (seit C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Wenn die Umwandlung Funktion führt einen positiven Wert zu groß, um in der Art der v passt, wird die positive darstellbare Wert in v (seit C++11) gespeichert
    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 (seit C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Wenn die Umwandlung Funktion führt einen negativen Wert zu groß, um in der Art der v passen, wird die meisten negativen darstellbare Wert in v (seit C++11) gespeichert
    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 (seit C++11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • In jedem Fall, wenn die Umsetzungsfunktion ausfällt std::ios_base::failbit wird err zugeordnet
    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.
  • Andernfalls wird das numerische Ergebnis der Umwandlung in v gespeichert
    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.
  • * Wenn der Typ v ist bool und boolalpha nicht gesetzt ist, dann, wenn der Wert gespeichert werden soll 0 wird false gespeichert, wenn der Wert gespeichert werden soll 1, true gespeichert ist, für jeden anderen Wert std::ios_base::failbit zugeordnet ist 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.
  • Danach wird Zifferngruppierung überprüft. wenn die Position eines der Tausender-Trennzeichen in Stage 2 verworfen nicht mit der Gruppierung nach std::use_facet<std::numpunct<charT>>(str.getloc()).grouping() vorgesehen ist, std::ios_base::failbit um err zugeordnet .
    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.
  • Wenn Stufe 2 durch den Test beendet wurde in==end wird err|=std::ios_base::eofbit ausgeführt, um die eof-Bit gesetzt .
    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.

[Bearbeiten] Rückgabewert

in

[Bearbeiten] Notes

In C + 98 / C 03 +, wenn ein Fehler auftritt, v bleibt unverändert. In C + 11, wird auf einen Wert eingestellt, wie oben beschrieben .
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.

[Bearbeiten] Beispiel

[Bearbeiten] Siehe auch

Extrakte formatierte Daten
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.

(öffentliche Elementfunktion of std::basic_istream) [edit]