Espaces de noms
Variantes
Affichages
Actions

std::messages

De cppreference.com
< cpp‎ | locale

 
 
Bibliothèque localisations
Locales et facettes
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
Classification des caractères
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.
Conversions
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classes de facettes catégorie de base
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.
Catégories de facettes
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.
Spécifique aux paramètres régionaux facettes
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.
Facettes de conversion de code
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 locale
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::messages
Les fonctions membres
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.
messages::messages
messages::~messages
messages::open
messages::do_open
messages::get
messages::do_get
messages::close
messages::do_close
 
Defined in 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.

cpp/locale/messages basecpp/locale/locale/facetstd-messages-inheritance.svg
À propos de cette image

Inheritance diagram

Deux spécialisations sont fournis par la bibliothèque standard et sont mises en œuvre par tous les objets créés 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.
Defined in header <locale>
std::messages<char> accesses narrow string message catalog
std::messages<wchar_t> accesses wide string message catalog

Sommaire

[modifier] Types de membres

Type du membre Définition
char_type charT
string_type std::basic_string<charT>

[modifier] Fonctions membres

constructs a new messages facet
(fonction membre publique)
destructs a messages facet
(fonction membre protégée)
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) [edit]
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) [edit]
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) [edit]

[modifier] 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)

[modifier] Protégé 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 protégée) [edit]
[
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.
]
récupère 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 protégée) [edit]
[
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 protégée) [edit]

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


[modifier] 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);
}

Résultat :

"No match" in German: Keine Übereinstimmung
"Memory exhausted" in German: Speicher erschöpft

[modifier] Voir aussi

définit 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 générique)
creates a messages facet for the named locale
(classe générique)