std::locale
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>| Déclaré dans l'en-tête <locale>
|
||
class locale; |
||
Un objet de la classe std::locale est un ensemble indexé de pointeurs de référence comptés à facettes. Chaque objet de flux de C + + entrées / sorties bibliothèque est associé à un std::locale et utilise ses facettes pour analyse et mise en forme de toutes les données. En outre, un objet locale est associée à chaque objet basic_regex. Objets Locale peuvent également être utilisées comme prédicats qui effectuent collation chaîne avec les conteneurs standard et des algorithmes et peut être consulté directement pour obtenir ou modifier les facettes qu'ils détiennent .
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.
You can help to correct and verify the translation. Click here for instructions.
Chaque paramètre régional construit dans un programme C + + contient au moins les aspects suivants standard, mais un programme peut définir des spécialisations supplémentaires ou des facettes inédites et ajoutez-les à n'importe quel objet locale existante .
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.
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>
|
Types de membres
le type d'index facettes: chaque classe doit déclarer facette ou d'hériter d'un membre statique public de ce type 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) | |
la classe de base pour toutes les catégories de facettes: chaque facette de toute catégorie provient de ce type 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) | |
category |
int (typedef) |
Objets membres
none [ 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. |
une valeur de zéro de type category indiquant l'absence de facette catégorie 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. (constante membre statique publique) |
collate [ 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. |
une valeur de masque de bits indiquant le type category la catégorie facette collate 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. (constante membre statique publique) |
ctype [ 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. |
une valeur de masque de bits indiquant le type category la catégorie facette 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. (constante membre statique publique) |
monetary [ 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. |
une valeur de masque de bits indiquant le type category la catégorie facette monétaire 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. (constante membre statique publique) |
numeric [ 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. |
une valeur de masque de bits indiquant le type category la catégorie facette numérique 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. (constante membre statique publique) |
time [ 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. |
une valeur de masque de bits indiquant le type category la catégorie facette du temps 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. (constante membre statique publique) |
messages [ 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. |
une valeur de masque de bits indiquant le type category la catégorie facette des messages 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. (constante membre statique publique) |
all [ 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. |
collate | ctype | monetary | numeric | time | messages (constante membre statique publique) |
Fonctions membres
construit un nouveau local 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. (fonction membre publique) | |
Détruit les paramètres régionaux et les multiples facettes dont la référence de comptage devient nulle 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. (fonction membre publique) | |
remplace un lieu 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. (fonction membre publique) | |
construit un local avec la compilation facette identifié copié depuis un autre lieu 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. (fonction membre publique) | |
retourne le nom de la langue ou "*" si pas de nom 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. (fonction membre publique) | |
comparaison d'égalité entre les objets locale 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. (fonction membre publique) | |
compare lexicographiquement deux chaînes en utilisant les facettes de ce lieu de rassembler Original: lexicographically compares two strings using this locale's collate 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) | |
[ 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. |
change la locale globale 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. (fonction membre publique statique) |
[ 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. |
obtient une référence à la localisation "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. (fonction membre publique statique) |
Exemple
Démontre le prologue typique d'un programme sensible aux paramètres régionaux (cross-platform)
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.
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';
}
Résultat :
User-preferred locale setting is en_US.UTF8
1000.01
1,000.01
Voir aussi
obtient une facette d'un lieu 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. (fonction générique) | |
vérifie si une locale met en œuvre une facette spécifique 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. (fonction générique) | |
fixe locale 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. (fonction membre publique de std::ios_base)
| |
retourne localisation en cours 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. (fonction membre publique de std::ios_base)
|