std::messages
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <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.
Due specializzazioni sono forniti dalla libreria standard e sono attuate da tutti gli oggetti delle impostazioni locali creati in un programma 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.
Definizione nell'header
<locale> | |
std::messages<char> | accesses narrow string message catalog |
std::messages<wchar_t> | accesses wide string message catalog |
Indice |
[modifica] Membri tipi
Membro tipo
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
|
charT
|
string_type
|
std::basic_string<charT>
|
[modifica] Membri funzioni
constructs a new messages facet (metodo pubblico) | |
destructs a messages facet (protetto funzione membro) | |
Invoca 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. (metodo pubblico) | |
Invoca 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. (metodo pubblico) | |
Invoca 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. (metodo pubblico) |
[modifica] Membri oggetti
static std::locale::id id |
' Id del locale 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. (attributo pubblico) |
[modifica] Protetto funzioni membro
[virtuale] |
apre un catalogo di messaggi di nome 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. (virtuale protetto funzione membro) |
[virtuale] |
recupera un messaggio da un catalogo messaggio aperto 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. (virtuale protetto funzione membro) |
[virtuale] |
chiude un catalogo di messaggi 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. (virtuale protetto funzione membro) |
Inherited from std::messages_base
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 |
catalog
|
int |
[modifica] Esempio
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); }
Output:
"No match" in German: Keine Übereinstimmung "Memory exhausted" in German: Speicher erschöpft
[modifica] Vedi anche
definisce il catalogo messaggi tipo 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 template) | |
creates a messages facet for the named locale (classe template) |