Espaces de noms
Variantes
Affichages
Actions

std::ctype

De cppreference.com
< cpp‎ | locale

 
 
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::ctype
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.
ctype::ctype
ctype::~ctype
ctype::is
ctype::do_is
ctype::scan_id
ctype::do_scan_id
ctype::scan_not
ctype::do_scan_not
ctype::toupper
ctype::do_toupper
ctype::tolower
ctype::do_tolower
ctype::widen
ctype::do_widen
ctype::narrow
ctype::do_narrow
 
Defined in header <locale>
template< class CharT >
class ctype;
Classe ctype encapsule fonctions de classification de caractères. Toutes les opérations effectuées par le biais de flux d'entrée std::basic_istream<charT> utiliser le std::ctype<charT> de la localisation imprégnée dans le flux d'identifier les caractères d'espacement pour tokenization entrée. Opérations de sortie de flux s'applique à std::ctype<charT>::widen() étroites caractères arguments avant la sortie .
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.
cpp/locale/ctype basecpp/locale/locale/facetstd-ctype-inheritance.svg
À propos de cette image

Inheritance diagram

Deux spécialisations sont fournis par la bibliothèque standard
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.
Defined in header <locale>
std::ctype<char>
fournit des équivalents de la classification "C". Cette spécialisation utilise table de consultation pour la classification des caractères
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>
fournit des équivalents de caractères larges de la classification "C"
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.

Sommaire

[modifier] Types de membres

Type du membre Définition
char_type CharT

[modifier] Fonctions membres

construit une facette ctype nouvelle
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.

(fonction membre publique)
Détruit une facette ctype
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.

(fonction membre protégée)
Invoque 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.

(fonction membre publique) [edit]
Invoque 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.

(fonction membre publique) [edit]
Invoque 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.

(fonction membre publique) [edit]
Invoque 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.

(fonction membre publique) [edit]
Invoque do_tolower
Original:
invokes do_tolower
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) [edit]
Invoque 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.

(fonction membre publique) [edit]
Invoque 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.

(fonction membre publique) [edit]

[modifier] Protégé fonctions membres

[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
classer un caractère ou une séquence de caractères
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.

(fonction membre virtuelle protégée) [edit]
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
localise le premier caractère dans une séquence qui se conforme à la classification proposée
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.

(fonction membre virtuelle protégée) [edit]
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
localise le premier caractère dans une séquence qui échoue classification givne
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.

(fonction membre virtuelle protégée) [edit]
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
convertit un ou plusieurs caractères en majuscules
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.

(fonction membre virtuelle protégée) [edit]
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
convertit un ou plusieurs caractères en minuscules
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.

(fonction membre virtuelle protégée) [edit]
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
convertit un ou plusieurs caractères de char à 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.

(fonction membre virtuelle protégée) [edit]
[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
convertit un ou plusieurs caractères de charT à 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.

(fonction membre virtuelle protégée) [edit]

[modifier] Objets membres

static std::locale::id id
Id de la localisation
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.

(objet membre public)

Inherited from std::ctype_base

Member types

Type d'
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
Type de masque non spécifié (énumération, de type entier, ou 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
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de mask identifiant classification des caractères blancs
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.

(constante membre statique publique)
print
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de mask identifier la classification des caractères imprimables
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.

(constante membre statique publique)
cntrl
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de la commande mask classification des caractères d'identification
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.

(constante membre statique publique)
upper
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de mask identifier classification des caractères en majuscules
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.

(constante membre statique publique)
lower
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de mask identifier la classification des caractères minuscules
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.

(constante membre statique publique)
alpha
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de mask identifier la classification des caractères alphabétiques
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.

(constante membre statique publique)
digit
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de mask identifier la classification des caractères chiffres
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.

(constante membre statique publique)
punct
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de la ponctuation mask classification des caractères d'identification
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.

(constante membre statique publique)
xdigit
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
la valeur de mask identification hexadécimale de classification chiffre
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.

(constante membre statique publique)
blank
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
(C++11)
la valeur de mask identifier la classification des caractères vide
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.

(constante membre statique publique)
alnum
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
alpha | digit
(constante membre statique publique)
graph
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
alnum | punct
(constante membre statique publique)

[modifier] Exemple

L'exemple suivant illustre la modification d'un ctype autre que <char> ctype à tokenize d'un fichier CSV
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.

#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';
    }
}

Résultat :

default locale:
  Column
  1,Column
  2,Column
  3
  123,456,789
locale with modified ctype:
  Column 1
  Column 2
  Column 3
  123
  456
  789

[modifier] Voir aussi

spécialisation des std::ctype pour char type
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.

(classe générique spécialisée)
définit les catégories de classification des caractères
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.

(classe générique)
crée une facette ctype pour l'environnement local nommé
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.

(classe générique)