std::messages
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>| Dclar dans l'en-tte <locale>
|
||
template< class CharT > class messages; |
||
Class template std::messages encapsulates retrieval of strings from message catalogs, such as the ones provided by GNU gettext or by POSIX catgets.
Inheritance diagram
Deux spcialisations sont fournis par la bibliothque standard et sont mises en uvre par tous les objets crs dans un environnement linguistique programme C + +:
Original:
Two specializations are provided by the standard library and are implemented by all locale objects created in a C++ program:
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::messages<char>
|
accesses narrow string message catalog |
std::messages<wchar_t>
|
accesses wide string message catalog |
Types de membres
| Type du membre | Dfinition |
char_type
|
charT
|
string_type
|
std::basic_string<charT>
|
Fonctions membres
| constructs a new messages facet (fonction membre publique) | |
| destructs a messages facet (fonction membre protge) | |
Invoque do_open Original: invokes do_open 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) | |
Invoque do_get Original: invokes do_get 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) | |
Invoque do_close Original: invokes do_close 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) | |
Objets membres
static std::locale::id id |
Id de la localisation 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. (objet membre public) |
Protg fonctions membres
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ouvre un catalogue message nomm Original: opens a named message catalog The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre virtuelle protge) |
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
rcupre un message partir d'un catalogue de messages ouverte Original: retrieves a message from an open message catalog The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre virtuelle protge) |
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ferme un catalogue de messages Original: closes a message catalog The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre virtuelle protge) |
Inherited from std::messages_base
Type d'
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 |
catalog
|
int |
Exemple
The following example demonstrated retrieval of messages: on a typical GNU/Linux system it reads from /usr/share/locale/de/LC_MESSAGES/sed.mo
#include <iostream>
#include <locale>
int main()
{
std::locale loc("de_DE.utf8");
std::cout.imbue(loc);
auto& facet = std::use_facet<std::messages<char>>(loc);
auto cat = facet.open("sed", loc);
if(cat < 0 )
std::cout << "Could not open german \"sed\" message catalog\n";
else
std::cout << "\"No match\" in German: "
<< facet.get(cat, 0, 0, "No match") << '\n'
<< "\"Memory exhausted\" in German: "
<< facet.get(cat, 0, 0, "Memory exhausted") << '\n';
facet.close(cat);
}
Rsultat :
"No match" in German: Keine bereinstimmung
"Memory exhausted" in German: Speicher erschpft
Voir aussi
dfinit le type de catalogue messages Original: defines messages catalog type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe gnrique) | |
| creates a messages facet for the named locale (classe gnrique) | |