Espaços nominais
Variantes
Acções

std::regex_traits::transform_primary

Da cppreference.com
< cpp‎ | regex‎ | regex traits

 
 
Biblioteca de expressões regulares
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Algoritmos
Original:
Algorithms
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Iteradores
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Exceções
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Características
Original:
Traits
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Constantes
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
 
std::regex_traits
Funções de membro
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.
regex_traits::regex_traits
regex_traits::length
regex_traits::translate
regex_traits::translate_nocase
regex_traits::transform
regex_traits::transform_primary
regex_traits::lookup_collatename
regex_traits::lookup_classname
regex_traits::isctype
regex_traits::value
regex_traits::imbue
regex_traits::getloc
 
template< class ForwardIt >
string_type transform_primary( ForwardIt first, ForwardIt last) const
Obtém a chave principal de classificação (caso ignorando, diacríticos, variante, etc) para a seqüência de caracteres [first, last), de tal forma que se uma chave principal de classificação compara a menos de uma outra chave principal de classificação com operator<, em seguida, a seqüência de caracteres que produziu a primeira chave de classificação vem antes a seqüência de caracteres que produziu a chave de classificação em segundo lugar, em ordem o local atualmente imbuído de agrupamento principal.
Original:
Obtains the primary (ignoring case, diacritics, variant, etc) sort key for the character sequence [first, last), such that if a primary sort key compares less than another primary sort key with operator<, then the character sequence that produced the first sort key comes before the character sequence that produced the second sort key, in the currently imbued locale's primary collation order.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
A biblioteca regex usa esta característica para combinar caracteres contra classes de equivalência. Por exemplo, o [[=a=]] regex é equivalente ao carácter c1 se traits.transform_primary(c1) é equivalente a traits.transform_primary("a") (o que é verdadeiro para qualquer c1 de "AÀÁÂÃÄÅaàáâãäå"). Note que transform_primary() usa um argumento de seqüência de caracteres, como as classes de equivalência pode ser multi-caractere, como [[=ll=]].
Original:
The regex library uses this trait to match characters against equivalence classes. For example, the regex [[=a=]] is equivalent to the character c1 if traits.transform_primary(c1) is equivalent to traits.transform_primary("a") (which is true for any c1 from "AÀÁÂÃÄÅaàáâãäå"). Note that transform_primary() takes a character sequence argument because equivalence classes may be multicharacter, such as [[=ll=]].
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Não há maneira portátil para definir chave de classificação principal em termos de std::locale vez que a conversão a partir da chave de agrupamento retornado por std::collate::transform() para a chave primária equivalência é específica para cada caso, e se o utilizador substitui o std::collate faceta, que a conversão não é mais conhecido por std::regex_traits a biblioteca norma. Especializações biblioteca padrão de std::regex_traits retornar uma string vazia, a menos que a faceta std::collate do local atualmente imbuído não foi substituída pelo usuário, e ainda corresponde fornecido pelo sistema faceta std::collate), em que std::collate_byname<charT>::transform(first, last) caso é executado ea chave tipo que produz é convertidos para a chave de classificação esperada primário utilizando uma conversão de localidade específica.
Original:
There is no portable way to define primary sort key in terms of std::locale since the conversion from the collation key returned by std::collate::transform() to the primary equivalence key is locale-specific, and if the user replaces the std::collate facet, that conversion is no longer known to the standard library's std::regex_traits. Standard library specializations of std::regex_traits return an empty string unless the std::collate facet of the currently-imbued locale was not replaced by the user, and still matches the system-supplied std::collate facet), in which case std::collate_byname<charT>::transform(first, last) is executed and the sort key it produces is converted to the expected primary sort key using a locale-specific conversion.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Parâmetros

first, last -
um par de iteradores que determina a seqüência de caracteres para comparar
Original:
a pair of iterators which determines the sequence of characters to compare
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type requirements
-
ForwardIt must meet the requirements of ForwardIterator.

[editar] Valor de retorno

A chave principal de classificação para a seqüência de caracteres [first, last) na localidade atualmente imbuído, caso ignorando, variante, diacríticos, etc
Original:
The primary sort key for the character sequence [first, last) in the currently imbued locale, ignoring case, variant, diacritics, etc.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

Demonstra o recurso regex que funciona através transform_primary ()
Original:
Demonstrates the regex feature that works through transform_primary()
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 <regex>
 
int main()
{
    std::locale::global(std::locale("en_US.UTF-8"));
    std::wstring str = L"AÀÁÂÃÄÅaàáâãäå";
    std::wregex re(L"[[=a=]]*", std::regex::basic);
    std::cout << std::boolalpha << std::regex_match(str, re) << '\n';
}

Saída:

true