std::messages<CharT>::open,std::messages<CharT>::do_open (3) - Linux Manuals
std::messages<CharT>::open,std::messages<CharT>::do_open: std::messages<CharT>::open,std::messages<CharT>::do_open
NAME
std::messages<CharT>::open,std::messages<CharT>::do_open - std::messages<CharT>::open,std::messages<CharT>::do_open
Synopsis
Defined in header <locale>
public: (1)
catalog open( const std::basic_string<char>& name, const std::locale& loc ) const;
protected: (2)
virtual catalog do_open( const std::basic_string<char>& name, const std::locale& loc ) const;
1) Public member function, calls the protected virtual member function do_open of the most derived class.
2) Obtains a value of type catalog (inherited from std::messages_base), which can be passed to get() to retrieve messages from the message catalog named by name. This value is usable until passed to close().
Parameters
name - name of the message catalog to open
loc - a locale object that provides additional facets that may be required to read messages from the catalog, such as std::codecvt to perform wide/multibyte conversions
Return value
The non-negative value of type catalog that can be used with get() and close(). Returns a negative value if the catalog could not be opened.
Notes
On POSIX systems, this function call usually translates to a call to catopen(). In GNU libstdc++, it calls textdomain.
The actual catalog location is implementation-defined: for the catalog "sed" (message catalogs installed with the Unix utility 'sed') in German locale, for example, the file opened by this function call may be /usr/lib/nls/msg/de_DE/sed.cat, /usr/lib/locale/de_DE/LC_MESSAGES/sed.cat, or /usr/share/locale/de/LC_MESSAGES/sed.mo.
Example
The following example demonstrated retrieval of messages: on a typical GNU/Linux system it reads from /usr/share/locale/de/LC_MESSAGES/sed.mo
// Run this code
Possible output:
See also