std::ctype<div class="t-tr-text"><char><div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig"><char></div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div>
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 ctype<char>; |
||
Esta especialização de std::ctype encapsula características do personagem de classificação para
char tipo. Ao contrário de propósito geral std::ctype, pesquisa de tabela é usada para classificar caracteres. O std::ctype<char> classe base implementa classificação de caracteres equivalente à localidade "C". As regras de classificação pode ser prorrogado ou alterado, se construída como std::ctype_byname<char> ou como uma faceta definido pelo usuário derivada. Todas as funções de entrada std::istream formatados são obrigados a usar std::ctype<char> para classing personagem durante a análise da entrada. Original:
This specialization of std::ctype encapsulates character classification features for type
char. Unlike general-purpose std::ctype, table lookup is used to classify characters. The base class std::ctype<char> implements character classification equivalent to the "C" locale. The classification rules can be extended or modified if constructed as std::ctype_byname<char> or as a user-defined derived facet. All std::istream formatted input functions are required to use std::ctype<char> for character classing during input parsing. 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
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
|
char
|
Funções de membro
constrói uma faceta std::ctype<char> novo Original: constructs a new std::ctype<char> 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 std::ctype<char> Original: destructs a std::ctype<char> 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) | |
obtém a tabela de classificação caráter Original: obtains the character classification table 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) | |
[estática] |
obtém o local "C" tabela de classificação caráter Original: obtains the "C" locale character classification table The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função public static membro) |
classifica um personagem ou uma seqüência de caracteres, usando a tabela de classificação Original: classifies a character or a character sequence, using the classification table 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) | |
localiza o primeiro caractere em uma seqüência que está de acordo com a classificação dada, usando a tabela de classificação Original: locates the first character in a sequence that conforms to given classification, using the classification table 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) | |
| locates the first character in a sequence that fails given classification, using the classification table (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. (of std::ctype 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. (of std::ctype 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. (of std::ctype 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. (of std::ctype função pública membro)
| |
Protegido funções 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 of std::ctype 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 of std::ctype 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 of std::ctype 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 of std::ctype função de membro)
|
Objetos Membros
static std::locale::id id [estática] |
' 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. (membro estático público constante) |
static const std::size_t table_size [estática] |
tamanho da tabela de classificação, leaest em 256 Original: size of the classification table, at leaest 256 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) |
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 <char> ctype tokenizar de um arquivo CSV
Original:
The following example demonstrates modification of 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 <vector>
#include <locale>
#include <sstream>
// This ctype facet classifies commas and endlines as whitespace
struct csv_whitespace : std::ctype<char> {
static const mask* make_table()
{
// make a copy of the "C" locale table
static std::vector<mask> v(classic_table(), classic_table() + table_size);
v[','] |= space; // comma will be classified as whitespace
v[' '] &= ~space; // space will not be classified as whitespace
return &v[0];
}
csv_whitespace(std::size_t refs = 0) : ctype(make_table(), false, refs) {}
};
int main()
{
std::string in = "Column 1,Column 2,Column 3\n123,456,789";
std::string token;
std::cout << "default locale:\n";
std::istringstream s1(in);
while(s1 >> token)
std::cout << " " << token << '\n';
std::cout << "locale with modified ctype:\n";
std::istringstream s2(in);
s2.imbue(std::locale(s2.getloc(), new csv_whitespace()));
while(s2 >> token)
std::cout << " " << 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
define tabelas de classificação de caracteres Original: defines character classification tables 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) | |
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) | |