Name

messages class template — Facet for retrieving strings from a message catalog

Synopsis

template <typename charT>
class messages : public locale::facet, public messages_base
{
public:
  typedef charT char_type;
  typedef basic_string<charT> string_type;
  explicit messages(size_t refs = 0);
  catalog open(const basic_string<char>& fn, const locale&) const;
  string_type get(catalog c, int set, int msgid, const string_type& dfault)
    const;
  void close(catalog c) const;
  static locale::id id;
protected:
  virtual ~messages(  );
  virtual catalog do_open(const basic_string<char>&, const locale&) const;
  virtual string_type do_get(catalog, int set, int msgid, 
                             const string_type& dfault) const;
  virtual void do_close(catalog) const;
};

The messages class template is a facet for a message catalog. A message catalog is a database of textual messages that can be translated into different languages. The messages<char> and messages<wchar_t> instantiations are standard.

image with no caption

How a message catalog is found is implementation-defined. For example, a catalog name could be the name of an external file, or it could be the name of a special resource section in the program’s executable file. The mapping of message identifiers to a particular message is also implementation-defined.

As with other facets, the public members call virtual, protected members with the same name prefaced by do_. Thus, to use the facet, call the public ...

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.