| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
messages::closemessages::do_close |
Defined in header <locale> | ||
public: void close( catalog c)const; | (1) | |
protected: virtualvoid do_close( catalog c)const; | (2) | |
do_close of the most derived class.catalog (inherited fromstd::messages_base), which was obtained fromopen().Contents |
| c | - | a valid open catalog identifier, on whichclose() has not yet been called |
(none)
On POSIX systems, this function call usually translates to a call tocatclose(). In GNU libstdc++, which is implemented in terms of GNUgettext(), it does nothing.
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";elsestd::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);}
Possible output:
"No match" in German: Keine Übereinstimmung"Memory exhausted" in German: Speicher erschöpft