GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::messages::get,std::messages::do_get(3) C++ Standard Libary std::messages::get,std::messages::do_get(3)

std::messages::get,std::messages::do_get - std::messages::get,std::messages::do_get


Defined in header <locale>
public:
string_type get( catalog cat, int set, int msgid, const string_type& dfault ) (1)
const;
protected:
virtual string_type do_get( catalog cat, int set, int msgid, const string_type& (2)
dfault ) const;


1) Public member function, calls the protected virtual member function do_get of the
most derived class.


2) Obtains a message from the open message catalog cat using the values set, msgid
and dfault in implementation-defined manner. If the expected message is not found in
the catalog, returns a copy of dfault.


cat - identifier of message catalog obtained from open() and not yet passed to
close()
set - implementation-defined argument, message set in POSIX
msgid - implementation-defined argument, message id in POSIX
dfault - the string to look up in the catalog (if the catalog uses string look-up)
and also the string to return in case of a failure


The message from the catalog or a copy of dfault if none was found.


On POSIX systems, this function call usually translates to a call to catgets(), and
the parameters set, msgid, and dfault are passed to catgets() as-is. In GNU
libstdc++, this function ignores set and msgid and simply calls GNU gettext(dfault)
in the required locale.


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


#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);
}


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

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.