Namensräume
Varianten
Aktionen

std::num_put::put, std::num_put::do_put

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

 
 
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_put
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_put::num_put
num_put::~num_put
num_put::put
num_put::do_put
 
Defined in header <locale>
public:

iter_type put( iter_type out, std::ios_base& str, char_type fill, bool v) const;
iter_type put( iter_type out, std::ios_base& str, char_type fill, long v) const;
iter_type put( iter_type out, std::ios_base& str, char_type fill, long long v) const;
iter_type put( iter_type out, std::ios_base& str, char_type fill, unsigned long v) const;
iter_type put( iter_type out, std::ios_base& str, char_type fill, unsigned long long v) const;
iter_type put( iter_type out, std::ios_base& str, char_type fill, double v) const;
iter_type put( iter_type out, std::ios_base& str, char_type fill, long double v) const;

iter_type put( iter_type out, std::ios_base& str, char_type fill, const void* v) const;
(1)
protected:

iter_type do_put( iter_type out, std::ios_base& str, char_type fill, bool v) const;
iter_type do_put( iter_type out, std::ios_base& str, char_type fill, long v) const;
iter_type do_put( iter_type out, std::ios_base& str, char_type fill, long long v) const;
iter_type do_put( iter_type out, std::ios_base& str, char_type fill, unsigned long) const;
iter_type do_put( iter_type out, std::ios_base& str, char_type fill, unsigned long long) const;
iter_type do_put( iter_type out, std::ios_base& str, char_type fill, double v) const;
iter_type do_put( iter_type out, std::ios_base& str, char_type fill, long double v) const;

iter_type do_put( iter_type out, std::ios_base& str, char_type fill, const void* v) const;
(2)
1)
öffentliche Member-Funktion ruft die geschützte virtuelle Member-Funktion do_put der am meisten abgeleiteten Klasse .
Original:
public member function, calls the protected virtual member function do_put 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)
schreibt Zeichen der Ausgangssequenz out die den Wert der v darstellen, formatiert wie von den Formatierungen flags str.flags() und die std::numpunct und std::ctype Facetten der locale im Strom str durchdrungen. Diese Funktion wird von allen formatierten Ausgabedatenstrom Operatoren wie std::cout << n; genannt .
Original:
writes characters to the output sequence out which represent the value of v, formatted as requested by the formatting flags str.flags() and the std::numpunct and std::ctype facets of the locale imbued in the stream str. This function is called by all formatted output stream operators, such as std::cout << 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 vier Stufen
Original:
Conversion occurs in four 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 uppercase = (str.flags() & std::ios_base::uppercase);
fmtflags floatfield = (str.flags() & std::ios_base::floatfield);
fmtflags showpos = (str.flags() & std::ios_base::showpos);
fmtflags showbase = (str.flags() & std::ios_base::showbase);
  • Wenn der Typ der v ist bool
    Original:
    If the type of v is bool
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Wenn boolalpha == 0, dann wandelt v um int geben und führt ganzzahlige Ausgabe .
    Original:
    * If boolalpha == 0, then converts v to type int and performs integer output.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Wenn boolalpha != 0 erhält std::use_facet<std::numpunct<charT>>(str.getloc()).truename() wenn v == true oder std::use_facet<std::numpunct<charT>>(str.getloc()).falsename() wenn v == false und gibt Zeichen für Zeichen c dieser Zeichenfolge out mit *out++ = c. Keine weitere Verarbeitung in diesem Fall erfolgt ist, gibt die Funktion out .
    Original:
    * If boolalpha != 0 obtains std::use_facet<std::numpunct<charT>>(str.getloc()).truename() if v == true or std::use_facet<std::numpunct<charT>>(str.getloc()).falsename() if v == false, and outputs each successive character c of that string to out with *out++ = c. No further processing is done in this case, the function returns out.
    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 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 && !uppercase, verwenden Konvertierungsspezifizierer %x
Original:
If basefield == hex && !uppercase, 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 == 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 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: 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: 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 ein Floating-Point-Typ wird das die erste anwendbare Wahl der folgenden fünf ausgewählt
    Original:
    If the type of v is a floating-point 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 floatfield == std::ios_base::fixed, verwenden Konvertierungsspezifizierer %f
