Files
cppdraft_translate/cppdraft/locale/messages.md
2025-10-25 03:02:53 +03:00

4.8 KiB
Raw Blame History

[locale.messages]

28 Text processing library [text]

28.3 Localization library [localization]

28.3.4 Standard locale categories [locale.categories]

28.3.4.8 The message retrieval category [category.messages]

28.3.4.8.2 Class template messages [locale.messages]

28.3.4.8.2.1 General [locale.messages.general]

🔗

namespace std {class messages_base {public:using catalog = unspecified signed integer type; }; templateclass messages : public locale::facet, public messages_base {public:using char_type = charT; using string_type = basic_string; explicit messages(size_t refs = 0);

catalog open(const string& 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:~messages(); virtual catalog do_open(const string&, const locale&) const; virtual string_type do_get(catalog, int set, int msgid, const string_type& dfault) const; virtual void do_close(catalog) const; };}

1

#

Values of type messages_base::catalog usable as arguments to members get and close can be obtained only by calling member open.

28.3.4.8.2.2 Members [locale.messages.members]

🔗

catalog open(const string& name, const locale& loc) const;

1

#

Returns: do_open(name, loc).

🔗

string_type get(catalog cat, int set, int msgid, const string_type& dfault) const;

2

#

Returns: do_get(cat, set, msgid, dfault).

🔗

void close(catalog cat) const;

3

#

Effects: Calls do_close(cat).

28.3.4.8.2.3 Virtual functions [locale.messages.virtuals]

🔗

catalog do_open(const string& name, const locale& loc) const;

1

#

Returns: A value that may be passed to get() to retrieve a message from the message catalog identified by the string name according to an implementation-defined mapping.

The result can be used until it is passed to close().

2

#

Returns a value less than 0 if no such catalog can be opened.

3

#

Remarks: The locale argument loc is used for character set code conversion when retrieving messages, if needed.

🔗

string_type do_get(catalog cat, int set, int msgid, const string_type& dfault) const;

4

#

Preconditions: cat is a catalog obtained from open() and not yet closed.

5

#

Returns: A message identified by arguments set, msgid, and dfault, according to an implementation-defined mapping.

If no such message can be found, returns dfault.

🔗

void do_close(catalog cat) const;

6

#

Preconditions: cat is a catalog obtained from open() and not yet closed.

7

#

Effects: Releases unspecified resources associated with cat.

8

#

Remarks: The limit on such resources, if any, isimplementation-defined.