std::ctype
De 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>| Definido no cabeçalho <locale>
|
||
template< class CharT > class ctype; |
||
Classe ctype encapsula funcionalidades de classificação de caracteres. Todas as operações realizadas através de fluxo de entrada
std::basic_istream<charT> usar o std::ctype<charT> do local imbuído no fluxo de identificar caracteres de espaço para geração de tokens de entrada. Operações de saída de fluxo para aplicar std::ctype<charT>::widen() estreitos-caráter argumentos antes da saída.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
Duas especializações são fornecidos pela biblioteca padrão
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.
Defined in header
<locale> | |
| std::ctype<char> | fornece equivalentes da classificação de localidade "C". Esta especialização usa pesquisa de tabela para classificação de caracteres
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>
|
fornece equivalentes caracteres largos do local classificação "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. |
Índice
Tipos de membro
Tipo de membro
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
|
Funções de membro
constrói uma faceta ctype novo 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. (função pública membro) | |
destrói uma faceta 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. (protegido função de membro) | |
Invoca 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. (função pública membro) | |
Invoca 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. (função pública membro) | |
Invoca 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. (função pública membro) | |
Invoca 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. (função pública membro) | |
Invoca 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. (função pública membro) | |
Invoca 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. (função pública membro) | |
Invoca 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. (função pública membro) |
Protegido funções de membro
[virtual] |
classifica um personagem ou uma sequência de caracteres 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. (virtual protegido função de membro) |
[virtual] |
localiza o primeiro caractere em uma seqüência que está de acordo com a classificação dada 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. (virtual protegido função de membro) |
[virtual] |
localiza o primeiro caractere em uma seqüência que não classificação 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. (virtual protegido função de membro) |
[virtual] |
converte um caractere ou caracteres em maiúsculas 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. (virtual protegido função de membro) |
[virtual] |
converte um caractere ou caracteres em letras minúsculas 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. (virtual protegido função de membro) |
[virtual] |
converte um caractere ou caracteres de char para 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. (virtual protegido função de membro) |
[virtual] |
converte um caractere ou caracteres de charT para 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. (virtual protegido função de membro) |
Objetos Membros
static std::locale::id id |
' ID da localidade 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. (objeto membro público) |
Herdado de std::ctype_base
Member types
Tipo
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
|
bitmask tipo não especificado (tipo de enumeração, inteiro, 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 [estática] |
o valor de mask classificação de caracteres identificando espaços em branco 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. (membro estático público constante) |
print [estática] |
o valor de mask identificar classificação de caracteres impressos 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. (membro estático público constante) |
cntrl [estática] |
o valor de mask classificação identificar controle personagem 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. (membro estático público constante) |
upper [estática] |
o valor de mask identificar classificação de caracteres em letras maiúsculas 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. (membro estático público constante) |
lower [estática] |
o valor de mask identificar classificação de caracteres em letras minúsculas 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. (membro estático público constante) |
alpha [estática] |
o valor de mask identificar classificação caractere alfabético 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. (membro estático público constante) |
digit [estática] |
o valor de identificação de classificação mask caractere de dígito 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. (membro estático público constante) |
punct [estática] |
o valor de identificação de classificação mask pontuação personagem 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. (membro estático público constante) |
xdigit [estática] |
o valor de mask identificar classificação de caracteres hexadecimal dígitos 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. (membro estático público constante) |
blank [estática] (C++11) |
o valor de mask identificar classificação de caracteres em branco 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. (membro estático público constante) |
alnum [estática] |
alpha | digit (membro estático público constante) |
graph [estática] |
alnum | punct (membro estático público constante) |
Exemplo
O exemplo a seguir demonstra a modificação de uma ctype diferente <char> ctype tokenizar de um arquivo 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.
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';
}
}
Saída:
default locale:
Column
1,Column
2,Column
3
123,456,789
locale with modified ctype:
Column 1
Column 2
Column 3
123
456
789
Veja também
especialização de std::ctype para char tipo 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. (especialização modelo. classe) | |
define categorias de classificação de caracteres 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. (modelo de classe) | |
cria uma faceta ctype para a localidade chamada 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. (modelo de classe) |