Namensräume
Varianten
Aktionen

std::codecvt::out, std::codecvt::do_out

Aus cppreference.com
< cpp‎ | locale‎ | codecvt

 
 
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.
 
 
Defined in header <locale>
public:

result out( stateT& state,
            const internT* from,
            const internT* from_end,
            const internT*& from_next,
            externT* to,
            externT* to_end,

            externT*& to_next ) const;
(1)
protected:

result do_out( stateT& state,
               const internT* from,
               const internT* from_end,
               const internT*& from_next,
               externT* to,
               externT* to_end,

               externT*& to_next ) const;
(2)
1)
öffentliche Member-Funktion ruft die Member-Funktion do_out der am meisten abgeleiteten Klasse .
Original:
public member function, calls the member function do_out 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)
Wenn dies codecvt Facette definiert eine Umwandlung, übersetzt die internen Zeichen aus dem Quellbereich [from, from_end) zu externen Zeichen, indem die Ergebnisse in den nachfolgenden Orten ab to. Konvertiert nicht mehr als from_end - from internen Zeichen und schreibt nicht mehr als to_end - to externen Zeichen. Leaves from_next und to_next zeigt ein über das letzte Element erfolgreich konvertiert .
Original:
If this codecvt facet defines a conversion, translates the internal characters from the source range [from, from_end) to external characters, placing the results in the subsequent locations starting at to. Converts no more than from_end - from internal characters and writes no more than to_end - to external characters. Leaves from_next and to_next pointing one beyond the last element successfully converted.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn dies codecvt Facette nicht definiert eine Umwandlung, werden keine Zeichen umgewandelt. to_next eingestellt, dass sie gleich to, state unverändert ist, und std::codecvt_base::noconv zurückgegeben .
Original:
If this codecvt facet does not define a conversion, no characters are converted. to_next is set to be equal to to, state is unchanged, and std::codecvt_base::noconv is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Rückgabewert

Ein Wert vom Typ std::codecvt_base::result, was auf den Erfolg Status wie folgt:
Original:
A value of type std::codecvt_base::result, indicating the success status as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ok
Konvertierung abgeschlossen
Original:
conversion completed
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
partial
nicht genügend Platz im Ausgabepuffer oder unerwartete Ende Quellpuffer
Original:
not enough space in the output buffer or unexpected end of source buffer
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
error
begegnet ein Zeichen, das nicht konvertiert werden konnte
Original:
encountered a character that could not be converted
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
noconv
diese Facette ist nicht konvertieren, keine Ausgabe geschrieben
Original:
this facet is non-converting, no output written
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Die nicht-Converting-Spezialisierung std::codecvt<char, char, std::mbstate_t> gibt immer std::codecvt_base::noconv
Original:
The non-converting specialization std::codecvt<char, char, std::mbstate_t> always returns std::codecvt_base::noconv
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Notes

Erfordert, dass from <= from_end && to <= to_end und dass state entweder die die anfängliche Verschiebung Form oder hergestellt durch Umwandlung der vorhergehenden Zeichen in der Folge .
Original:
Requires that from <= from_end && to <= to_end and that state either representing the initial shift state or obtained by converting the preceding characters in the sequence.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Während codecvt N unterstützt: M Konvertierungen (zB UTF-16, UTF-8, wo zwei interne Zeichen notwendig sein kann, was externe auszugebenden Zeichen entscheiden), können std::basic_filebuf nur codecvt Facetten, die eine 1 definieren: N Umstellung, dass es muss ein internes Zeichen in einer Zeit zu verarbeiten, wenn das Schreiben in eine Datei .
Original:
While codecvt supports N:M conversions (e.g. UTF-16 to UTF-8, where two internal characters may be necessary to decide what external characters to output), std::basic_filebuf can only use codecvt facets that define a 1:N conversion, that is it must be able to process one internal character at a time when writing to a file.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Bei der Durchführung von N: M Umbauten, kann diese Funktion std::codecvt_base::partial nach dem Verzehr alle Quell-Zeichen () zurückzukehren. Dies bedeutet, dass eine andere interne Charakter erforderlich ist, um die Konvertierung abzuschließen (z. B. bei der Umwandlung von UTF-16, UTF-8, wenn das letzte Zeichen in der Quelle Puffer ist ein hohes Ersatzzeichen) .
Original:
When performing N:M conversions, this function may return std::codecvt_base::partial after consuming all source characters (). This means that another internal character is needed to complete the conversion (e.g. when converting UTF-16 to UTF-8, if the last character in the source buffer is a high surrogate).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Die Wirkung auf state ist bewusst nicht spezifiziert. Im Standard-Facetten, wird es zur Verschiebung Zustand wie beim Aufruf std::wcsrtombs halten und wird daher aktualisiert, um den Schaltzustand nach dem letzten erfolgreich konvertiert Charakter widerspiegeln, sondern eine benutzerdefinierte Facette ist kostenlos, es zu benutzen, um andere Zustand zu halten, z. B. die Anzahl der Sonderzeichen gestoßen .
Original:
The effect on state is deliberately unspecified. In standard facets, it is used to maintain shift state like when calling std::wcsrtombs, and is therefore updated to reflect the shift state after the last successfully converted character, but a user-defined facet is free to use it to maintain any other state, e.g. count the number of special characters encountered.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

#include <iostream>
#include <string>
#include <locale>
int main()
{
    std::locale::global(std::locale("en_US.utf8"));
    auto& f = std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(std::locale());
    std::wstring internal = L"z\u00df\u6c34\U0001d10b"; // L"zß水𝄋"
 
    // note that the following can be done with wstring_convert
    std::mbstate_t mb = std::mbstate_t(); // initial shift state
    std::string external(internal.size() * f.max_length(), '\0'); 
    const wchar_t* from_next;
    char* to_next;
    f.out(mb, &internal[0], &internal[internal.size()], from_next,
              &external[0], &external[external.size()], to_next);
    // error checking skipped for brevity
    external.resize(to_next - &external[0]);
 
    std::cout << "The string in narrow multibyte encoding: " << external << '\n';
}

Output:

The string in narrow multibyte encoding: zß水𝄋

[Bearbeiten] Siehe auch

[virtuell]
schreibt Zeichen der zugehörige Datei aus der Put-Bereich
Original:
writes characters to the associated file from the put area
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuellen geschützten Member-Funktion of std::basic_filebuf) [edit]
wandelt eine breite Folge in ein Byte String
Original:
converts a wide string into a byte string
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::wstring_convert) [edit]
wandelt eine breite Zeichenfolge in schmale Multibyte Zeichenkette gegebenen Zustand
Original:
converts a wide string to narrow multibyte character string, given state
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion) [edit]
[virtuell]
wandelt eine Zeichenkette aus externT um Internt wie beim Lesen aus Datei
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.

(virtuellen geschützten Member-Funktion) [edit]