Files
2025-10-25 03:02:53 +03:00

7.1 KiB
Raw Permalink Blame History

[locale.category]

28 Text processing library [text]

28.3 Localization library [localization]

28.3.3 Locales [locales]

28.3.3.1 Class locale [locale]

28.3.3.1.2 Types [locale.types]

28.3.3.1.2.1 Type locale::category [locale.category]

🔗

using category = int;

1

#

Valid category values include the locale member bitmask elementscollate,ctype,monetary,numeric,time, andmessages, each of which represents a single locale category.

In addition, locale member bitmask constant none is defined as zero and represents no category.

And locale member bitmask constant all is defined such that the expression(collate | ctype | monetary | numeric | time | messages | all) == all is true, and represents the union of all categories.

Further, the expression (X | Y), where X and Y each represent a single category, represents the union of the two categories.

2

#

locale member functions expecting a category argument require one of the category values defined above, or the union of two or more such values.

Such a category value identifies a set of locale categories.

Each locale category, in turn, identifies a set of locale facets, including at least those shown in Table 91.

Table 91 — Locale category facets [tab:locale.category.facets]

🔗
Category
Includes facets
🔗
collate
collate, collate<wchar_t>
🔗
ctype
ctype, ctype<wchar_t>
🔗 codecvt<char, char, mbstate_t>
🔗 codecvt<wchar_t, char, mbstate_t>
🔗
monetary
moneypunct, moneypunct<wchar_t>
🔗 moneypunct<char, true>, moneypunct<wchar_t, true>
🔗 money_get, money_get<wchar_t>
🔗 money_put, money_put<wchar_t>
🔗
numeric
numpunct, numpunct<wchar_t>
🔗 num_get, num_get<wchar_t>
🔗 num_put, num_put<wchar_t>
🔗
time
time_get, time_get<wchar_t>
🔗 time_put, time_put<wchar_t>
🔗
messages
messages, messages<wchar_t>

3

#

For any locale loc either constructed, or returned by locale::classic(), and any facet Facet shown in Table 91,has_facet(loc) is true.

Each locale member function which takes a locale::category argument operates on the corresponding set of facets.

4

#

An implementation is required to provide those specializations for facet templates identified as members of a category, and for those shown in Table 92.

Table 92 — Required specializations [tab:locale.spec]

🔗
Category
Includes facets
🔗
collate
collate_byname, collate_byname<wchar_t>
🔗
ctype
ctype_byname, ctype_byname<wchar_t>
🔗 codecvt_byname<char, char, mbstate_t>
🔗 codecvt_byname<wchar_t, char, mbstate_t>
🔗
monetary
moneypunct_byname<char, International>
🔗 moneypunct_byname<wchar_t, International>
🔗 money_get<C, InputIterator>
🔗 money_put<C, OutputIterator>
🔗
numeric
numpunct_byname, numpunct_byname<wchar_t>
🔗 num_get<C, InputIterator>, num_put<C, OutputIterator>
🔗
time
time_get<char, InputIterator>
🔗 time_get_byname<char, InputIterator>
🔗 time_get<wchar_t, InputIterator>
🔗 time_get_byname<wchar_t, InputIterator>
🔗 time_put<char, OutputIterator>
🔗 time_put_byname<char, OutputIterator>
🔗 time_put<wchar_t, OutputIterator>
🔗 time_put_byname<wchar_t, OutputIterator>
🔗
messages
messages_byname, messages_byname<wchar_t>

5

#

The provided implementation of members of facets num_get and num_put calls use_facet(l) only for facet F of types numpunct and ctype, and for locale l the value obtained by calling member getloc() on the ios_base& argument to these functions.

6

#

In declarations of facets, a template parameter with name InputIterator or OutputIterator indicates the set of all possible specializations on parameters that meet theCpp17InputIterator requirements orCpp17OutputIterator requirements, respectively ([iterator.requirements]).

A template parameter with name C represents the set of types containing char, wchar_t, and any otherimplementation-defined character container types ([defns.character.container]) that meet the requirements for a character on which any of the iostream components can be instantiated.

A template parameter with name International represents the set of all possible specializations on a bool parameter.