std::ctype
Aus cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| definiert in Header <locale>
|
||
template< class CharT > class ctype; |
||
Klasse ctype kapselt Charakter Klassifizierung Funktionen. Alle Stream Input Operationen durch
std::basic_istream<charT> durchgeführt verwenden std::ctype<charT> des Gebietsschemas in dem Strom Leerzeichen zur Eingabe tokenization identifizieren durchdrungen. Stream Output-Operationen gelten std::ctype<charT>::widen() zu schmalen Zeichen Argumente vor der Ausgabe .Original:
Class ctype encapsulates character classification features. All stream input operations performed through
std::basic_istream<charT> use the std::ctype<charT> of the locale imbued in the stream to identify whitespace characters for input tokenization. Stream output operations apply std::ctype<charT>::widen() to narrow-character arguments prior to output.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inheritance diagram
Zwei Spezialisierungen werden durch die Standard-Bibliothek zur Verfügung gestellt
Original:
Two specializations are provided by the standard library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
definiert in Header
<locale> | |
| std::ctype<char> | bietet Äquivalente des "C"-Locale Klassifizierung. Diese Spezialisierung verwendet Lookup-Tabelle für Zeichen Klassifizierung
Original: provides equivalents of the "C" locale classification. This specialization uses table lookup for character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
std::ctype<wchar_t>
|
bietet Breitzeichen Äquivalente des "C"-Locale Klassifizierung
Original: provides wide character equivalents of the "C" locale classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Mitglied Typen
Mitglied Typ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
char_type
|
CharT
|
Member-Funktionen
baut eine neue ctype Facette Original: constructs a new ctype facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
zerstört sich eine ctype Facette Original: destructs a ctype facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (geschützt Member-Funktion) | |
Beruft do_is Original: invokes do_is The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Beruft do_scan_is Original: invokes do_scan_is The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Beruft do_scan_not Original: invokes do_scan_not The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Beruft do_toupper Original: invokes do_toupper The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Beruft do_tolowerOriginal: invokes do_tolowerThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Beruft do_widen Original: invokes do_widen The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Beruft do_narrow Original: invokes do_narrow The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Geschützt Member-Funktionen
[virtuell] |
stuft ein Zeichen oder eine Zeichenfolge Original: classifies a character or a character sequence 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) |
[virtuell] |
ortet das erste Zeichen in einer Sequenz, die zu bestimmten Klassifizierung entspricht Original: locates the first character in a sequence that conforms to given classification 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) |
[virtuell] |
findet das erste Zeichen in einer Sequenz, die givne Klassifizierung ausfällt Original: locates the first character in a sequence that fails givne classification 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) |
[virtuell] |
wandelt ein oder mehrere Zeichen in Großbuchstaben Original: converts a character or characters to uppercase 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) |
[virtuell] |
wandelt ein oder mehrere Zeichen in Kleinbuchstaben Original: converts a character or characters to lowercase 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) |
[virtuell] |
wandelt ein Zeichen oder Zeichen aus char um charT Original: converts a character or characters from char to charT 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) |
[virtuell] |
wandelt ein Zeichen oder Zeichen aus charT um char Original: converts a character or characters from charT to char 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) |
Mitglied widerspricht
static std::locale::id id |
ID des Gebietsschemas Original: id of the locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Member-Objekt) |
Inherited from std::ctype_base
Member types
Type
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
mask
|
unbestimmte Bitmaske Typ (Aufzählung, Integer-Typ oder bitset)
Original: unspecified bitmask type (enumeration, integer type, or bitset) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Member constants
space [statisch] |
der Wert mask Identifizieren Leerzeichen Klassifizierung Original: the value of mask identifying whitespace character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
print [statisch] |
der Wert mask identifizieren druckbare Zeichen Klassifizierung Original: the value of mask identifying printable character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
cntrl [statisch] |
der Wert mask identifizieren Steuerzeichen Klassifizierung Original: the value of mask identifying control character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
upper [statisch] |
der Wert mask identifizieren Großbuchstaben Klassifizierung Original: the value of mask identifying uppercase character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
lower [statisch] |
der Wert mask identifizieren Kleinbuchstaben Klassifizierung Original: the value of mask identifying lowercase character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
alpha [statisch] |
der Wert mask identifizieren Buchstaben Klassifizierung Original: the value of mask identifying alphabetic character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
digit [statisch] |
der Wert mask identifizieren Ziffernzeichen Klassifizierung Original: the value of mask identifying digit character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
punct [statisch] |
der Wert mask identifizieren Satzzeichen Klassifizierung Original: the value of mask identifying punctuation character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
xdigit [statisch] |
der Wert mask identifizieren Hexadezimalziffer Charakter Klassifizierung Original: the value of mask identifying hexadecimal digit character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
blank [statisch] (C++11) |
der Wert mask identifizieren Leerzeichen Klassifizierung Original: the value of mask identifying blank character classification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public static Mitglied konstanten) |
alnum [statisch] |
alpha | digit (public static Mitglied konstanten) |
graph [statisch] |
alnum | punct (public static Mitglied konstanten) |
Beispiel
Das folgende Beispiel demonstriert Modifikation eines ctype andere als ctype <char> zu einer CSV-Datei tokenize
Original:
The following example demonstrates modification of a ctype other than ctype<char> to tokenize of a CSV file
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
#include <iostream>
#include <locale>
#include <sstream>
struct csv_whitespace : std::ctype<wchar_t> {
bool do_is(mask m, char_type c) const
{
if ((m & space) && c == L' ') {
return false; // space will NOT be classified as whitespace
}
if ((m & space) && c == L',') {
return true; // comma will be classified as whitespace
}
return ctype::do_is(m, c); // leave the rest to the parent class
}
};
int main()
{
std::wstring in = L"Column 1,Column 2,Column 3\n123,456,789";
std::wstring token;
std::wcout << "default locale:\n";
std::wistringstream s1(in);
while (s1 >> token) {
std::wcout << " " << token << '\n';
}
std::wcout << "locale with modified ctype:\n";
std::wistringstream s2(in);
s2.imbue(std::locale(s2.getloc(), new csv_whitespace()));
while (s2 >> token) {
std::wcout << " " << token<< '\n';
}
}
Output:
default locale:
Column
1,Column
2,Column
3
123,456,789
locale with modified ctype:
Column 1
Column 2
Column 3
123
456
789
Siehe auch
Spezialisierung std::ctype für Typ char Original: specialization of std::ctype for type char The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (class Template-Spezialisierung) | |
definiert Charakter Klassifizierungskategorien Original: defines character classification categories The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Klassen-Template) | |
schafft eine ctype Facette für die benannte locale Original: creates a ctype facet for the named locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Klassen-Template) | |