std::messages_byname
is a std::messages facet which encapsulates retrieval of strings from message catalogs of the locale specified at its construction.
The standard library is guaranteed to provide the following specializations:
std::messages_byname<char> narrow/multibyte message catalog access std::messages_byname<wchar_t> wide string message catalog access [edit] Nested types [edit] Member functions constructs a newmessages_byname
facet
messages_byname
facet
Constructs a new std::messages_byname
facet for a locale with name.
refs is used for resource management: if refs == 0, the implementation destroys the facet, when the last std::locale object holding it is destroyed. Otherwise, the object is not destroyed.
Parameters name - the name of the locale refs - the number of references that link to the facet std::messages_byname::~messages_bynameprotected:
~messages_byname();
Destroys the facet.
Inherited from std::messages Nested types [edit] Data members Member functions invokesdo_open
std::messages<CharT>
) [edit] invokes do_get
std::messages<CharT>
) [edit] invokes do_close
std::messages<CharT>
) [edit] Protected member functions opens a named message catalog
std::messages<CharT>
) [edit] retrieves a message from an open message catalog
std::messages<CharT>
) [edit] closes a message catalog
std::messages<CharT>
) [edit] Inherited from std::messages_base Nested types Type Definition catalog
an unspecified signed integer type [edit] Example
#include <iostream> #include <locale> void try_with(const std::locale& loc) { const std::messages<char>& facet = std::use_facet<std::messages<char>>(loc); std::messages<char>::catalog cat = facet.open("sed", std::cout.getloc()); if (cat < 0) std::cout << "Could not open \"sed\" message catalog\n"; else std::cout << "\"No match\" " << facet.get(cat, 0, 0, "No match") << '\n' << "\"Memory exhausted\" " << facet.get(cat, 0, 0, "Memory exhausted") << '\n'; facet.close(cat); } int main() { std::locale loc("en_US.utf8"); std::cout.imbue(loc); try_with(std::locale(loc, new std::messages_byname<char>("de_DE.utf8"))); try_with(std::locale(loc, new std::messages_byname<char>("fr_FR.utf8"))); try_with(std::locale(loc, new std::messages_byname<char>("ja_JP.utf8"))); }
Possible output:
"No match" Keine Ãbereinstimmung "Memory exhausted" Speicher erschöpft "No match" Pas de concordance "Memory exhausted" Mémoire épuisée "No match" ç §åãã¾ãã "Memory exhausted" ã¡ã¢ãªã¼ãè¶³ãã¾ãã[edit] See also implements retrieval of strings from message catalogs
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4