Espaços nominais
Variantes
Acções

std::locale

Da cppreference.com
< cpp‎ | locale

 
 
Biblioteca localizações
Localidades e facetas
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
Classificação de caracteres
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.
Conversões
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Facet classes base da categoria
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.
Categorias faceta
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.
Específicos da localidade facetas
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.
Facetas de conversão de código
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 localidade
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::locale
Tipos de membro
Original:
Member types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale::id
locale::facet
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.
locale::locale
locale::~locale
locale::operator=
locale::combine
locale::name
locale::operator==
locale::operator!=
locale::operator()
Funções de membro estático
Original:
Static member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale::global
locale::classic
 
Defined in header <locale>
class locale;
Um objeto de std::locale classe é um conjunto de ponteiros de referência, contados a facetas. Cada objeto de fluxo do C + + biblioteca de entrada / saída está associada a um std::locale e usa suas facetas para análise e formatação de todos os dados. Além disso, um objecto localidade é associada com cada objeto basic_regex. Local objetos também podem ser usados ​​como predicados que realizam agrupamento string com os contêineres padrão e algoritmos e pode ser acessado diretamente para obter ou modificar as facetas que possuem.
Original:
An object of class std::locale is an indexed set of reference-counted pointers to facets. Each stream object of the C++ input/output library is associated with an std::locale and uses its facets for parsing and formatting of all data. In addition, a locale object is associated with each basic_regex object. Locale objects can also be used as predicates that perform string collation with the standard containers and algorithms and can be accessed directly to obtain or modify the facets they hold.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Cada localidade construída em um programa C + + tem, pelo menos, os seguintes aspectos padrão, mas um programa pode definir especializações adicionais ou facetas completamente novos e adicioná-los a qualquer objeto localidade existente.
Original:
Each locale constructed in a C++ program holds at least the following standard facets, but a program may define additional specializations or completely new facets and add them to any existing locale object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Supported facets
std::collate<char> std::collate<wchar_t>
std::ctype<char> std::ctype<wchar_t>
std::codecvt<char,char,mbstate_t>
std::codecvt<char16_t,char,mbstate_t>
std::codecvt<char32_t,char,mbstate_t>
std::codecvt<wchar_t,char,mbstate_t>
std::moneypunct<char>
std::moneypunct<char,true>
std::moneypunct<wchar_t>
std::moneypunct<wchar_t,true>
std::money_get<char> std::money_get<wchar_t>
std::money_put<char> std::money_put<wchar_t>
std::numpunct<char> std::numpunct<wchar_t>
std::num_get<char> std::num_get<wchar_t>
std::num_put<char> std::num_put<wchar_t>
std::time_get<char> std::time_get<wchar_t>
std::time_put<char> std::time_put<wchar_t>
std::messages<char> std::messages<wchar_t>

Índice

[editar] Tipos de membro

o tipo de índice faceta: cada classe faceta deve declarar ou herdar um membro estático público deste tipo
Original:
the facet index type: each facet class must declare or inherit a public static member of this type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe) [edit]
a classe base para todas as categorias faceta: cada faceta de qualquer categoria é derivado deste tipo
Original:
the base class for all facet categories: each facet of any category is derived from this type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe) [edit]
category
int
(typedef)

[editar] Objetos Membros

none
[estática]
um valor zero do tipo category indicando nenhuma categoria faceta
Original:
a zero value of type category indicating no facet category
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)
collate
[estática]
um valor bitmask de category tipo indicando a categoria faceta de agrupamento
Original:
a bitmask value of type category indicating the collate facet category
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)
ctype
[estática]
um valor bitmask de category tipo indicando a categoria faceta ctype
Original:
a bitmask value of type category indicating the ctype facet category
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)
monetary
[estática]
um valor bitmask de category tipo indicando a categoria faceta monetária
Original:
a bitmask value of type category indicating the monetary facet category
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)
numeric
[estática]
um valor bitmask de category tipo indicando a categoria faceta numérico
Original:
a bitmask value of type category indicating the numeric facet category
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)
time
[estática]
um valor de máscara de bits indicando o tipo category categoria faceta tempo
Original:
a bitmask value of type category indicating the time facet category
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)
messages
[estática]
um valor de máscara de bits indicando o tipo category categoria faceta mensagens
Original:
a bitmask value of type category indicating the messages facet category
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)
all
[estática]
collate | ctype | monetary | numeric | time | messages
(membro estático público constante)

[editar] Funções de membro

constrói uma nova localidade
Original:
constructs a new locale
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) [edit]
destrói o local e as facetas cuja referência contagem torna-se zero
Original:
destructs the locale and the facets whose reference count becomes zero
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) [edit]
substitui uma localidade
Original:
replaces a locale
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) [edit]
constrói uma localidade com tempo de compilação faceta identificada copiado de outro local
Original:
constructs a locale with compile-time identified facet copied from another locale
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) [edit]
retorna o nome da localidade ou "*" se sem nome
Original:
returns the name of the locale or "*" if unnamed
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) [edit]
comparação de igualdade entre os objetos de localidade
Original:
equality comparison between locale objects
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) [edit]
lexicographically compares two strings using this locale's collate facet
(função pública membro) [edit]
[estática]
muda a localidade global
Original:
changes the global locale
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) [edit]
[estática]
obtém-se uma referência ao local "C"
Original:
obtains a reference to the "C" locale
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) [edit]

[editar] Exemplo

Demonstra o prólogo típico de um programa local e minúsculas (multi-plataforma)
Original:
Demonstrates the typical prologue of a locale-sensitive program (cross-platform)
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>
 
int main()
{
    std::wcout << "User-preferred locale setting is " << std::locale("").name().c_str() << '\n';
    // on startup, the global locale is the "C" locale
    std::wcout << 1000.01 << '\n';
    // replace the C++ global locale as well as the C locale with the user-preferred locale
    std::locale::global(std::locale("") );
    // use the new global locale for future wide character output
    std::wcout.imbue(std::locale());
    // output the same number again
    std::wcout << 1000.01 << '\n';
}

Output:

User-preferred locale setting is en_US.UTF8
1000.01
1,000.01

[editar] Veja também

obtém uma faceta de uma localidade
Original:
obtains a facet from a 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 função) [edit]
verifica se um local implementa uma faceta específica
Original:
checks if a locale implements a specific facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de função) [edit]
define localidade
Original:
sets locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::ios_base função pública membro) [edit]
retorna local atual
Original:
returns current locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::ios_base função pública membro) [edit]