Original:
If floatfield == std::ios_base::fixed, will use conversion specifier %f
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn floatfield == std::ios_base::scientific && !uppercase, verwenden Konvertierungsspezifizierer %e
Original:
If floatfield == std::ios_base::scientific && !uppercase, will use conversion specifier %e
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn floatfield == std::ios_base::scientific, verwenden Konvertierungsspezifizierer %E
Original:
If floatfield == std::ios_base::scientific, will use conversion specifier %E
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn floatfield == (std::ios_base::fixed | std::ios_base::scientific) && !uppercase, verwenden Konvertierungsspezifizierer %a (seit C++11)
Original:
If floatfield == (std::ios_base::fixed | std::ios_base::scientific) && !uppercase, will use conversion specifier %a (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 floatfield == std::ios_base::fixed | std::ios_base::scientific, verwenden Konvertierungsspezifizierer %A (seit C++11)
Original:
If floatfield == std::ios_base::fixed | std::ios_base::scientific, will use conversion specifier %A (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 !uppercase, verwenden Konvertierungsspezifizierer %g
Original:
If !uppercase, 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.
Andernfalls verwenden Konvertierungsspezifizierer %G
Original:
otherwise, 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 long double die Länge Modifizierer L wird dem Konvertierungsspezifizierer hinzugefügt .
    Original:
    * If the type of v is long double, the length modifier L is added to the conversion specifier.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Außerdem, wenn floatfield != (ios_base::fixed | ios_base::scientific), dann Präzision Modifikator hinzugefügt, um str.precision() gesetzt
    Original:
    * Additionally, if floatfield != (ios_base::fixed | ios_base::scientific), then precision modifier is added, set to str.precision()
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Für beide Integer-und Floating-Point-Typen, wenn showbase gesetzt ist, wird der Modifikator # vorangestellt. Wenn showpos gesetzt ist, wird der Modifikator + vorangestellt .
    Original:
    For both integer and floating-point types, if showbase is set, the modifier # is prepended. If showpos is set, the modifier + is prepended.
    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.
  • Ein schmaler Zeichenkette wird, als ob durch einen Aufruf std::printf(spec, v) in der "C"-Locale, wo spec ist die gewählte Konvertierungsspezifizierer erstellt .
    Original:
    A narrow character string is created as if by a call to std::printf(spec, v) in the "C" locale, where spec is the chosen conversion specifier.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Stage 2: locale-spezifischen Umwandlung

  • Jeder Charakter c in Stufe 1, außer dem Komma '.' erhalten wird, wird CharT indem std::use_facet<std::ctype<CharT>>(str.getloc()).widen(c) umgewandelt .
    Original:
    Every character c obtained in Stage 1, other than the decimal point '.', is converted to CharT by calling std::use_facet<std::ctype<CharT>>(str.getloc()).widen(c).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Für arithmetische Typen wird das Tausendertrennzeichen aus std::use_facet<std::numpunct<CharT>>(str.getloc()).thousands_sep() erhalten werden, in der Reihenfolge nach den Gruppierung Regeln std::use_facet<std::numpunct<CharT>>(str.getloc()).grouping() vorgesehen ist, eingeführt
    Original:
    For arithmetic types, the thousands separator character, obtained from std::use_facet<std::numpunct<CharT>>(str.getloc()).thousands_sep(), is inserted into the sequence according to the grouping rules provided by std::use_facet<std::numpunct<CharT>>(str.getloc()).grouping()
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Dezimalpunkt Zeichen ('.') werden durch std::use_facet<std::numpunct<CharT>>(str.getloc()).decimal_point() ersetzt
    Original:
    Decimal point characters ('.') are replaced by std::use_facet<std::numpunct<CharT>>(str.getloc()).decimal_point()
    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: Polsterung

  • Die Anpassung Flag wird wie von std::fmtflags adjustfield = (flags & (std::ios_base::adjustfield)) erhalten und untersucht, um Polsterung Standort identifiziert, wie folgt
    Original:
    The adjustment flag is obtained as if by std::fmtflags adjustfield = (flags & (std::ios_base::adjustfield)) and examined to identify padding location, as follows
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Wenn adjustfield == std::ios_base::left, wird Pad nach
Original:
If adjustfield == std::ios_base::left, will pad after
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn adjustfield == std::ios_base::right, wird Pad vor
Original:
If adjustfield == std::ios_base::right, will pad before
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn adjustfield == std::ios_base::internal und ein Vorzeichen tritt in der Darstellung, wird Pad nach dem Schild
Original:
If adjustfield == std::ios_base::internal and a sign character occurs in the representation, will pad after the sign
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn adjustfield == std::ios_base::internal und Stage 1 Darstellung begann mit 0x oder 0X, wird Pad nach dem x oder X
Original:
If adjustfield == std::ios_base::internal and Stage 1 representation began with 0x or 0X, will pad after the x or X
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ansonsten wird Pad vor
Original:
otherwise, will pad before
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Wenn str.width() nicht Null ist (zB std::setw nur verwendet wurde) und die Anzahl der Chart nach Stufe 2 ist kleiner als str.width(), dann Kopien der fill Zeichen werden an der Position, die durch padding, um die Länge der Sequenz str.width() bringen eingefügt.
    Original:
    If str.width() is non-zero (e.g. std::setw was just used) and the number of CharT's after Stage 2 is less than str.width(), then copies of the fill character are inserted at the position indicated by padding to bring the length of the sequence to str.width().
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Stage 4: output

Jedes Zeichen für Zeichen c aus der Sequenz des Diagramms aus Stufe 3 wird als wenn sie von *out++ = c .
Original:
Every successive character c from the sequence of CharT's from Stage 3 is output as if by *out++ = c.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Parameter

out -
Iterator zeigt auf das erste Zeichen überschrieben werden
Original:
iterator pointing to the first character to be overwritten
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
str -
streamen, um die Formatierung der Informationen aus abzurufen
Original:
stream to retrieve the formatting information from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
fill -
Füllzeichen verwendet werden, wenn die Ergebnisse muss auf die Feldbreite aufgefüllt werden
Original:
padding character used when the results needs to be padded to the field width
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
v -
Wert auf einen String und Ausgang umwandeln
Original:
value to convert to string and output
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

out

[Bearbeiten] Notes

Die vorangehende Null durch den Konvertierungsspezifikation #o (resultierend aus der Kombination von std::showbase und std::oct zum Beispiel) erzeugt wird, nicht als Füllzeichen gezählt .
Original:
The leading zero generated by the conversion specification #o (resulting from the combination of std::showbase and std::oct for example) is not counted as a padding character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

Ausgang A Nummer über globale locale
Original:
Output a number using global locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <locale>
 
int main()
{
    auto &facet = std::use_facet<std::num_put<char>>(std::locale());
    facet.put(std::cout, std::cout, '0', 2.71);
    std::cout << '\n';
}

Output:

2,71

[Bearbeiten] Siehe auch

Einsätze formatierte Daten
Original:
inserts 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_ostream) [edit]