- tmp/tmpjm8xlqj3/{from.md → to.md} +199 -387
tmp/tmpjm8xlqj3/{from.md → to.md}
RENAMED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
-
# Localization library <a id="localization">[[localization]]</a>
|
| 2 |
|
| 3 |
-
## General <a id="localization.general">[[localization.general]]</a>
|
| 4 |
|
| 5 |
-
|
| 6 |
-
encapsulate (and therefore be more portable when confronting)
|
| 7 |
-
differences. The locale facility includes internationalization
|
| 8 |
-
for character classification and string collation, numeric,
|
| 9 |
-
and date/time formatting and parsing, and message retrieval.
|
| 10 |
|
| 11 |
The following subclauses describe components for locales themselves, the
|
| 12 |
-
standard facets, and facilities from the
|
| 13 |
[[localization.summary]].
|
| 14 |
|
| 15 |
**Table: Localization library summary** <a id="localization.summary">[localization.summary]</a>
|
| 16 |
|
| 17 |
| Subclause | | Header |
|
|
@@ -19,11 +19,11 @@ standard facets, and facilities from the ISO C library, as summarized in
|
|
| 19 |
| [[locales]] | Locales | `<locale>` |
|
| 20 |
| [[locale.categories]] | Standard `locale` categories | |
|
| 21 |
| [[c.locales]] | C library locales | `<clocale>` |
|
| 22 |
|
| 23 |
|
| 24 |
-
## Header `<locale>` synopsis <a id="locale.syn">[[locale.syn]]</a>
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
namespace std {
|
| 28 |
// [locale], locale
|
| 29 |
class locale;
|
|
@@ -99,54 +99,58 @@ namespace std {
|
|
| 99 |
```
|
| 100 |
|
| 101 |
The header `<locale>` defines classes and declares functions that
|
| 102 |
encapsulate and manipulate the information peculiar to a locale.[^1]
|
| 103 |
|
| 104 |
-
## Locales <a id="locales">[[locales]]</a>
|
| 105 |
|
| 106 |
-
### Class `locale` <a id="locale">[[locale]]</a>
|
| 107 |
|
| 108 |
-
#### General <a id="locale.general">[[locale.general]]</a>
|
| 109 |
|
| 110 |
``` cpp
|
| 111 |
namespace std {
|
| 112 |
class locale {
|
| 113 |
public:
|
| 114 |
-
// types
|
|
|
|
| 115 |
class facet;
|
|
|
|
| 116 |
class id;
|
|
|
|
| 117 |
using category = int;
|
| 118 |
static const category // values assigned here are for exposition only
|
| 119 |
none = 0,
|
| 120 |
collate = 0x010, ctype = 0x020,
|
| 121 |
monetary = 0x040, numeric = 0x080,
|
| 122 |
time = 0x100, messages = 0x200,
|
| 123 |
all = collate | ctype | monetary | numeric | time | messages;
|
| 124 |
|
| 125 |
-
// construct/copy/destroy
|
| 126 |
locale() noexcept;
|
| 127 |
locale(const locale& other) noexcept;
|
| 128 |
explicit locale(const char* std_name);
|
| 129 |
explicit locale(const string& std_name);
|
| 130 |
locale(const locale& other, const char* std_name, category);
|
| 131 |
locale(const locale& other, const string& std_name, category);
|
| 132 |
template<class Facet> locale(const locale& other, Facet* f);
|
| 133 |
locale(const locale& other, const locale& one, category);
|
| 134 |
~locale(); // not virtual
|
| 135 |
const locale& operator=(const locale& other) noexcept;
|
|
|
|
|
|
|
| 136 |
template<class Facet> locale combine(const locale& other) const;
|
| 137 |
-
|
| 138 |
-
// locale operations
|
| 139 |
string name() const;
|
|
|
|
| 140 |
|
| 141 |
bool operator==(const locale& other) const;
|
| 142 |
|
| 143 |
template<class charT, class traits, class Allocator>
|
| 144 |
bool operator()(const basic_string<charT, traits, Allocator>& s1,
|
| 145 |
const basic_string<charT, traits, Allocator>& s2) const;
|
| 146 |
|
| 147 |
-
// global locale objects
|
| 148 |
static locale global(const locale&);
|
| 149 |
static const locale& classic();
|
| 150 |
};
|
| 151 |
}
|
| 152 |
```
|
|
@@ -227,13 +231,13 @@ global locale object per thread is *implementation-defined*.
|
|
| 227 |
Implementations should provide one global locale object per thread. If
|
| 228 |
there is a single global locale object for the entire program,
|
| 229 |
implementations are not required to avoid data races on it
|
| 230 |
[[res.on.data.races]].
|
| 231 |
|
| 232 |
-
#### Types <a id="locale.types">[[locale.types]]</a>
|
| 233 |
|
| 234 |
-
##### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
|
| 235 |
|
| 236 |
``` cpp
|
| 237 |
using category = int;
|
| 238 |
```
|
| 239 |
|
|
@@ -263,12 +267,10 @@ including at least those shown in [[locale.category.facets]].
|
|
| 263 |
| Category | Includes facets |
|
| 264 |
| -------- | ----------------------------------------------------- |
|
| 265 |
| collate | `collate<char>`, `collate<wchar_t>` |
|
| 266 |
| ctype | `ctype<char>`, `ctype<wchar_t>` |
|
| 267 |
| | `codecvt<char, char, mbstate_t>` |
|
| 268 |
-
| | `codecvt<char16_t, char8_t, mbstate_t>` |
|
| 269 |
-
| | `codecvt<char32_t, char8_t, mbstate_t>` |
|
| 270 |
| | `codecvt<wchar_t, char, mbstate_t>` |
|
| 271 |
| monetary | `moneypunct<char>`, `moneypunct<wchar_t>` |
|
| 272 |
| | `moneypunct<char, true>`, `moneypunct<wchar_t, true>` |
|
| 273 |
| | `money_get<char>`, `money_get<wchar_t>` |
|
| 274 |
| | `money_put<char>`, `money_put<wchar_t>` |
|
|
@@ -295,12 +297,10 @@ templates identified as members of a category, and for those shown in
|
|
| 295 |
| Category | Includes facets |
|
| 296 |
| -------- | --------------------------------------------------------- |
|
| 297 |
| collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
|
| 298 |
| ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
|
| 299 |
| | `codecvt_byname<char, char, mbstate_t>` |
|
| 300 |
-
| | `codecvt_byname<char16_t, char8_t, mbstate_t>` |
|
| 301 |
-
| | `codecvt_byname<char32_t, char8_t, mbstate_t>` |
|
| 302 |
| | `codecvt_byname<wchar_t, char, mbstate_t>` |
|
| 303 |
| monetary | `moneypunct_byname<char, International>` |
|
| 304 |
| | `moneypunct_byname<wchar_t, International>` |
|
| 305 |
| | `money_get<C, InputIterator>` |
|
| 306 |
| | `money_put<C, OutputIterator>` |
|
|
@@ -327,16 +327,17 @@ In declarations of facets, a template parameter with name
|
|
| 327 |
`InputIterator` or `OutputIterator` indicates the set of all possible
|
| 328 |
specializations on parameters that meet the *Cpp17InputIterator*
|
| 329 |
requirements or *Cpp17OutputIterator* requirements, respectively
|
| 330 |
[[iterator.requirements]]. A template parameter with name `C` represents
|
| 331 |
the set of types containing `char`, `wchar_t`, and any other
|
| 332 |
-
*implementation-defined* character
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
|
|
|
| 336 |
|
| 337 |
-
##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
|
| 338 |
|
| 339 |
``` cpp
|
| 340 |
namespace std {
|
| 341 |
class locale::facet {
|
| 342 |
protected:
|
|
@@ -371,11 +372,11 @@ For `refs == 0`, the implementation performs
|
|
| 371 |
facet) when the last `locale` object containing the facet is destroyed;
|
| 372 |
for `refs == 1`, the implementation never destroys the facet.
|
| 373 |
|
| 374 |
Constructors of all facets defined in this Clause take such an argument
|
| 375 |
and pass it along to their `facet` base class constructor. All
|
| 376 |
-
one-argument constructors defined in this Clause are
|
| 377 |
preventing their participation in implicit conversions.
|
| 378 |
|
| 379 |
For some standard facets a standard “…`_byname`” class, derived from it,
|
| 380 |
implements the virtual function semantics equivalent to that facet of
|
| 381 |
the locale constructed by `locale(const char*)` with the same name. Each
|
|
@@ -386,11 +387,11 @@ takes a `string` argument `str` and a `refs` argument, which has the
|
|
| 386 |
same effect as calling the first constructor with the two arguments
|
| 387 |
`str.c_str()` and `refs`. If there is no “…`_byname`” version of a
|
| 388 |
facet, the base class implements named locale semantics itself by
|
| 389 |
reference to other facets.
|
| 390 |
|
| 391 |
-
##### Class `locale::id` <a id="locale.id">[[locale.id]]</a>
|
| 392 |
|
| 393 |
``` cpp
|
| 394 |
namespace std {
|
| 395 |
class locale::id {
|
| 396 |
public:
|
|
@@ -403,19 +404,19 @@ namespace std {
|
|
| 403 |
|
| 404 |
The class `locale::id` provides identification of a locale facet
|
| 405 |
interface, used as an index for lookup and to encapsulate
|
| 406 |
initialization.
|
| 407 |
|
| 408 |
-
[*Note
|
| 409 |
static constructors are running, their initialization cannot depend on
|
| 410 |
programmed static initialization. One initialization strategy is for
|
| 411 |
`locale` to initialize each facet’s `id` member the first time an
|
| 412 |
instance of the facet is installed into a locale. This depends only on
|
| 413 |
static storage being zero before constructors run
|
| 414 |
[[basic.start.static]]. — *end note*]
|
| 415 |
|
| 416 |
-
#### Constructors and destructor <a id="locale.cons">[[locale.cons]]</a>
|
| 417 |
|
| 418 |
``` cpp
|
| 419 |
locale() noexcept;
|
| 420 |
```
|
| 421 |
|
|
@@ -501,11 +502,11 @@ const locale& operator=(const locale& other) noexcept;
|
|
| 501 |
|
| 502 |
*Effects:* Creates a copy of `other`, replacing the current value.
|
| 503 |
|
| 504 |
*Returns:* `*this`.
|
| 505 |
|
| 506 |
-
#### Members <a id="locale.members">[[locale.members]]</a>
|
| 507 |
|
| 508 |
``` cpp
|
| 509 |
template<class Facet> locale combine(const locale& other) const;
|
| 510 |
```
|
| 511 |
|
|
@@ -523,11 +524,21 @@ string name() const;
|
|
| 523 |
```
|
| 524 |
|
| 525 |
*Returns:* The name of `*this`, if it has one; otherwise, the string
|
| 526 |
`"*"`.
|
| 527 |
|
| 528 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
|
| 530 |
``` cpp
|
| 531 |
bool operator==(const locale& other) const;
|
| 532 |
```
|
| 533 |
|
|
@@ -539,16 +550,17 @@ copy of the other, or each has a name and the names are identical;
|
|
| 539 |
template<class charT, class traits, class Allocator>
|
| 540 |
bool operator()(const basic_string<charT, traits, Allocator>& s1,
|
| 541 |
const basic_string<charT, traits, Allocator>& s2) const;
|
| 542 |
```
|
| 543 |
|
| 544 |
-
*Effects:* Compares two strings according to the `collate<charT>`
|
|
|
|
| 545 |
|
| 546 |
*Returns:*
|
| 547 |
|
| 548 |
``` cpp
|
| 549 |
-
use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
|
| 550 |
s2.data(), s2.data() + s2.size()) < 0
|
| 551 |
```
|
| 552 |
|
| 553 |
*Remarks:* This member operator template (and therefore `locale` itself)
|
| 554 |
meets the requirements for a comparator predicate template
|
|
@@ -563,11 +575,11 @@ locale `loc` simply by [[alg.sort]], [[vector]]:
|
|
| 563 |
std::sort(v.begin(), v.end(), loc);
|
| 564 |
```
|
| 565 |
|
| 566 |
— *end example*]
|
| 567 |
|
| 568 |
-
#### Static members <a id="locale.statics">[[locale.statics]]</a>
|
| 569 |
|
| 570 |
``` cpp
|
| 571 |
static locale global(const locale& loc);
|
| 572 |
```
|
| 573 |
|
|
@@ -585,11 +597,11 @@ otherwise, the effect on the C locale, if any, is
|
|
| 585 |
*Returns:* The previous value of `locale()`.
|
| 586 |
|
| 587 |
*Remarks:* No library function other than `locale::global()` affects the
|
| 588 |
value returned by `locale()`.
|
| 589 |
|
| 590 |
-
[*Note
|
| 591 |
`setlocale` is invoked. — *end note*]
|
| 592 |
|
| 593 |
``` cpp
|
| 594 |
static const locale& classic();
|
| 595 |
```
|
|
@@ -600,11 +612,11 @@ The `"C"` locale.
|
|
| 600 |
equivalent to the value `locale("C")`.
|
| 601 |
|
| 602 |
*Remarks:* This locale, its facets, and their member functions, do not
|
| 603 |
change with time.
|
| 604 |
|
| 605 |
-
### `locale` globals <a id="locale.global.templates">[[locale.global.templates]]</a>
|
| 606 |
|
| 607 |
``` cpp
|
| 608 |
template<class Facet> const Facet& use_facet(const locale& loc);
|
| 609 |
```
|
| 610 |
|
|
@@ -623,13 +635,13 @@ template<class Facet> bool has_facet(const locale& loc) noexcept;
|
|
| 623 |
```
|
| 624 |
|
| 625 |
*Returns:* `true` if the facet requested is present in `loc`; otherwise
|
| 626 |
`false`.
|
| 627 |
|
| 628 |
-
### Convenience interfaces <a id="locale.convenience">[[locale.convenience]]</a>
|
| 629 |
|
| 630 |
-
#### Character classification <a id="classification">[[classification]]</a>
|
| 631 |
|
| 632 |
``` cpp
|
| 633 |
template<class charT> bool isspace (charT c, const locale& loc);
|
| 634 |
template<class charT> bool isprint (charT c, const locale& loc);
|
| 635 |
template<class charT> bool iscntrl (charT c, const locale& loc);
|
|
@@ -651,11 +663,11 @@ use_facet<ctype<charT>>(loc).is(ctype_base::F, c)
|
|
| 651 |
```
|
| 652 |
|
| 653 |
where `F` is the `ctype_base::mask` value corresponding to that function
|
| 654 |
[[category.ctype]].[^4]
|
| 655 |
|
| 656 |
-
#### Character conversions <a id="conversions.character">[[conversions.character]]</a>
|
| 657 |
|
| 658 |
``` cpp
|
| 659 |
template<class charT> charT toupper(charT c, const locale& loc);
|
| 660 |
```
|
| 661 |
|
|
@@ -665,13 +677,13 @@ template<class charT> charT toupper(charT c, const locale& loc);
|
|
| 665 |
template<class charT> charT tolower(charT c, const locale& loc);
|
| 666 |
```
|
| 667 |
|
| 668 |
*Returns:* `use_facet<ctype<charT>>(loc).tolower(c)`.
|
| 669 |
|
| 670 |
-
## Standard `locale` categories <a id="locale.categories">[[locale.categories]]</a>
|
| 671 |
|
| 672 |
-
### General <a id="locale.categories.general">[[locale.categories.general]]</a>
|
| 673 |
|
| 674 |
Each of the standard categories includes a family of facets. Some of
|
| 675 |
these implement formatting or parsing of a datum, for use by standard or
|
| 676 |
users’ iostream operators `<<` and `>>`, as members `put()` and `get()`,
|
| 677 |
respectively. Each such member function takes an `ios_base&` argument
|
|
@@ -685,45 +697,45 @@ The `put()` members make no provision for error reporting. (Any failures
|
|
| 685 |
of the OutputIterator argument can be extracted from the returned
|
| 686 |
iterator.) The `get()` members take an `ios_base::iostate&` argument
|
| 687 |
whose value they ignore, but set to `ios_base::failbit` in case of a
|
| 688 |
parse error.
|
| 689 |
|
| 690 |
-
Within
|
| 691 |
-
|
| 692 |
|
| 693 |
-
### The `ctype` category <a id="category.ctype">[[category.ctype]]</a>
|
| 694 |
|
| 695 |
-
#### General <a id="category.ctype.general">[[category.ctype.general]]</a>
|
| 696 |
|
| 697 |
``` cpp
|
| 698 |
namespace std {
|
| 699 |
class ctype_base {
|
| 700 |
public:
|
| 701 |
using mask = see below;
|
| 702 |
|
| 703 |
// numeric values are for exposition only.
|
| 704 |
-
static
|
| 705 |
-
static
|
| 706 |
-
static
|
| 707 |
-
static
|
| 708 |
-
static
|
| 709 |
-
static
|
| 710 |
-
static
|
| 711 |
-
static
|
| 712 |
-
static
|
| 713 |
-
static
|
| 714 |
-
static
|
| 715 |
-
static
|
| 716 |
};
|
| 717 |
}
|
| 718 |
```
|
| 719 |
|
| 720 |
The type `mask` is a bitmask type [[bitmask.types]].
|
| 721 |
|
| 722 |
-
#### Class template `ctype` <a id="locale.ctype">[[locale.ctype]]</a>
|
| 723 |
|
| 724 |
-
##### General <a id="locale.ctype.general">[[locale.ctype.general]]</a>
|
| 725 |
|
| 726 |
``` cpp
|
| 727 |
namespace std {
|
| 728 |
template<class charT>
|
| 729 |
class ctype : public locale::facet, public ctype_base {
|
|
@@ -774,11 +786,11 @@ input parsing.
|
|
| 774 |
The specializations required in [[locale.category.facets]]
|
| 775 |
[[locale.category]], namely `ctype<char>` and `ctype<wchar_t>`,
|
| 776 |
implement character classing appropriate to the implementation’s native
|
| 777 |
character set.
|
| 778 |
|
| 779 |
-
##### `ctype` members <a id="locale.ctype.members">[[locale.ctype.members]]</a>
|
| 780 |
|
| 781 |
``` cpp
|
| 782 |
bool is(mask m, charT c) const;
|
| 783 |
const charT* is(const charT* low, const charT* high, mask* vec) const;
|
| 784 |
```
|
|
@@ -796,11 +808,11 @@ const charT* scan_not(mask m, const charT* low, const charT* high) const;
|
|
| 796 |
```
|
| 797 |
|
| 798 |
*Returns:* `do_scan_not(m, low, high)`.
|
| 799 |
|
| 800 |
``` cpp
|
| 801 |
-
charT toupper(charT) const;
|
| 802 |
const charT* toupper(charT* low, const charT* high) const;
|
| 803 |
```
|
| 804 |
|
| 805 |
*Returns:* `do_toupper(c)` or `do_toupper(low, high)`.
|
| 806 |
|
|
@@ -823,11 +835,11 @@ char narrow(charT c, char dfault) const;
|
|
| 823 |
const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const;
|
| 824 |
```
|
| 825 |
|
| 826 |
*Returns:* `do_narrow(c, dfault)` or `do_narrow(low, high, dfault, to)`.
|
| 827 |
|
| 828 |
-
##### `ctype` virtual functions <a id="locale.ctype.virtuals">[[locale.ctype.virtuals]]</a>
|
| 829 |
|
| 830 |
``` cpp
|
| 831 |
bool do_is(mask m, charT c) const;
|
| 832 |
const charT* do_is(const charT* low, const charT* high, mask* vec) const;
|
| 833 |
```
|
|
@@ -899,11 +911,11 @@ value or sequence of `char` values to the corresponding `charT` value or
|
|
| 899 |
values.[^5]
|
| 900 |
|
| 901 |
The only characters for which unique transformations are required are
|
| 902 |
those in the basic character set [[lex.charset]].
|
| 903 |
|
| 904 |
-
For any named `ctype` category with a `ctype<
|
| 905 |
valid `ctype_base::mask` value `M`,
|
| 906 |
`(ctc.is(M, c) || !is(M, do_widen(c)) )` is `true`.[^6]
|
| 907 |
|
| 908 |
The second form transforms each character `*p` in the range \[`low`,
|
| 909 |
`high`), placing the result in `dest[p - low]`.
|
|
@@ -942,30 +954,30 @@ the result (or `dfault` if no simple transformation is readily
|
|
| 942 |
available) in `dest[p - low]`.
|
| 943 |
|
| 944 |
*Returns:* The first form returns the transformed value; or `dfault` if
|
| 945 |
no mapping is readily available. The second form returns `high`.
|
| 946 |
|
| 947 |
-
#### Class template `ctype_byname` <a id="locale.ctype.byname">[[locale.ctype.byname]]</a>
|
| 948 |
|
| 949 |
``` cpp
|
| 950 |
namespace std {
|
| 951 |
template<class charT>
|
| 952 |
class ctype_byname : public ctype<charT> {
|
| 953 |
public:
|
| 954 |
-
using mask =
|
| 955 |
explicit ctype_byname(const char*, size_t refs = 0);
|
| 956 |
explicit ctype_byname(const string&, size_t refs = 0);
|
| 957 |
|
| 958 |
protected:
|
| 959 |
~ctype_byname();
|
| 960 |
};
|
| 961 |
}
|
| 962 |
```
|
| 963 |
|
| 964 |
-
#### `ctype<char>` specialization <a id="facet.ctype.special">[[facet.ctype.special]]</a>
|
| 965 |
|
| 966 |
-
##### General <a id="facet.ctype.special.general">[[facet.ctype.special.general]]</a>
|
| 967 |
|
| 968 |
``` cpp
|
| 969 |
namespace std {
|
| 970 |
template<>
|
| 971 |
class ctype<char> : public locale::facet, public ctype_base {
|
|
@@ -1015,20 +1027,20 @@ A specialization `ctype<char>` is provided so that the member functions
|
|
| 1015 |
on type `char` can be implemented inline.[^7]
|
| 1016 |
|
| 1017 |
The *implementation-defined* value of member `table_size` is at least
|
| 1018 |
256.
|
| 1019 |
|
| 1020 |
-
##### Destructor <a id="facet.ctype.char.dtor">[[facet.ctype.char.dtor]]</a>
|
| 1021 |
|
| 1022 |
``` cpp
|
| 1023 |
~ctype();
|
| 1024 |
```
|
| 1025 |
|
| 1026 |
*Effects:* If the constructor’s first argument was nonzero, and its
|
| 1027 |
second argument was `true`, does `delete [] table()`.
|
| 1028 |
|
| 1029 |
-
##### Members <a id="facet.ctype.char.members">[[facet.ctype.char.members]]</a>
|
| 1030 |
|
| 1031 |
In the following member descriptions, for `unsigned char` values `v`
|
| 1032 |
where `v >= table_size`, `table()[v]` is assumed to have an
|
| 1033 |
implementation-specific value (possibly different for each such value
|
| 1034 |
`v`) without performing the array lookup.
|
|
@@ -1111,21 +1123,21 @@ const mask* table() const noexcept;
|
|
| 1111 |
```
|
| 1112 |
|
| 1113 |
*Returns:* The first constructor argument, if it was nonzero, otherwise
|
| 1114 |
`classic_table()`.
|
| 1115 |
|
| 1116 |
-
##### Static members <a id="facet.ctype.char.statics">[[facet.ctype.char.statics]]</a>
|
| 1117 |
|
| 1118 |
``` cpp
|
| 1119 |
static const mask* classic_table() noexcept;
|
| 1120 |
```
|
| 1121 |
|
| 1122 |
*Returns:* A pointer to the initial element of an array of size
|
| 1123 |
`table_size` which represents the classifications of characters in the
|
| 1124 |
`"C"` locale.
|
| 1125 |
|
| 1126 |
-
##### Virtual functions <a id="facet.ctype.char.virtuals">[[facet.ctype.char.virtuals]]</a>
|
| 1127 |
|
| 1128 |
``` cpp
|
| 1129 |
char do_toupper(char) const;
|
| 1130 |
const char* do_toupper(char* low, const char* high) const;
|
| 1131 |
char do_tolower(char) const;
|
|
@@ -1139,13 +1151,13 @@ virtual const char* do_narrow(const char* low, const char* high,
|
|
| 1139 |
```
|
| 1140 |
|
| 1141 |
These functions are described identically as those members of the same
|
| 1142 |
name in the `ctype` class template [[locale.ctype.members]].
|
| 1143 |
|
| 1144 |
-
#### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
|
| 1145 |
|
| 1146 |
-
##### General <a id="locale.codecvt.general">[[locale.codecvt.general]]</a>
|
| 1147 |
|
| 1148 |
``` cpp
|
| 1149 |
namespace std {
|
| 1150 |
class codecvt_base {
|
| 1151 |
public:
|
|
@@ -1213,23 +1225,20 @@ The `stateT` argument selects the pair of character encodings being
|
|
| 1213 |
mapped between.
|
| 1214 |
|
| 1215 |
The specializations required in [[locale.category.facets]]
|
| 1216 |
[[locale.category]] convert the implementation-defined native character
|
| 1217 |
set. `codecvt<char, char, mbstate_t>` implements a degenerate
|
| 1218 |
-
conversion; it does not convert at all.
|
| 1219 |
-
`codecvt<
|
| 1220 |
-
|
| 1221 |
-
`
|
| 1222 |
-
|
| 1223 |
-
|
| 1224 |
-
|
| 1225 |
-
|
| 1226 |
-
specializing on a program-defined `stateT` type. Objects of type
|
| 1227 |
-
`stateT` can contain any state that is useful to communicate to or from
|
| 1228 |
-
the specialized `do_in` or `do_out` members.
|
| 1229 |
|
| 1230 |
-
##### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
|
| 1231 |
|
| 1232 |
``` cpp
|
| 1233 |
result out(
|
| 1234 |
stateT& state,
|
| 1235 |
const internT* from, const internT* from_end, const internT*& from_next,
|
|
@@ -1277,11 +1286,11 @@ int length(stateT& state, const externT* from, const externT* from_end, size_t m
|
|
| 1277 |
int max_length() const noexcept;
|
| 1278 |
```
|
| 1279 |
|
| 1280 |
*Returns:* `do_max_length()`.
|
| 1281 |
|
| 1282 |
-
##### Virtual functions <a id="locale.codecvt.virtuals">[[locale.codecvt.virtuals]]</a>
|
| 1283 |
|
| 1284 |
``` cpp
|
| 1285 |
result do_out(
|
| 1286 |
stateT& state,
|
| 1287 |
const internT* from, const internT* from_end, const internT*& from_next,
|
|
@@ -1303,13 +1312,13 @@ the sequence.
|
|
| 1303 |
destination `to`. Converts no more than `(from_end - from)` source
|
| 1304 |
elements, and stores no more than `(to_end - to)` destination elements.
|
| 1305 |
|
| 1306 |
Stops if it encounters a character it cannot convert. It always leaves
|
| 1307 |
the `from_next` and `to_next` pointers pointing one beyond the last
|
| 1308 |
-
element successfully converted. If returns `noconv`, `internT` and
|
| 1309 |
-
`externT` are the same type and the converted sequence is identical to
|
| 1310 |
-
the input sequence \[`from`, `from``next`)
|
| 1311 |
`to`, the value of `state` is unchanged, and there are no changes to the
|
| 1312 |
values in \[`to`, `to_end`).
|
| 1313 |
|
| 1314 |
A `codecvt` facet that is used by `basic_filebuf` [[file.streams]] shall
|
| 1315 |
have the property that if
|
|
@@ -1420,14 +1429,14 @@ sequence.
|
|
| 1420 |
|
| 1421 |
*Effects:* The effect on the `state` argument is as if it called
|
| 1422 |
`do_in(state, from, from_end, from, to, to + max, to)` for `to` pointing
|
| 1423 |
to a buffer of at least `max` elements.
|
| 1424 |
|
| 1425 |
-
*Returns:* `(from_next-from)` where `from_next` is the largest value
|
| 1426 |
-
the range \[`from`, `from_end`\] such that the sequence of values in
|
| 1427 |
-
range \[`from`, `from_next`) represents `max` or fewer valid
|
| 1428 |
-
characters of type `internT`. The specialization
|
| 1429 |
`codecvt<char, char, mbstate_t>`, returns the lesser of `max` and
|
| 1430 |
`(from_end - from)`.
|
| 1431 |
|
| 1432 |
``` cpp
|
| 1433 |
int do_max_length() const noexcept;
|
|
@@ -1436,11 +1445,11 @@ int do_max_length() const noexcept;
|
|
| 1436 |
*Returns:* The maximum value that `do_length(state, from, from_end, 1)`
|
| 1437 |
can return for any valid range \[`from`, `from_end`) and `stateT` value
|
| 1438 |
`state`. The specialization
|
| 1439 |
`codecvt<char, char, mbstate_t>::do_max_length()` returns 1.
|
| 1440 |
|
| 1441 |
-
#### Class template `codecvt_byname` <a id="locale.codecvt.byname">[[locale.codecvt.byname]]</a>
|
| 1442 |
|
| 1443 |
``` cpp
|
| 1444 |
namespace std {
|
| 1445 |
template<class internT, class externT, class stateT>
|
| 1446 |
class codecvt_byname : public codecvt<internT, externT, stateT> {
|
|
@@ -1452,13 +1461,13 @@ namespace std {
|
|
| 1452 |
~codecvt_byname();
|
| 1453 |
};
|
| 1454 |
}
|
| 1455 |
```
|
| 1456 |
|
| 1457 |
-
### The numeric category <a id="category.numeric">[[category.numeric]]</a>
|
| 1458 |
|
| 1459 |
-
#### General <a id="category.numeric.general">[[category.numeric.general]]</a>
|
| 1460 |
|
| 1461 |
The classes `num_get<>` and `num_put<>` handle numeric formatting and
|
| 1462 |
parsing. Virtual functions are provided for several numeric types.
|
| 1463 |
Implementations may (but are not required to) delegate extraction of
|
| 1464 |
smaller types to extractors for larger types.[^11]
|
|
@@ -1476,13 +1485,13 @@ also for the `ctype<>` facet to perform character classification.
|
|
| 1476 |
|
| 1477 |
Extractor and inserter members of the standard iostreams use `num_get<>`
|
| 1478 |
and `num_put<>` member functions for formatting and parsing numeric
|
| 1479 |
values [[istream.formatted.reqmts]], [[ostream.formatted.reqmts]].
|
| 1480 |
|
| 1481 |
-
#### Class template `num_get` <a id="locale.num.get">[[locale.num.get]]</a>
|
| 1482 |
|
| 1483 |
-
##### General <a id="locale.num.get.general">[[locale.num.get.general]]</a>
|
| 1484 |
|
| 1485 |
``` cpp
|
| 1486 |
namespace std {
|
| 1487 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 1488 |
class num_get : public locale::facet {
|
|
@@ -1546,11 +1555,11 @@ namespace std {
|
|
| 1546 |
```
|
| 1547 |
|
| 1548 |
The facet `num_get` is used to parse numeric values from an input
|
| 1549 |
sequence such as an istream.
|
| 1550 |
|
| 1551 |
-
##### Members <a id="facet.num.get.members">[[facet.num.get.members]]</a>
|
| 1552 |
|
| 1553 |
``` cpp
|
| 1554 |
iter_type get(iter_type in, iter_type end, ios_base& str,
|
| 1555 |
ios_base::iostate& err, bool& val) const;
|
| 1556 |
iter_type get(iter_type in, iter_type end, ios_base& str,
|
|
@@ -1575,11 +1584,11 @@ iter_type get(iter_type in, iter_type end, ios_base& str,
|
|
| 1575 |
ios_base::iostate& err, void*& val) const;
|
| 1576 |
```
|
| 1577 |
|
| 1578 |
*Returns:* `do_get(in, end, str, err, val)`.
|
| 1579 |
|
| 1580 |
-
##### Virtual functions <a id="facet.num.get.virtuals">[[facet.num.get.virtuals]]</a>
|
| 1581 |
|
| 1582 |
``` cpp
|
| 1583 |
iter_type do_get(iter_type in, iter_type end, ios_base& str,
|
| 1584 |
ios_base::iostate& err, long& val) const;
|
| 1585 |
iter_type do_get(iter_type in, iter_type end, ios_base& str,
|
|
@@ -1604,17 +1613,17 @@ iter_type do_get(iter_type in, iter_type end, ios_base& str,
|
|
| 1604 |
|
| 1605 |
*Effects:* Reads characters from `in`, interpreting them according to
|
| 1606 |
`str.flags()`, `use_facet<ctype<charT>>(loc)`, and
|
| 1607 |
`use_facet<numpunct<charT>>(loc)`, where `loc` is `str.getloc()`.
|
| 1608 |
|
| 1609 |
-
The details of this operation occur in three stages
|
| 1610 |
|
| 1611 |
-
- Stage 1: Determine a conversion specifier
|
| 1612 |
- Stage 2: Extract characters from `in` and determine a corresponding
|
| 1613 |
`char` value for the format expected by the conversion specification
|
| 1614 |
determined in stage 1.
|
| 1615 |
-
- Stage 3: Store results
|
| 1616 |
|
| 1617 |
The details of the stages are presented below.
|
| 1618 |
|
| 1619 |
[*Example 1*:
|
| 1620 |
|
|
@@ -1664,12 +1673,12 @@ Otherwise `false` is stored and `ios_base::failbit` is assigned to
|
|
| 1664 |
|
| 1665 |
The `in` iterator is always left pointing one position beyond the last
|
| 1666 |
character successfully matched. If `val` is set, then `err` is set to
|
| 1667 |
`str.goodbit`; or to `str.eofbit` if, when seeking another character to
|
| 1668 |
match, it is found that `(in == end)`. If `val` is not set, then `err`
|
| 1669 |
-
is set to `str.failbit`; or to `(str.failbit|str.eofbit)` if the
|
| 1670 |
-
for the failure was that `(in == end)`.
|
| 1671 |
|
| 1672 |
[*Example 2*: For targets `true`: `"a"` and `false`: `"abb"`, the input
|
| 1673 |
sequence `"a"` yields `val == true` and `err == str.eofbit`; the input
|
| 1674 |
sequence `"abc"` yields `err = str.failbit`, with `in` ending at the
|
| 1675 |
`’c’` element. For targets `true`: `"1"` and `false`: `"0"`, the input
|
|
@@ -1677,13 +1686,13 @@ sequence `"1"` yields `val == true` and `err == str.goodbit`. For empty
|
|
| 1677 |
targets `("")`, any input sequence yields
|
| 1678 |
`err == str.failbit`. — *end example*]
|
| 1679 |
|
| 1680 |
*Returns:* `in`.
|
| 1681 |
|
| 1682 |
-
#### Class template `num_put` <a id="locale.nm.put">[[locale.nm.put]]</a>
|
| 1683 |
|
| 1684 |
-
##### General <a id="locale.nm.put.general">[[locale.nm.put.general]]</a>
|
| 1685 |
|
| 1686 |
``` cpp
|
| 1687 |
namespace std {
|
| 1688 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 1689 |
class num_put : public locale::facet {
|
|
@@ -1719,11 +1728,11 @@ namespace std {
|
|
| 1719 |
```
|
| 1720 |
|
| 1721 |
The facet `num_put` is used to format numeric values to a character
|
| 1722 |
sequence such as an ostream.
|
| 1723 |
|
| 1724 |
-
##### Members <a id="facet.num.put.members">[[facet.num.put.members]]</a>
|
| 1725 |
|
| 1726 |
``` cpp
|
| 1727 |
iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
|
| 1728 |
iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
|
| 1729 |
iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
|
|
@@ -1734,11 +1743,11 @@ iter_type put(iter_type out, ios_base& str, char_type fill, long double val) con
|
|
| 1734 |
iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
|
| 1735 |
```
|
| 1736 |
|
| 1737 |
*Returns:* `do_put(out, str, fill, val)`.
|
| 1738 |
|
| 1739 |
-
##### Virtual functions <a id="facet.num.put.virtuals">[[facet.num.put.virtuals]]</a>
|
| 1740 |
|
| 1741 |
``` cpp
|
| 1742 |
iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
|
| 1743 |
iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
|
| 1744 |
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
|
|
@@ -1817,11 +1826,12 @@ floating-point conversion specifier as indicated in
|
|
| 1817 |
|
| 1818 |
**Table: Floating-point conversions** <a id="facet.num.put.fp">[facet.num.put.fp]</a>
|
| 1819 |
|
| 1820 |
| State | `stdio` equivalent |
|
| 1821 |
| ---------------------------------------------------------------------- | ------------------ |
|
| 1822 |
-
| `floatfield == ios_base::fixed`
|
|
|
|
| 1823 |
| `floatfield == ios_base::scientific && !uppercase` | `%e` |
|
| 1824 |
| `floatfield == ios_base::scientific` | `%E` |
|
| 1825 |
| `floatfield == (ios_base::fixed | ios_base::scientific) && !uppercase` | `%a` |
|
| 1826 |
| `floatfield == (ios_base::fixed | ios_base::scientific)` | `%A` |
|
| 1827 |
| `!uppercase` | `%g` |
|
|
@@ -1943,15 +1953,15 @@ string_type s =
|
|
| 1943 |
```
|
| 1944 |
|
| 1945 |
and then inserts each character `c` of `s` into `out` via `*out++ = c`
|
| 1946 |
and returns `out`.
|
| 1947 |
|
| 1948 |
-
### The numeric punctuation facet <a id="facet.numpunct">[[facet.numpunct]]</a>
|
| 1949 |
|
| 1950 |
-
#### Class template `numpunct` <a id="locale.numpunct">[[locale.numpunct]]</a>
|
| 1951 |
|
| 1952 |
-
##### General <a id="locale.numpunct.general">[[locale.numpunct.general]]</a>
|
| 1953 |
|
| 1954 |
``` cpp
|
| 1955 |
namespace std {
|
| 1956 |
template<class charT>
|
| 1957 |
class numpunct : public locale::facet {
|
|
@@ -2040,11 +2050,11 @@ e:
|
|
| 2040 |
|
| 2041 |
where the number of digits between is as specified by `do_grouping()`.
|
| 2042 |
For parsing, if the portion contains no thousands-separators, no
|
| 2043 |
grouping constraint is applied.
|
| 2044 |
|
| 2045 |
-
##### Members <a id="facet.numpunct.members">[[facet.numpunct.members]]</a>
|
| 2046 |
|
| 2047 |
``` cpp
|
| 2048 |
char_type decimal_point() const;
|
| 2049 |
```
|
| 2050 |
|
|
@@ -2067,11 +2077,11 @@ string_type truename() const;
|
|
| 2067 |
string_type falsename() const;
|
| 2068 |
```
|
| 2069 |
|
| 2070 |
*Returns:* `do_truename()` or `do_falsename()`, respectively.
|
| 2071 |
|
| 2072 |
-
##### Virtual functions <a id="facet.numpunct.virtuals">[[facet.numpunct.virtuals]]</a>
|
| 2073 |
|
| 2074 |
``` cpp
|
| 2075 |
char_type do_decimal_point() const;
|
| 2076 |
```
|
| 2077 |
|
|
@@ -2109,11 +2119,11 @@ string_type do_falsename() const;
|
|
| 2109 |
`false`, respectively.
|
| 2110 |
|
| 2111 |
In the base class implementation these names are `"true"` and `"false"`,
|
| 2112 |
or `L"true"` and `L"false"`.
|
| 2113 |
|
| 2114 |
-
#### Class template `numpunct_byname` <a id="locale.numpunct.byname">[[locale.numpunct.byname]]</a>
|
| 2115 |
|
| 2116 |
``` cpp
|
| 2117 |
namespace std {
|
| 2118 |
template<class charT>
|
| 2119 |
class numpunct_byname : public numpunct<charT> {
|
|
@@ -2129,15 +2139,15 @@ namespace std {
|
|
| 2129 |
~numpunct_byname();
|
| 2130 |
};
|
| 2131 |
}
|
| 2132 |
```
|
| 2133 |
|
| 2134 |
-
### The collate category <a id="category.collate">[[category.collate]]</a>
|
| 2135 |
|
| 2136 |
-
#### Class template `collate` <a id="locale.collate">[[locale.collate]]</a>
|
| 2137 |
|
| 2138 |
-
##### General <a id="locale.collate.general">[[locale.collate.general]]</a>
|
| 2139 |
|
| 2140 |
``` cpp
|
| 2141 |
namespace std {
|
| 2142 |
template<class charT>
|
| 2143 |
class collate : public locale::facet {
|
|
@@ -2174,11 +2184,11 @@ and `collate<wchar_t>`, apply lexicographical ordering
|
|
| 2174 |
[[alg.lex.comparison]].
|
| 2175 |
|
| 2176 |
Each function compares a string of characters `*p` in the range \[`low`,
|
| 2177 |
`high`).
|
| 2178 |
|
| 2179 |
-
##### Members <a id="locale.collate.members">[[locale.collate.members]]</a>
|
| 2180 |
|
| 2181 |
``` cpp
|
| 2182 |
int compare(const charT* low1, const charT* high1,
|
| 2183 |
const charT* low2, const charT* high2) const;
|
| 2184 |
```
|
|
@@ -2195,11 +2205,11 @@ string_type transform(const charT* low, const charT* high) const;
|
|
| 2195 |
long hash(const charT* low, const charT* high) const;
|
| 2196 |
```
|
| 2197 |
|
| 2198 |
*Returns:* `do_hash(low, high)`.
|
| 2199 |
|
| 2200 |
-
##### Virtual functions <a id="locale.collate.virtuals">[[locale.collate.virtuals]]</a>
|
| 2201 |
|
| 2202 |
``` cpp
|
| 2203 |
int do_compare(const charT* low1, const charT* high1,
|
| 2204 |
const charT* low2, const charT* high2) const;
|
| 2205 |
```
|
|
@@ -2229,11 +2239,11 @@ the two strings.
|
|
| 2229 |
|
| 2230 |
*Recommended practice:* The probability that the result equals that for
|
| 2231 |
another string which does not compare equal should be very small,
|
| 2232 |
approaching `(1.0/numeric_limits<unsigned long>::max())`.
|
| 2233 |
|
| 2234 |
-
#### Class template `collate_byname` <a id="locale.collate.byname">[[locale.collate.byname]]</a>
|
| 2235 |
|
| 2236 |
``` cpp
|
| 2237 |
namespace std {
|
| 2238 |
template<class charT>
|
| 2239 |
class collate_byname : public collate<charT> {
|
|
@@ -2247,13 +2257,13 @@ namespace std {
|
|
| 2247 |
~collate_byname();
|
| 2248 |
};
|
| 2249 |
}
|
| 2250 |
```
|
| 2251 |
|
| 2252 |
-
### The time category <a id="category.time">[[category.time]]</a>
|
| 2253 |
|
| 2254 |
-
#### General <a id="category.time.general">[[category.time.general]]</a>
|
| 2255 |
|
| 2256 |
Templates `time_get<charT, InputIterator>` and
|
| 2257 |
`time_put<charT, OutputIterator>` provide date and time formatting and
|
| 2258 |
parsing. All specifications of member functions for `time_put` and
|
| 2259 |
`time_get` in the subclauses of [[category.time]] only apply to the
|
|
@@ -2261,13 +2271,13 @@ specializations required in Tables [[tab:locale.category.facets]] and
|
|
| 2261 |
[[tab:locale.spec]] [[locale.category]]. Their members use their
|
| 2262 |
`ios_base&`, `ios_base::iostate&`, and `fill` arguments as described in
|
| 2263 |
[[locale.categories]], and the `ctype<>` facet, to determine formatting
|
| 2264 |
details.
|
| 2265 |
|
| 2266 |
-
#### Class template `time_get` <a id="locale.time.get">[[locale.time.get]]</a>
|
| 2267 |
|
| 2268 |
-
##### General <a id="locale.time.get.general">[[locale.time.get.general]]</a>
|
| 2269 |
|
| 2270 |
``` cpp
|
| 2271 |
namespace std {
|
| 2272 |
class time_base {
|
| 2273 |
public:
|
|
@@ -2329,11 +2339,11 @@ sequence; otherwise either an error is reported or unspecified values
|
|
| 2329 |
are assigned.[^15]
|
| 2330 |
|
| 2331 |
If the end iterator is reached during parsing by any of the `get()`
|
| 2332 |
member functions, the member sets `ios_base::eofbit` in `err`.
|
| 2333 |
|
| 2334 |
-
##### Members <a id="locale.time.get.members">[[locale.time.get.members]]</a>
|
| 2335 |
|
| 2336 |
``` cpp
|
| 2337 |
dateorder date_order() const;
|
| 2338 |
```
|
| 2339 |
|
|
@@ -2422,11 +2432,11 @@ by what means the function performs case-insensitive comparison or
|
|
| 2422 |
whether multi-character sequences are considered while doing
|
| 2423 |
so. — *end note*]
|
| 2424 |
|
| 2425 |
*Returns:* `s`.
|
| 2426 |
|
| 2427 |
-
##### Virtual functions <a id="locale.time.get.virtuals">[[locale.time.get.virtuals]]</a>
|
| 2428 |
|
| 2429 |
``` cpp
|
| 2430 |
dateorder do_date_order() const;
|
| 2431 |
```
|
| 2432 |
|
|
@@ -2540,11 +2550,11 @@ recognized as possibly part of a valid input sequence for the given
|
|
| 2540 |
*Remarks:* It is unspecified whether multiple calls to `do_get()` with
|
| 2541 |
the address of the same `tm` object will update the current contents of
|
| 2542 |
the object or simply overwrite its members. Portable programs should
|
| 2543 |
zero out the object before invoking the function.
|
| 2544 |
|
| 2545 |
-
#### Class template `time_get_byname` <a id="locale.time.get.byname">[[locale.time.get.byname]]</a>
|
| 2546 |
|
| 2547 |
``` cpp
|
| 2548 |
namespace std {
|
| 2549 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 2550 |
class time_get_byname : public time_get<charT, InputIterator> {
|
|
@@ -2559,11 +2569,13 @@ namespace std {
|
|
| 2559 |
~time_get_byname();
|
| 2560 |
};
|
| 2561 |
}
|
| 2562 |
```
|
| 2563 |
|
| 2564 |
-
#### Class template `time_put` <a id="locale.time.put">[[locale.time.put]]</a>
|
|
|
|
|
|
|
| 2565 |
|
| 2566 |
``` cpp
|
| 2567 |
namespace std {
|
| 2568 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 2569 |
class time_put : public locale::facet {
|
|
@@ -2587,11 +2599,11 @@ namespace std {
|
|
| 2587 |
char format, char modifier) const;
|
| 2588 |
};
|
| 2589 |
}
|
| 2590 |
```
|
| 2591 |
|
| 2592 |
-
##### Members <a id="locale.time.put.members">[[locale.time.put.members]]</a>
|
| 2593 |
|
| 2594 |
``` cpp
|
| 2595 |
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
|
| 2596 |
const charT* pattern, const charT* pat_end) const;
|
| 2597 |
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
|
|
@@ -2606,27 +2618,25 @@ call to `do_put`; thus, format elements and other characters are
|
|
| 2606 |
interleaved in the output in the order in which they appear in the
|
| 2607 |
pattern. Format sequences are identified by converting each character
|
| 2608 |
`c` to a `char` value as if by `ct.narrow(c, 0)`, where `ct` is a
|
| 2609 |
reference to `ctype<charT>` obtained from `str.getloc()`. The first
|
| 2610 |
character of each sequence is equal to `’%’`, followed by an optional
|
| 2611 |
-
modifier character `mod`
|
| 2612 |
-
|
| 2613 |
-
|
| 2614 |
-
`strftime`. If no modifier character is present, `mod` is zero. For each
|
| 2615 |
-
valid format sequence identified, calls
|
| 2616 |
`do_put(s, str, fill, t, spec, mod)`.
|
| 2617 |
|
| 2618 |
The second form calls `do_put(s, str, fill, t, format, modifier)`.
|
| 2619 |
|
| 2620 |
-
[*Note
|
| 2621 |
implementation-defined formats or by derivations. A space character is a
|
| 2622 |
reasonable default for this argument. — *end note*]
|
| 2623 |
|
| 2624 |
*Returns:* An iterator pointing immediately after the last character
|
| 2625 |
produced.
|
| 2626 |
|
| 2627 |
-
##### Virtual functions <a id="locale.time.put.virtuals">[[locale.time.put.virtuals]]</a>
|
| 2628 |
|
| 2629 |
``` cpp
|
| 2630 |
iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
|
| 2631 |
char format, char modifier) const;
|
| 2632 |
```
|
|
@@ -2637,26 +2647,26 @@ parameters `format` and `modifier`, interpreted identically as the
|
|
| 2637 |
format specifiers in the string argument to the standard library
|
| 2638 |
function `strftime()`, except that the sequence of characters produced
|
| 2639 |
for those specifiers that are described as depending on the C locale are
|
| 2640 |
instead *implementation-defined*.
|
| 2641 |
|
| 2642 |
-
[*Note
|
| 2643 |
implementation-defined. — *end note*]
|
| 2644 |
|
| 2645 |
*Returns:* An iterator pointing immediately after the last character
|
| 2646 |
produced.
|
| 2647 |
|
| 2648 |
-
[*Note
|
| 2649 |
implementation-defined formats or by derivations. A space character is a
|
| 2650 |
reasonable default for this argument. — *end note*]
|
| 2651 |
|
| 2652 |
*Recommended practice:* Interpretation of the `modifier` should follow
|
| 2653 |
POSIX conventions. Implementations should refer to other standards such
|
| 2654 |
as POSIX for a specification of the character sequences produced for
|
| 2655 |
those specifiers described as depending on the C locale.
|
| 2656 |
|
| 2657 |
-
#### Class template `time_put_byname` <a id="locale.time.put.byname">[[locale.time.put.byname]]</a>
|
| 2658 |
|
| 2659 |
``` cpp
|
| 2660 |
namespace std {
|
| 2661 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 2662 |
class time_put_byname : public time_put<charT, OutputIterator> {
|
|
@@ -2671,13 +2681,13 @@ namespace std {
|
|
| 2671 |
~time_put_byname();
|
| 2672 |
};
|
| 2673 |
}
|
| 2674 |
```
|
| 2675 |
|
| 2676 |
-
### The monetary category <a id="category.monetary">[[category.monetary]]</a>
|
| 2677 |
|
| 2678 |
-
#### General <a id="category.monetary.general">[[category.monetary.general]]</a>
|
| 2679 |
|
| 2680 |
These templates handle monetary formats. A template parameter indicates
|
| 2681 |
whether local or international monetary formats are to be used.
|
| 2682 |
|
| 2683 |
All specifications of member functions for `money_put` and `money_get`
|
|
@@ -2686,11 +2696,13 @@ specializations required in Tables [[tab:locale.category.facets]] and
|
|
| 2686 |
[[tab:locale.spec]] [[locale.category]]. Their members use their
|
| 2687 |
`ios_base&`, `ios_base::iostate&`, and `fill` arguments as described in
|
| 2688 |
[[locale.categories]], and the `moneypunct<>` and `ctype<>` facets, to
|
| 2689 |
determine formatting details.
|
| 2690 |
|
| 2691 |
-
#### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
|
|
|
|
|
|
|
| 2692 |
|
| 2693 |
``` cpp
|
| 2694 |
namespace std {
|
| 2695 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 2696 |
class money_get : public locale::facet {
|
|
@@ -2718,22 +2730,22 @@ namespace std {
|
|
| 2718 |
ios_base::iostate& err, string_type& digits) const;
|
| 2719 |
};
|
| 2720 |
}
|
| 2721 |
```
|
| 2722 |
|
| 2723 |
-
##### Members <a id="locale.money.get.members">[[locale.money.get.members]]</a>
|
| 2724 |
|
| 2725 |
``` cpp
|
| 2726 |
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
| 2727 |
ios_base::iostate& err, long double& quant) const;
|
| 2728 |
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
| 2729 |
ios_base::iostate& err, string_type& quant) const;
|
| 2730 |
```
|
| 2731 |
|
| 2732 |
*Returns:* `do_get(s, end, intl, f, err, quant)`.
|
| 2733 |
|
| 2734 |
-
##### Virtual functions <a id="locale.money.get.virtuals">[[locale.money.get.virtuals]]</a>
|
| 2735 |
|
| 2736 |
``` cpp
|
| 2737 |
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
| 2738 |
ios_base::iostate& err, long double& units) const;
|
| 2739 |
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
|
@@ -2743,18 +2755,18 @@ iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
|
| 2743 |
*Effects:* Reads characters from `s` to parse and construct a monetary
|
| 2744 |
value according to the format specified by a `moneypunct<charT, Intl>`
|
| 2745 |
facet reference `mp` and the character mapping specified by a
|
| 2746 |
`ctype<charT>` facet reference `ct` obtained from the locale returned by
|
| 2747 |
`str.getloc()`, and `str.flags()`. If a valid sequence is recognized,
|
| 2748 |
-
does not change `err`; otherwise, sets `err` to `(err|str.failbit)`,
|
| 2749 |
-
`(err|str.failbit|str.eofbit)` if no more characters are
|
| 2750 |
-
does not change `units` or `digits`. Uses the pattern
|
| 2751 |
-
`mp.neg_format()` to parse all values. The result is
|
| 2752 |
-
integral value stored in `units` or as a sequence of
|
| 2753 |
-
preceded by a minus sign (as produced by `ct.widen(c)`
|
| 2754 |
-
`’-’` or in the range from `’0’` through `’9’` (inclusive))
|
| 2755 |
-
`digits`.
|
| 2756 |
|
| 2757 |
[*Example 1*: The sequence `$1,056.23` in a common United States locale
|
| 2758 |
would yield, for `units`, `105623`, or, for `digits`,
|
| 2759 |
`"105623"`. — *end example*]
|
| 2760 |
|
|
@@ -2795,11 +2807,11 @@ the result is given a positive sign.
|
|
| 2795 |
|
| 2796 |
Digits in the numeric monetary component are extracted and placed in
|
| 2797 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 2798 |
value for `units`, in the order in which they appear, preceded by a
|
| 2799 |
minus sign if and only if the result is negative. The value `units` is
|
| 2800 |
-
produced as if by[^
|
| 2801 |
|
| 2802 |
``` cpp
|
| 2803 |
for (int i = 0; i < n; ++i)
|
| 2804 |
buf2[i] = src[find(atoms, atoms + sizeof(src), buf1[i]) - atoms];
|
| 2805 |
buf2[n] = 0;
|
|
@@ -2816,11 +2828,13 @@ ct.widen(src, src + sizeof(src) - 1, atoms);
|
|
| 2816 |
```
|
| 2817 |
|
| 2818 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2819 |
recognized as part of a valid monetary quantity.
|
| 2820 |
|
| 2821 |
-
#### Class template `money_put` <a id="locale.money.put">[[locale.money.put]]</a>
|
|
|
|
|
|
|
| 2822 |
|
| 2823 |
``` cpp
|
| 2824 |
namespace std {
|
| 2825 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 2826 |
class money_put : public locale::facet {
|
|
@@ -2846,20 +2860,20 @@ namespace std {
|
|
| 2846 |
const string_type& digits) const;
|
| 2847 |
};
|
| 2848 |
}
|
| 2849 |
```
|
| 2850 |
|
| 2851 |
-
##### Members <a id="locale.money.put.members">[[locale.money.put.members]]</a>
|
| 2852 |
|
| 2853 |
``` cpp
|
| 2854 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
|
| 2855 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
|
| 2856 |
```
|
| 2857 |
|
| 2858 |
-
*Returns:* `do_put(s, intl, f,
|
| 2859 |
|
| 2860 |
-
##### Virtual functions <a id="locale.money.put.virtuals">[[locale.money.put.virtuals]]</a>
|
| 2861 |
|
| 2862 |
``` cpp
|
| 2863 |
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
| 2864 |
char_type fill, long double units) const;
|
| 2865 |
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
|
@@ -2904,13 +2918,13 @@ before the other characters.
|
|
| 2904 |
|
| 2905 |
[*Note 1*: It is possible, with some combinations of format patterns
|
| 2906 |
and flag values, to produce output that cannot be parsed using
|
| 2907 |
`num_get<>::get`. — *end note*]
|
| 2908 |
|
| 2909 |
-
#### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
|
| 2910 |
|
| 2911 |
-
##### General <a id="locale.moneypunct.general">[[locale.moneypunct.general]]</a>
|
| 2912 |
|
| 2913 |
``` cpp
|
| 2914 |
namespace std {
|
| 2915 |
class money_base {
|
| 2916 |
public:
|
|
@@ -2956,11 +2970,11 @@ namespace std {
|
|
| 2956 |
|
| 2957 |
The `moneypunct<>` facet defines monetary formatting parameters used by
|
| 2958 |
`money_get<>` and `money_put<>`. A monetary format is a sequence of four
|
| 2959 |
components, specified by a `pattern` value `p`, such that the `part`
|
| 2960 |
value `static_cast<part>(p.field[i])` determines the `i`ᵗʰ component of
|
| 2961 |
-
the format[^
|
| 2962 |
|
| 2963 |
In the `field` member of a `pattern` object, each value `symbol`,
|
| 2964 |
`sign`, `value`, and either `space` or `none` appears exactly once. The
|
| 2965 |
value `none`, if present, is not first; the value `space`, if present,
|
| 2966 |
is neither first nor last.
|
|
@@ -3023,11 +3037,11 @@ by `frac_digits()`.
|
|
| 3023 |
|
| 3024 |
The placement of thousands-separator characters (if any) is determined
|
| 3025 |
by the value returned by `grouping()`, defined identically as the member
|
| 3026 |
`numpunct<>::do_grouping()`.
|
| 3027 |
|
| 3028 |
-
##### Members <a id="locale.moneypunct.members">[[locale.moneypunct.members]]</a>
|
| 3029 |
|
| 3030 |
``` cpp
|
| 3031 |
charT decimal_point() const;
|
| 3032 |
charT thousands_sep() const;
|
| 3033 |
string grouping() const;
|
|
@@ -3040,60 +3054,60 @@ pattern neg_format() const;
|
|
| 3040 |
```
|
| 3041 |
|
| 3042 |
Each of these functions `F` returns the result of calling the
|
| 3043 |
corresponding virtual member function `do_F()`.
|
| 3044 |
|
| 3045 |
-
##### Virtual functions <a id="locale.moneypunct.virtuals">[[locale.moneypunct.virtuals]]</a>
|
| 3046 |
|
| 3047 |
``` cpp
|
| 3048 |
charT do_decimal_point() const;
|
| 3049 |
```
|
| 3050 |
|
| 3051 |
*Returns:* The radix separator to use in case `do_frac_digits()` is
|
| 3052 |
-
greater than zero.[^
|
| 3053 |
|
| 3054 |
``` cpp
|
| 3055 |
charT do_thousands_sep() const;
|
| 3056 |
```
|
| 3057 |
|
| 3058 |
*Returns:* The digit group separator to use in case `do_grouping()`
|
| 3059 |
-
specifies a digit grouping pattern.[^
|
| 3060 |
|
| 3061 |
``` cpp
|
| 3062 |
string do_grouping() const;
|
| 3063 |
```
|
| 3064 |
|
| 3065 |
*Returns:* A pattern defined identically as, but not necessarily equal
|
| 3066 |
-
to, the result of `numpunct<charT>::do_grouping()`.[^
|
| 3067 |
|
| 3068 |
``` cpp
|
| 3069 |
string_type do_curr_symbol() const;
|
| 3070 |
```
|
| 3071 |
|
| 3072 |
*Returns:* A string to use as the currency identifier symbol.
|
| 3073 |
|
| 3074 |
-
[*Note
|
| 3075 |
`true`, this is typically four characters long: a three-letter code as
|
| 3076 |
specified by ISO 4217 followed by a space. — *end note*]
|
| 3077 |
|
| 3078 |
``` cpp
|
| 3079 |
string_type do_positive_sign() const;
|
| 3080 |
string_type do_negative_sign() const;
|
| 3081 |
```
|
| 3082 |
|
| 3083 |
*Returns:* `do_positive_sign()` returns the string to use to indicate a
|
| 3084 |
-
positive monetary value;[^
|
| 3085 |
|
| 3086 |
`do_negative_sign()` returns the string to use to indicate a negative
|
| 3087 |
value.
|
| 3088 |
|
| 3089 |
``` cpp
|
| 3090 |
int do_frac_digits() const;
|
| 3091 |
```
|
| 3092 |
|
| 3093 |
*Returns:* The number of digits after the decimal radix separator, if
|
| 3094 |
-
any.[^
|
| 3095 |
|
| 3096 |
``` cpp
|
| 3097 |
pattern do_pos_format() const;
|
| 3098 |
pattern do_neg_format() const;
|
| 3099 |
```
|
|
@@ -3105,13 +3119,13 @@ pattern do_neg_format() const;
|
|
| 3105 |
- `moneypunct<wchar_t>`,
|
| 3106 |
- `moneypunct<char, true>`, and
|
| 3107 |
- `moneypunct<wchar_t, true>`,
|
| 3108 |
|
| 3109 |
return an object of type `pattern` initialized to
|
| 3110 |
-
`{ symbol, sign, none, value }`.[^
|
| 3111 |
|
| 3112 |
-
#### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
|
| 3113 |
|
| 3114 |
``` cpp
|
| 3115 |
namespace std {
|
| 3116 |
template<class charT, bool Intl = false>
|
| 3117 |
class moneypunct_byname : public moneypunct<charT, Intl> {
|
|
@@ -3126,20 +3140,20 @@ namespace std {
|
|
| 3126 |
~moneypunct_byname();
|
| 3127 |
};
|
| 3128 |
}
|
| 3129 |
```
|
| 3130 |
|
| 3131 |
-
### The message retrieval category <a id="category.messages">[[category.messages]]</a>
|
| 3132 |
|
| 3133 |
-
#### General <a id="category.messages.general">[[category.messages.general]]</a>
|
| 3134 |
|
| 3135 |
Class `messages<charT>` implements retrieval of strings from message
|
| 3136 |
catalogs.
|
| 3137 |
|
| 3138 |
-
#### Class template `messages` <a id="locale.messages">[[locale.messages]]</a>
|
| 3139 |
|
| 3140 |
-
##### General <a id="locale.messages.general">[[locale.messages.general]]</a>
|
| 3141 |
|
| 3142 |
``` cpp
|
| 3143 |
namespace std {
|
| 3144 |
class messages_base {
|
| 3145 |
public:
|
|
@@ -3172,11 +3186,11 @@ namespace std {
|
|
| 3172 |
```
|
| 3173 |
|
| 3174 |
Values of type `messages_base::catalog` usable as arguments to members
|
| 3175 |
`get` and `close` can be obtained only by calling member `open`.
|
| 3176 |
|
| 3177 |
-
##### Members <a id="locale.messages.members">[[locale.messages.members]]</a>
|
| 3178 |
|
| 3179 |
``` cpp
|
| 3180 |
catalog open(const string& name, const locale& loc) const;
|
| 3181 |
```
|
| 3182 |
|
|
@@ -3192,11 +3206,11 @@ string_type get(catalog cat, int set, int msgid, const string_type& dfault) cons
|
|
| 3192 |
void close(catalog cat) const;
|
| 3193 |
```
|
| 3194 |
|
| 3195 |
*Effects:* Calls `do_close(cat)`.
|
| 3196 |
|
| 3197 |
-
##### Virtual functions <a id="locale.messages.virtuals">[[locale.messages.virtuals]]</a>
|
| 3198 |
|
| 3199 |
``` cpp
|
| 3200 |
catalog do_open(const string& name, const locale& loc) const;
|
| 3201 |
```
|
| 3202 |
|
|
@@ -3231,11 +3245,11 @@ closed.
|
|
| 3231 |
*Effects:* Releases unspecified resources associated with `cat`.
|
| 3232 |
|
| 3233 |
*Remarks:* The limit on such resources, if any, is
|
| 3234 |
*implementation-defined*.
|
| 3235 |
|
| 3236 |
-
#### Class template `messages_byname` <a id="locale.messages.byname">[[locale.messages.byname]]</a>
|
| 3237 |
|
| 3238 |
``` cpp
|
| 3239 |
namespace std {
|
| 3240 |
template<class charT>
|
| 3241 |
class messages_byname : public messages<charT> {
|
|
@@ -3250,13 +3264,13 @@ namespace std {
|
|
| 3250 |
~messages_byname();
|
| 3251 |
};
|
| 3252 |
}
|
| 3253 |
```
|
| 3254 |
|
| 3255 |
-
## C library locales <a id="c.locales">[[c.locales]]</a>
|
| 3256 |
|
| 3257 |
-
### Header `<clocale>` synopsis <a id="clocale.syn">[[clocale.syn]]</a>
|
| 3258 |
|
| 3259 |
``` cpp
|
| 3260 |
namespace std {
|
| 3261 |
struct lconv;
|
| 3262 |
|
|
@@ -3274,11 +3288,11 @@ namespace std {
|
|
| 3274 |
```
|
| 3275 |
|
| 3276 |
The contents and meaning of the header `<clocale>` are the same as the C
|
| 3277 |
standard library header `<locale.h>`.
|
| 3278 |
|
| 3279 |
-
### Data races <a id="clocale.data.races">[[clocale.data.races]]</a>
|
| 3280 |
|
| 3281 |
Calls to the function `setlocale` may introduce a data race
|
| 3282 |
[[res.on.data.races]] with other calls to `setlocale` or with calls to
|
| 3283 |
the functions listed in [[setlocale.data.races]].
|
| 3284 |
|
|
@@ -3297,207 +3311,5 @@ See also: ISO C 7.11
|
|
| 3297 |
| `isdigit` | `iswblank` | `iswupper` | `strerror` | `wcstombs` |
|
| 3298 |
| `isgraph` | `iswcntrl` | `iswxdigit` | `strtod` | `wcsxfrm` |
|
| 3299 |
| `islower` | `iswctype` | `isxdigit` | `strxfrm` | `wctomb` |
|
| 3300 |
|
| 3301 |
|
| 3302 |
-
|
| 3303 |
-
<!-- Link reference definitions -->
|
| 3304 |
-
[alg.lex.comparison]: algorithms.md#alg.lex.comparison
|
| 3305 |
-
[alg.sort]: algorithms.md#alg.sort
|
| 3306 |
-
[algorithms]: algorithms.md#algorithms
|
| 3307 |
-
[basic.start.static]: basic.md#basic.start.static
|
| 3308 |
-
[bitmask.types]: library.md#bitmask.types
|
| 3309 |
-
[c.files]: input.md#c.files
|
| 3310 |
-
[c.locales]: #c.locales
|
| 3311 |
-
[category.collate]: #category.collate
|
| 3312 |
-
[category.ctype]: #category.ctype
|
| 3313 |
-
[category.ctype.general]: #category.ctype.general
|
| 3314 |
-
[category.messages]: #category.messages
|
| 3315 |
-
[category.messages.general]: #category.messages.general
|
| 3316 |
-
[category.monetary]: #category.monetary
|
| 3317 |
-
[category.monetary.general]: #category.monetary.general
|
| 3318 |
-
[category.numeric]: #category.numeric
|
| 3319 |
-
[category.numeric.general]: #category.numeric.general
|
| 3320 |
-
[category.time]: #category.time
|
| 3321 |
-
[category.time.general]: #category.time.general
|
| 3322 |
-
[classification]: #classification
|
| 3323 |
-
[clocale.data.races]: #clocale.data.races
|
| 3324 |
-
[clocale.syn]: #clocale.syn
|
| 3325 |
-
[conversions.character]: #conversions.character
|
| 3326 |
-
[facet.ctype.char.dtor]: #facet.ctype.char.dtor
|
| 3327 |
-
[facet.ctype.char.members]: #facet.ctype.char.members
|
| 3328 |
-
[facet.ctype.char.statics]: #facet.ctype.char.statics
|
| 3329 |
-
[facet.ctype.char.virtuals]: #facet.ctype.char.virtuals
|
| 3330 |
-
[facet.ctype.special]: #facet.ctype.special
|
| 3331 |
-
[facet.ctype.special.general]: #facet.ctype.special.general
|
| 3332 |
-
[facet.num.get.members]: #facet.num.get.members
|
| 3333 |
-
[facet.num.get.virtuals]: #facet.num.get.virtuals
|
| 3334 |
-
[facet.num.put.members]: #facet.num.put.members
|
| 3335 |
-
[facet.num.put.virtuals]: #facet.num.put.virtuals
|
| 3336 |
-
[facet.numpunct]: #facet.numpunct
|
| 3337 |
-
[facet.numpunct.members]: #facet.numpunct.members
|
| 3338 |
-
[facet.numpunct.virtuals]: #facet.numpunct.virtuals
|
| 3339 |
-
[file.streams]: input.md#file.streams
|
| 3340 |
-
[ios.base]: input.md#ios.base
|
| 3341 |
-
[istream.formatted]: input.md#istream.formatted
|
| 3342 |
-
[istream.formatted.reqmts]: input.md#istream.formatted.reqmts
|
| 3343 |
-
[iterator.requirements]: iterators.md#iterator.requirements
|
| 3344 |
-
[lex.charset]: lex.md#lex.charset
|
| 3345 |
-
[locale]: #locale
|
| 3346 |
-
[locale.categories]: #locale.categories
|
| 3347 |
-
[locale.categories.general]: #locale.categories.general
|
| 3348 |
-
[locale.category]: #locale.category
|
| 3349 |
-
[locale.category.facets]: #locale.category.facets
|
| 3350 |
-
[locale.codecvt]: #locale.codecvt
|
| 3351 |
-
[locale.codecvt.byname]: #locale.codecvt.byname
|
| 3352 |
-
[locale.codecvt.general]: #locale.codecvt.general
|
| 3353 |
-
[locale.codecvt.inout]: #locale.codecvt.inout
|
| 3354 |
-
[locale.codecvt.members]: #locale.codecvt.members
|
| 3355 |
-
[locale.codecvt.unshift]: #locale.codecvt.unshift
|
| 3356 |
-
[locale.codecvt.virtuals]: #locale.codecvt.virtuals
|
| 3357 |
-
[locale.collate]: #locale.collate
|
| 3358 |
-
[locale.collate.byname]: #locale.collate.byname
|
| 3359 |
-
[locale.collate.general]: #locale.collate.general
|
| 3360 |
-
[locale.collate.members]: #locale.collate.members
|
| 3361 |
-
[locale.collate.virtuals]: #locale.collate.virtuals
|
| 3362 |
-
[locale.cons]: #locale.cons
|
| 3363 |
-
[locale.convenience]: #locale.convenience
|
| 3364 |
-
[locale.ctype]: #locale.ctype
|
| 3365 |
-
[locale.ctype.byname]: #locale.ctype.byname
|
| 3366 |
-
[locale.ctype.general]: #locale.ctype.general
|
| 3367 |
-
[locale.ctype.members]: #locale.ctype.members
|
| 3368 |
-
[locale.ctype.virtuals]: #locale.ctype.virtuals
|
| 3369 |
-
[locale.facet]: #locale.facet
|
| 3370 |
-
[locale.general]: #locale.general
|
| 3371 |
-
[locale.global.templates]: #locale.global.templates
|
| 3372 |
-
[locale.id]: #locale.id
|
| 3373 |
-
[locale.members]: #locale.members
|
| 3374 |
-
[locale.messages]: #locale.messages
|
| 3375 |
-
[locale.messages.byname]: #locale.messages.byname
|
| 3376 |
-
[locale.messages.general]: #locale.messages.general
|
| 3377 |
-
[locale.messages.members]: #locale.messages.members
|
| 3378 |
-
[locale.messages.virtuals]: #locale.messages.virtuals
|
| 3379 |
-
[locale.money.get]: #locale.money.get
|
| 3380 |
-
[locale.money.get.members]: #locale.money.get.members
|
| 3381 |
-
[locale.money.get.virtuals]: #locale.money.get.virtuals
|
| 3382 |
-
[locale.money.put]: #locale.money.put
|
| 3383 |
-
[locale.money.put.members]: #locale.money.put.members
|
| 3384 |
-
[locale.money.put.virtuals]: #locale.money.put.virtuals
|
| 3385 |
-
[locale.moneypunct]: #locale.moneypunct
|
| 3386 |
-
[locale.moneypunct.byname]: #locale.moneypunct.byname
|
| 3387 |
-
[locale.moneypunct.general]: #locale.moneypunct.general
|
| 3388 |
-
[locale.moneypunct.members]: #locale.moneypunct.members
|
| 3389 |
-
[locale.moneypunct.virtuals]: #locale.moneypunct.virtuals
|
| 3390 |
-
[locale.nm.put]: #locale.nm.put
|
| 3391 |
-
[locale.nm.put.general]: #locale.nm.put.general
|
| 3392 |
-
[locale.num.get]: #locale.num.get
|
| 3393 |
-
[locale.num.get.general]: #locale.num.get.general
|
| 3394 |
-
[locale.numpunct]: #locale.numpunct
|
| 3395 |
-
[locale.numpunct.byname]: #locale.numpunct.byname
|
| 3396 |
-
[locale.numpunct.general]: #locale.numpunct.general
|
| 3397 |
-
[locale.operators]: #locale.operators
|
| 3398 |
-
[locale.spec]: #locale.spec
|
| 3399 |
-
[locale.statics]: #locale.statics
|
| 3400 |
-
[locale.syn]: #locale.syn
|
| 3401 |
-
[locale.time.get]: #locale.time.get
|
| 3402 |
-
[locale.time.get.byname]: #locale.time.get.byname
|
| 3403 |
-
[locale.time.get.dogetdate]: #locale.time.get.dogetdate
|
| 3404 |
-
[locale.time.get.general]: #locale.time.get.general
|
| 3405 |
-
[locale.time.get.members]: #locale.time.get.members
|
| 3406 |
-
[locale.time.get.virtuals]: #locale.time.get.virtuals
|
| 3407 |
-
[locale.time.put]: #locale.time.put
|
| 3408 |
-
[locale.time.put.byname]: #locale.time.put.byname
|
| 3409 |
-
[locale.time.put.members]: #locale.time.put.members
|
| 3410 |
-
[locale.time.put.virtuals]: #locale.time.put.virtuals
|
| 3411 |
-
[locale.types]: #locale.types
|
| 3412 |
-
[locales]: #locales
|
| 3413 |
-
[localization]: #localization
|
| 3414 |
-
[localization.general]: #localization.general
|
| 3415 |
-
[localization.summary]: #localization.summary
|
| 3416 |
-
[ostream.formatted.reqmts]: input.md#ostream.formatted.reqmts
|
| 3417 |
-
[res.on.data.races]: library.md#res.on.data.races
|
| 3418 |
-
[sequence.reqmts]: containers.md#sequence.reqmts
|
| 3419 |
-
[setlocale.data.races]: #setlocale.data.races
|
| 3420 |
-
[tab:locale.category.facets]: #tab:locale.category.facets
|
| 3421 |
-
[tab:locale.spec]: #tab:locale.spec
|
| 3422 |
-
[vector]: containers.md#vector
|
| 3423 |
-
|
| 3424 |
-
[^1]: In this subclause, the type name `tm` is an incomplete type that
|
| 3425 |
-
is defined in `<ctime>`.
|
| 3426 |
-
|
| 3427 |
-
[^2]: Note that in the call to `put`, the stream is implicitly converted
|
| 3428 |
-
to an `ostreambuf_iterator<charT, traits>`.
|
| 3429 |
-
|
| 3430 |
-
[^3]: This is a complete list of requirements; there are no other
|
| 3431 |
-
requirements. Thus, a facet class need not have a public copy
|
| 3432 |
-
constructor, assignment, default constructor, destructor, etc.
|
| 3433 |
-
|
| 3434 |
-
[^4]: When used in a loop, it is faster to cache the `ctype<>` facet and
|
| 3435 |
-
use it directly, or use the vector form of `ctype<>::is`.
|
| 3436 |
-
|
| 3437 |
-
[^5]: The parameter `c` of `do_widen` is intended to accept values
|
| 3438 |
-
derived from *character-literal*s for conversion to the locale’s
|
| 3439 |
-
encoding.
|
| 3440 |
-
|
| 3441 |
-
[^6]: In other words, the transformed character is not a member of any
|
| 3442 |
-
character classification that `c` is not also a member of.
|
| 3443 |
-
|
| 3444 |
-
[^7]: Only the `char` (not `unsigned char` and `signed char`) form is
|
| 3445 |
-
provided. The specialization is specified in the standard, and not
|
| 3446 |
-
left as an implementation detail, because it affects the derivation
|
| 3447 |
-
interface for `ctype<char>`.
|
| 3448 |
-
|
| 3449 |
-
[^8]: Informally, this means that `basic_filebuf` assumes that the
|
| 3450 |
-
mappings from internal to external characters is 1 to N: that a
|
| 3451 |
-
`codecvt` facet that is used by `basic_filebuf` can translate
|
| 3452 |
-
characters one internal character at a time.
|
| 3453 |
-
|
| 3454 |
-
[^9]: Typically these will be characters to return the state to
|
| 3455 |
-
`stateT()`.
|
| 3456 |
-
|
| 3457 |
-
[^10]: If `encoding()` yields `-1`, then more than `max_length()`
|
| 3458 |
-
`externT` elements can be consumed when producing a single `internT`
|
| 3459 |
-
character, and additional `externT` elements can appear at the end
|
| 3460 |
-
of a sequence after those that yield the final `internT` character.
|
| 3461 |
-
|
| 3462 |
-
[^11]: Parsing `"-1"` correctly into, e.g., an `unsigned short` requires
|
| 3463 |
-
that the corresponding member `get()` at least extract the sign
|
| 3464 |
-
before delegating.
|
| 3465 |
-
|
| 3466 |
-
[^12]: The conversion specification `#o` generates a leading `0` which
|
| 3467 |
-
is *not* a padding character.
|
| 3468 |
-
|
| 3469 |
-
[^13]: Thus, the string `"\003"` specifies groups of 3 digits each, and
|
| 3470 |
-
`"3"` probably indicates groups of 51 (!) digits each, because 51 is
|
| 3471 |
-
the ASCII value of `"3"`.
|
| 3472 |
-
|
| 3473 |
-
[^14]: This function is useful when one string is being compared to many
|
| 3474 |
-
other strings.
|
| 3475 |
-
|
| 3476 |
-
[^15]: In other words, user confirmation is required for reliable
|
| 3477 |
-
parsing of user-entered dates and times, but machine-generated
|
| 3478 |
-
formats can be parsed reliably. This allows parsers to be aggressive
|
| 3479 |
-
about interpreting user variations on standard formats.
|
| 3480 |
-
|
| 3481 |
-
[^16]: This function is intended as a convenience only, for common
|
| 3482 |
-
formats, and can return `no_order` in valid locales.
|
| 3483 |
-
|
| 3484 |
-
[^17]: Although the C programming language defines no modifiers, most
|
| 3485 |
-
vendors do.
|
| 3486 |
-
|
| 3487 |
-
[^18]: The semantics here are different from `ct.narrow`.
|
| 3488 |
-
|
| 3489 |
-
[^19]: An array of `char`, rather than an array of `part`, is specified
|
| 3490 |
-
for `pattern::field` purely for efficiency.
|
| 3491 |
-
|
| 3492 |
-
[^20]: In common U.S. locales this is `’.’`.
|
| 3493 |
-
|
| 3494 |
-
[^21]: In common U.S. locales this is `’,’`.
|
| 3495 |
-
|
| 3496 |
-
[^22]: To specify grouping by 3s, the value is `"\003"` *not* `"3"`.
|
| 3497 |
-
|
| 3498 |
-
[^23]: This is usually the empty string.
|
| 3499 |
-
|
| 3500 |
-
[^24]: In common U.S. locales, this is 2.
|
| 3501 |
-
|
| 3502 |
-
[^25]: Note that the international symbol returned by `do_curr_symbol()`
|
| 3503 |
-
usually contains a space, itself; for example, `"USD "`.
|
|
|
|
| 1 |
+
## Localization library <a id="localization">[[localization]]</a>
|
| 2 |
|
| 3 |
+
### General <a id="localization.general">[[localization.general]]</a>
|
| 4 |
|
| 5 |
+
Subclause [[localization]] describes components that C++ programs may
|
| 6 |
+
use to encapsulate (and therefore be more portable when confronting)
|
| 7 |
+
cultural differences. The locale facility includes internationalization
|
| 8 |
+
support for character classification and string collation, numeric,
|
| 9 |
+
monetary, and date/time formatting and parsing, and message retrieval.
|
| 10 |
|
| 11 |
The following subclauses describe components for locales themselves, the
|
| 12 |
+
standard facets, and facilities from the C library, as summarized in
|
| 13 |
[[localization.summary]].
|
| 14 |
|
| 15 |
**Table: Localization library summary** <a id="localization.summary">[localization.summary]</a>
|
| 16 |
|
| 17 |
| Subclause | | Header |
|
|
|
|
| 19 |
| [[locales]] | Locales | `<locale>` |
|
| 20 |
| [[locale.categories]] | Standard `locale` categories | |
|
| 21 |
| [[c.locales]] | C library locales | `<clocale>` |
|
| 22 |
|
| 23 |
|
| 24 |
+
### Header `<locale>` synopsis <a id="locale.syn">[[locale.syn]]</a>
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
namespace std {
|
| 28 |
// [locale], locale
|
| 29 |
class locale;
|
|
|
|
| 99 |
```
|
| 100 |
|
| 101 |
The header `<locale>` defines classes and declares functions that
|
| 102 |
encapsulate and manipulate the information peculiar to a locale.[^1]
|
| 103 |
|
| 104 |
+
### Locales <a id="locales">[[locales]]</a>
|
| 105 |
|
| 106 |
+
#### Class `locale` <a id="locale">[[locale]]</a>
|
| 107 |
|
| 108 |
+
##### General <a id="locale.general">[[locale.general]]</a>
|
| 109 |
|
| 110 |
``` cpp
|
| 111 |
namespace std {
|
| 112 |
class locale {
|
| 113 |
public:
|
| 114 |
+
// [locale.types], types
|
| 115 |
+
// [locale.facet], class locale::facet
|
| 116 |
class facet;
|
| 117 |
+
// [locale.id], class locale::id
|
| 118 |
class id;
|
| 119 |
+
// [locale.category], type locale::category
|
| 120 |
using category = int;
|
| 121 |
static const category // values assigned here are for exposition only
|
| 122 |
none = 0,
|
| 123 |
collate = 0x010, ctype = 0x020,
|
| 124 |
monetary = 0x040, numeric = 0x080,
|
| 125 |
time = 0x100, messages = 0x200,
|
| 126 |
all = collate | ctype | monetary | numeric | time | messages;
|
| 127 |
|
| 128 |
+
// [locale.cons], construct/copy/destroy
|
| 129 |
locale() noexcept;
|
| 130 |
locale(const locale& other) noexcept;
|
| 131 |
explicit locale(const char* std_name);
|
| 132 |
explicit locale(const string& std_name);
|
| 133 |
locale(const locale& other, const char* std_name, category);
|
| 134 |
locale(const locale& other, const string& std_name, category);
|
| 135 |
template<class Facet> locale(const locale& other, Facet* f);
|
| 136 |
locale(const locale& other, const locale& one, category);
|
| 137 |
~locale(); // not virtual
|
| 138 |
const locale& operator=(const locale& other) noexcept;
|
| 139 |
+
|
| 140 |
+
// [locale.members], locale operations
|
| 141 |
template<class Facet> locale combine(const locale& other) const;
|
|
|
|
|
|
|
| 142 |
string name() const;
|
| 143 |
+
text_encoding encoding() const;
|
| 144 |
|
| 145 |
bool operator==(const locale& other) const;
|
| 146 |
|
| 147 |
template<class charT, class traits, class Allocator>
|
| 148 |
bool operator()(const basic_string<charT, traits, Allocator>& s1,
|
| 149 |
const basic_string<charT, traits, Allocator>& s2) const;
|
| 150 |
|
| 151 |
+
// [locale.statics], global locale objects
|
| 152 |
static locale global(const locale&);
|
| 153 |
static const locale& classic();
|
| 154 |
};
|
| 155 |
}
|
| 156 |
```
|
|
|
|
| 231 |
Implementations should provide one global locale object per thread. If
|
| 232 |
there is a single global locale object for the entire program,
|
| 233 |
implementations are not required to avoid data races on it
|
| 234 |
[[res.on.data.races]].
|
| 235 |
|
| 236 |
+
##### Types <a id="locale.types">[[locale.types]]</a>
|
| 237 |
|
| 238 |
+
###### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
|
| 239 |
|
| 240 |
``` cpp
|
| 241 |
using category = int;
|
| 242 |
```
|
| 243 |
|
|
|
|
| 267 |
| Category | Includes facets |
|
| 268 |
| -------- | ----------------------------------------------------- |
|
| 269 |
| collate | `collate<char>`, `collate<wchar_t>` |
|
| 270 |
| ctype | `ctype<char>`, `ctype<wchar_t>` |
|
| 271 |
| | `codecvt<char, char, mbstate_t>` |
|
|
|
|
|
|
|
| 272 |
| | `codecvt<wchar_t, char, mbstate_t>` |
|
| 273 |
| monetary | `moneypunct<char>`, `moneypunct<wchar_t>` |
|
| 274 |
| | `moneypunct<char, true>`, `moneypunct<wchar_t, true>` |
|
| 275 |
| | `money_get<char>`, `money_get<wchar_t>` |
|
| 276 |
| | `money_put<char>`, `money_put<wchar_t>` |
|
|
|
|
| 297 |
| Category | Includes facets |
|
| 298 |
| -------- | --------------------------------------------------------- |
|
| 299 |
| collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
|
| 300 |
| ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
|
| 301 |
| | `codecvt_byname<char, char, mbstate_t>` |
|
|
|
|
|
|
|
| 302 |
| | `codecvt_byname<wchar_t, char, mbstate_t>` |
|
| 303 |
| monetary | `moneypunct_byname<char, International>` |
|
| 304 |
| | `moneypunct_byname<wchar_t, International>` |
|
| 305 |
| | `money_get<C, InputIterator>` |
|
| 306 |
| | `money_put<C, OutputIterator>` |
|
|
|
|
| 327 |
`InputIterator` or `OutputIterator` indicates the set of all possible
|
| 328 |
specializations on parameters that meet the *Cpp17InputIterator*
|
| 329 |
requirements or *Cpp17OutputIterator* requirements, respectively
|
| 330 |
[[iterator.requirements]]. A template parameter with name `C` represents
|
| 331 |
the set of types containing `char`, `wchar_t`, and any other
|
| 332 |
+
*implementation-defined* character container types
|
| 333 |
+
[[defns.character.container]] that meet the requirements for a character
|
| 334 |
+
on which any of the iostream components can be instantiated. A template
|
| 335 |
+
parameter with name `International` represents the set of all possible
|
| 336 |
+
specializations on a bool parameter.
|
| 337 |
|
| 338 |
+
###### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
|
| 339 |
|
| 340 |
``` cpp
|
| 341 |
namespace std {
|
| 342 |
class locale::facet {
|
| 343 |
protected:
|
|
|
|
| 372 |
facet) when the last `locale` object containing the facet is destroyed;
|
| 373 |
for `refs == 1`, the implementation never destroys the facet.
|
| 374 |
|
| 375 |
Constructors of all facets defined in this Clause take such an argument
|
| 376 |
and pass it along to their `facet` base class constructor. All
|
| 377 |
+
one-argument constructors defined in this Clause are explicit,
|
| 378 |
preventing their participation in implicit conversions.
|
| 379 |
|
| 380 |
For some standard facets a standard “…`_byname`” class, derived from it,
|
| 381 |
implements the virtual function semantics equivalent to that facet of
|
| 382 |
the locale constructed by `locale(const char*)` with the same name. Each
|
|
|
|
| 387 |
same effect as calling the first constructor with the two arguments
|
| 388 |
`str.c_str()` and `refs`. If there is no “…`_byname`” version of a
|
| 389 |
facet, the base class implements named locale semantics itself by
|
| 390 |
reference to other facets.
|
| 391 |
|
| 392 |
+
###### Class `locale::id` <a id="locale.id">[[locale.id]]</a>
|
| 393 |
|
| 394 |
``` cpp
|
| 395 |
namespace std {
|
| 396 |
class locale::id {
|
| 397 |
public:
|
|
|
|
| 404 |
|
| 405 |
The class `locale::id` provides identification of a locale facet
|
| 406 |
interface, used as an index for lookup and to encapsulate
|
| 407 |
initialization.
|
| 408 |
|
| 409 |
+
[*Note 2*: Because facets are used by iostreams, potentially while
|
| 410 |
static constructors are running, their initialization cannot depend on
|
| 411 |
programmed static initialization. One initialization strategy is for
|
| 412 |
`locale` to initialize each facet’s `id` member the first time an
|
| 413 |
instance of the facet is installed into a locale. This depends only on
|
| 414 |
static storage being zero before constructors run
|
| 415 |
[[basic.start.static]]. — *end note*]
|
| 416 |
|
| 417 |
+
##### Constructors and destructor <a id="locale.cons">[[locale.cons]]</a>
|
| 418 |
|
| 419 |
``` cpp
|
| 420 |
locale() noexcept;
|
| 421 |
```
|
| 422 |
|
|
|
|
| 502 |
|
| 503 |
*Effects:* Creates a copy of `other`, replacing the current value.
|
| 504 |
|
| 505 |
*Returns:* `*this`.
|
| 506 |
|
| 507 |
+
##### Members <a id="locale.members">[[locale.members]]</a>
|
| 508 |
|
| 509 |
``` cpp
|
| 510 |
template<class Facet> locale combine(const locale& other) const;
|
| 511 |
```
|
| 512 |
|
|
|
|
| 524 |
```
|
| 525 |
|
| 526 |
*Returns:* The name of `*this`, if it has one; otherwise, the string
|
| 527 |
`"*"`.
|
| 528 |
|
| 529 |
+
``` cpp
|
| 530 |
+
text_encoding encoding() const;
|
| 531 |
+
```
|
| 532 |
+
|
| 533 |
+
*Mandates:* `CHAR_BIT == 8` is `true`.
|
| 534 |
+
|
| 535 |
+
*Returns:* A `text_encoding` object representing the
|
| 536 |
+
implementation-defined encoding scheme associated with the locale
|
| 537 |
+
`*this`.
|
| 538 |
+
|
| 539 |
+
##### Operators <a id="locale.operators">[[locale.operators]]</a>
|
| 540 |
|
| 541 |
``` cpp
|
| 542 |
bool operator==(const locale& other) const;
|
| 543 |
```
|
| 544 |
|
|
|
|
| 550 |
template<class charT, class traits, class Allocator>
|
| 551 |
bool operator()(const basic_string<charT, traits, Allocator>& s1,
|
| 552 |
const basic_string<charT, traits, Allocator>& s2) const;
|
| 553 |
```
|
| 554 |
|
| 555 |
+
*Effects:* Compares two strings according to the `std::collate<charT>`
|
| 556 |
+
facet.
|
| 557 |
|
| 558 |
*Returns:*
|
| 559 |
|
| 560 |
``` cpp
|
| 561 |
+
use_facet<std::collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
|
| 562 |
s2.data(), s2.data() + s2.size()) < 0
|
| 563 |
```
|
| 564 |
|
| 565 |
*Remarks:* This member operator template (and therefore `locale` itself)
|
| 566 |
meets the requirements for a comparator predicate template
|
|
|
|
| 575 |
std::sort(v.begin(), v.end(), loc);
|
| 576 |
```
|
| 577 |
|
| 578 |
— *end example*]
|
| 579 |
|
| 580 |
+
##### Static members <a id="locale.statics">[[locale.statics]]</a>
|
| 581 |
|
| 582 |
``` cpp
|
| 583 |
static locale global(const locale& loc);
|
| 584 |
```
|
| 585 |
|
|
|
|
| 597 |
*Returns:* The previous value of `locale()`.
|
| 598 |
|
| 599 |
*Remarks:* No library function other than `locale::global()` affects the
|
| 600 |
value returned by `locale()`.
|
| 601 |
|
| 602 |
+
[*Note 2*: See [[c.locales]] for data race considerations when
|
| 603 |
`setlocale` is invoked. — *end note*]
|
| 604 |
|
| 605 |
``` cpp
|
| 606 |
static const locale& classic();
|
| 607 |
```
|
|
|
|
| 612 |
equivalent to the value `locale("C")`.
|
| 613 |
|
| 614 |
*Remarks:* This locale, its facets, and their member functions, do not
|
| 615 |
change with time.
|
| 616 |
|
| 617 |
+
#### `locale` globals <a id="locale.global.templates">[[locale.global.templates]]</a>
|
| 618 |
|
| 619 |
``` cpp
|
| 620 |
template<class Facet> const Facet& use_facet(const locale& loc);
|
| 621 |
```
|
| 622 |
|
|
|
|
| 635 |
```
|
| 636 |
|
| 637 |
*Returns:* `true` if the facet requested is present in `loc`; otherwise
|
| 638 |
`false`.
|
| 639 |
|
| 640 |
+
#### Convenience interfaces <a id="locale.convenience">[[locale.convenience]]</a>
|
| 641 |
|
| 642 |
+
##### Character classification <a id="classification">[[classification]]</a>
|
| 643 |
|
| 644 |
``` cpp
|
| 645 |
template<class charT> bool isspace (charT c, const locale& loc);
|
| 646 |
template<class charT> bool isprint (charT c, const locale& loc);
|
| 647 |
template<class charT> bool iscntrl (charT c, const locale& loc);
|
|
|
|
| 663 |
```
|
| 664 |
|
| 665 |
where `F` is the `ctype_base::mask` value corresponding to that function
|
| 666 |
[[category.ctype]].[^4]
|
| 667 |
|
| 668 |
+
##### Character conversions <a id="conversions.character">[[conversions.character]]</a>
|
| 669 |
|
| 670 |
``` cpp
|
| 671 |
template<class charT> charT toupper(charT c, const locale& loc);
|
| 672 |
```
|
| 673 |
|
|
|
|
| 677 |
template<class charT> charT tolower(charT c, const locale& loc);
|
| 678 |
```
|
| 679 |
|
| 680 |
*Returns:* `use_facet<ctype<charT>>(loc).tolower(c)`.
|
| 681 |
|
| 682 |
+
### Standard `locale` categories <a id="locale.categories">[[locale.categories]]</a>
|
| 683 |
|
| 684 |
+
#### General <a id="locale.categories.general">[[locale.categories.general]]</a>
|
| 685 |
|
| 686 |
Each of the standard categories includes a family of facets. Some of
|
| 687 |
these implement formatting or parsing of a datum, for use by standard or
|
| 688 |
users’ iostream operators `<<` and `>>`, as members `put()` and `get()`,
|
| 689 |
respectively. Each such member function takes an `ios_base&` argument
|
|
|
|
| 697 |
of the OutputIterator argument can be extracted from the returned
|
| 698 |
iterator.) The `get()` members take an `ios_base::iostate&` argument
|
| 699 |
whose value they ignore, but set to `ios_base::failbit` in case of a
|
| 700 |
parse error.
|
| 701 |
|
| 702 |
+
Within [[locale.categories]] it is unspecified whether one virtual
|
| 703 |
+
function calls another virtual function.
|
| 704 |
|
| 705 |
+
#### The `ctype` category <a id="category.ctype">[[category.ctype]]</a>
|
| 706 |
|
| 707 |
+
##### General <a id="category.ctype.general">[[category.ctype.general]]</a>
|
| 708 |
|
| 709 |
``` cpp
|
| 710 |
namespace std {
|
| 711 |
class ctype_base {
|
| 712 |
public:
|
| 713 |
using mask = see below;
|
| 714 |
|
| 715 |
// numeric values are for exposition only.
|
| 716 |
+
static constexpr mask space = 1 << 0;
|
| 717 |
+
static constexpr mask print = 1 << 1;
|
| 718 |
+
static constexpr mask cntrl = 1 << 2;
|
| 719 |
+
static constexpr mask upper = 1 << 3;
|
| 720 |
+
static constexpr mask lower = 1 << 4;
|
| 721 |
+
static constexpr mask alpha = 1 << 5;
|
| 722 |
+
static constexpr mask digit = 1 << 6;
|
| 723 |
+
static constexpr mask punct = 1 << 7;
|
| 724 |
+
static constexpr mask xdigit = 1 << 8;
|
| 725 |
+
static constexpr mask blank = 1 << 9;
|
| 726 |
+
static constexpr mask alnum = alpha | digit;
|
| 727 |
+
static constexpr mask graph = alnum | punct;
|
| 728 |
};
|
| 729 |
}
|
| 730 |
```
|
| 731 |
|
| 732 |
The type `mask` is a bitmask type [[bitmask.types]].
|
| 733 |
|
| 734 |
+
##### Class template `ctype` <a id="locale.ctype">[[locale.ctype]]</a>
|
| 735 |
|
| 736 |
+
###### General <a id="locale.ctype.general">[[locale.ctype.general]]</a>
|
| 737 |
|
| 738 |
``` cpp
|
| 739 |
namespace std {
|
| 740 |
template<class charT>
|
| 741 |
class ctype : public locale::facet, public ctype_base {
|
|
|
|
| 786 |
The specializations required in [[locale.category.facets]]
|
| 787 |
[[locale.category]], namely `ctype<char>` and `ctype<wchar_t>`,
|
| 788 |
implement character classing appropriate to the implementation’s native
|
| 789 |
character set.
|
| 790 |
|
| 791 |
+
###### `ctype` members <a id="locale.ctype.members">[[locale.ctype.members]]</a>
|
| 792 |
|
| 793 |
``` cpp
|
| 794 |
bool is(mask m, charT c) const;
|
| 795 |
const charT* is(const charT* low, const charT* high, mask* vec) const;
|
| 796 |
```
|
|
|
|
| 808 |
```
|
| 809 |
|
| 810 |
*Returns:* `do_scan_not(m, low, high)`.
|
| 811 |
|
| 812 |
``` cpp
|
| 813 |
+
charT toupper(charT c) const;
|
| 814 |
const charT* toupper(charT* low, const charT* high) const;
|
| 815 |
```
|
| 816 |
|
| 817 |
*Returns:* `do_toupper(c)` or `do_toupper(low, high)`.
|
| 818 |
|
|
|
|
| 835 |
const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const;
|
| 836 |
```
|
| 837 |
|
| 838 |
*Returns:* `do_narrow(c, dfault)` or `do_narrow(low, high, dfault, to)`.
|
| 839 |
|
| 840 |
+
###### `ctype` virtual functions <a id="locale.ctype.virtuals">[[locale.ctype.virtuals]]</a>
|
| 841 |
|
| 842 |
``` cpp
|
| 843 |
bool do_is(mask m, charT c) const;
|
| 844 |
const charT* do_is(const charT* low, const charT* high, mask* vec) const;
|
| 845 |
```
|
|
|
|
| 911 |
values.[^5]
|
| 912 |
|
| 913 |
The only characters for which unique transformations are required are
|
| 914 |
those in the basic character set [[lex.charset]].
|
| 915 |
|
| 916 |
+
For any named `ctype` category with a `ctype<char>` facet `ctc` and
|
| 917 |
valid `ctype_base::mask` value `M`,
|
| 918 |
`(ctc.is(M, c) || !is(M, do_widen(c)) )` is `true`.[^6]
|
| 919 |
|
| 920 |
The second form transforms each character `*p` in the range \[`low`,
|
| 921 |
`high`), placing the result in `dest[p - low]`.
|
|
|
|
| 954 |
available) in `dest[p - low]`.
|
| 955 |
|
| 956 |
*Returns:* The first form returns the transformed value; or `dfault` if
|
| 957 |
no mapping is readily available. The second form returns `high`.
|
| 958 |
|
| 959 |
+
##### Class template `ctype_byname` <a id="locale.ctype.byname">[[locale.ctype.byname]]</a>
|
| 960 |
|
| 961 |
``` cpp
|
| 962 |
namespace std {
|
| 963 |
template<class charT>
|
| 964 |
class ctype_byname : public ctype<charT> {
|
| 965 |
public:
|
| 966 |
+
using mask = ctype<charT>::mask;
|
| 967 |
explicit ctype_byname(const char*, size_t refs = 0);
|
| 968 |
explicit ctype_byname(const string&, size_t refs = 0);
|
| 969 |
|
| 970 |
protected:
|
| 971 |
~ctype_byname();
|
| 972 |
};
|
| 973 |
}
|
| 974 |
```
|
| 975 |
|
| 976 |
+
##### `ctype<char>` specialization <a id="facet.ctype.special">[[facet.ctype.special]]</a>
|
| 977 |
|
| 978 |
+
###### General <a id="facet.ctype.special.general">[[facet.ctype.special.general]]</a>
|
| 979 |
|
| 980 |
``` cpp
|
| 981 |
namespace std {
|
| 982 |
template<>
|
| 983 |
class ctype<char> : public locale::facet, public ctype_base {
|
|
|
|
| 1027 |
on type `char` can be implemented inline.[^7]
|
| 1028 |
|
| 1029 |
The *implementation-defined* value of member `table_size` is at least
|
| 1030 |
256.
|
| 1031 |
|
| 1032 |
+
###### Destructor <a id="facet.ctype.char.dtor">[[facet.ctype.char.dtor]]</a>
|
| 1033 |
|
| 1034 |
``` cpp
|
| 1035 |
~ctype();
|
| 1036 |
```
|
| 1037 |
|
| 1038 |
*Effects:* If the constructor’s first argument was nonzero, and its
|
| 1039 |
second argument was `true`, does `delete [] table()`.
|
| 1040 |
|
| 1041 |
+
###### Members <a id="facet.ctype.char.members">[[facet.ctype.char.members]]</a>
|
| 1042 |
|
| 1043 |
In the following member descriptions, for `unsigned char` values `v`
|
| 1044 |
where `v >= table_size`, `table()[v]` is assumed to have an
|
| 1045 |
implementation-specific value (possibly different for each such value
|
| 1046 |
`v`) without performing the array lookup.
|
|
|
|
| 1123 |
```
|
| 1124 |
|
| 1125 |
*Returns:* The first constructor argument, if it was nonzero, otherwise
|
| 1126 |
`classic_table()`.
|
| 1127 |
|
| 1128 |
+
###### Static members <a id="facet.ctype.char.statics">[[facet.ctype.char.statics]]</a>
|
| 1129 |
|
| 1130 |
``` cpp
|
| 1131 |
static const mask* classic_table() noexcept;
|
| 1132 |
```
|
| 1133 |
|
| 1134 |
*Returns:* A pointer to the initial element of an array of size
|
| 1135 |
`table_size` which represents the classifications of characters in the
|
| 1136 |
`"C"` locale.
|
| 1137 |
|
| 1138 |
+
###### Virtual functions <a id="facet.ctype.char.virtuals">[[facet.ctype.char.virtuals]]</a>
|
| 1139 |
|
| 1140 |
``` cpp
|
| 1141 |
char do_toupper(char) const;
|
| 1142 |
const char* do_toupper(char* low, const char* high) const;
|
| 1143 |
char do_tolower(char) const;
|
|
|
|
| 1151 |
```
|
| 1152 |
|
| 1153 |
These functions are described identically as those members of the same
|
| 1154 |
name in the `ctype` class template [[locale.ctype.members]].
|
| 1155 |
|
| 1156 |
+
##### Class template `codecvt` <a id="locale.codecvt">[[locale.codecvt]]</a>
|
| 1157 |
|
| 1158 |
+
###### General <a id="locale.codecvt.general">[[locale.codecvt.general]]</a>
|
| 1159 |
|
| 1160 |
``` cpp
|
| 1161 |
namespace std {
|
| 1162 |
class codecvt_base {
|
| 1163 |
public:
|
|
|
|
| 1225 |
mapped between.
|
| 1226 |
|
| 1227 |
The specializations required in [[locale.category.facets]]
|
| 1228 |
[[locale.category]] convert the implementation-defined native character
|
| 1229 |
set. `codecvt<char, char, mbstate_t>` implements a degenerate
|
| 1230 |
+
conversion; it does not convert at all.
|
| 1231 |
+
`codecvt<wchar_t, char, mbstate_t>` converts between the native
|
| 1232 |
+
character sets for ordinary and wide characters. Specializations on
|
| 1233 |
+
`mbstate_t` perform conversion between encodings known to the library
|
| 1234 |
+
implementer. Other encodings can be converted by specializing on a
|
| 1235 |
+
program-defined `stateT` type. Objects of type `stateT` can contain any
|
| 1236 |
+
state that is useful to communicate to or from the specialized `do_in`
|
| 1237 |
+
or `do_out` members.
|
|
|
|
|
|
|
|
|
|
| 1238 |
|
| 1239 |
+
###### Members <a id="locale.codecvt.members">[[locale.codecvt.members]]</a>
|
| 1240 |
|
| 1241 |
``` cpp
|
| 1242 |
result out(
|
| 1243 |
stateT& state,
|
| 1244 |
const internT* from, const internT* from_end, const internT*& from_next,
|
|
|
|
| 1286 |
int max_length() const noexcept;
|
| 1287 |
```
|
| 1288 |
|
| 1289 |
*Returns:* `do_max_length()`.
|
| 1290 |
|
| 1291 |
+
###### Virtual functions <a id="locale.codecvt.virtuals">[[locale.codecvt.virtuals]]</a>
|
| 1292 |
|
| 1293 |
``` cpp
|
| 1294 |
result do_out(
|
| 1295 |
stateT& state,
|
| 1296 |
const internT* from, const internT* from_end, const internT*& from_next,
|
|
|
|
| 1312 |
destination `to`. Converts no more than `(from_end - from)` source
|
| 1313 |
elements, and stores no more than `(to_end - to)` destination elements.
|
| 1314 |
|
| 1315 |
Stops if it encounters a character it cannot convert. It always leaves
|
| 1316 |
the `from_next` and `to_next` pointers pointing one beyond the last
|
| 1317 |
+
element successfully converted. If it returns `noconv`, `internT` and
|
| 1318 |
+
`externT` are the same type, and the converted sequence is identical to
|
| 1319 |
+
the input sequence \[`from`, `from``next`), `to_next` is set equal to
|
| 1320 |
`to`, the value of `state` is unchanged, and there are no changes to the
|
| 1321 |
values in \[`to`, `to_end`).
|
| 1322 |
|
| 1323 |
A `codecvt` facet that is used by `basic_filebuf` [[file.streams]] shall
|
| 1324 |
have the property that if
|
|
|
|
| 1429 |
|
| 1430 |
*Effects:* The effect on the `state` argument is as if it called
|
| 1431 |
`do_in(state, from, from_end, from, to, to + max, to)` for `to` pointing
|
| 1432 |
to a buffer of at least `max` elements.
|
| 1433 |
|
| 1434 |
+
*Returns:* `(from_next - from)` where `from_next` is the largest value
|
| 1435 |
+
in the range \[`from`, `from_end`\] such that the sequence of values in
|
| 1436 |
+
the range \[`from`, `from_next`) represents `max` or fewer valid
|
| 1437 |
+
complete characters of type `internT`. The specialization
|
| 1438 |
`codecvt<char, char, mbstate_t>`, returns the lesser of `max` and
|
| 1439 |
`(from_end - from)`.
|
| 1440 |
|
| 1441 |
``` cpp
|
| 1442 |
int do_max_length() const noexcept;
|
|
|
|
| 1445 |
*Returns:* The maximum value that `do_length(state, from, from_end, 1)`
|
| 1446 |
can return for any valid range \[`from`, `from_end`) and `stateT` value
|
| 1447 |
`state`. The specialization
|
| 1448 |
`codecvt<char, char, mbstate_t>::do_max_length()` returns 1.
|
| 1449 |
|
| 1450 |
+
##### Class template `codecvt_byname` <a id="locale.codecvt.byname">[[locale.codecvt.byname]]</a>
|
| 1451 |
|
| 1452 |
``` cpp
|
| 1453 |
namespace std {
|
| 1454 |
template<class internT, class externT, class stateT>
|
| 1455 |
class codecvt_byname : public codecvt<internT, externT, stateT> {
|
|
|
|
| 1461 |
~codecvt_byname();
|
| 1462 |
};
|
| 1463 |
}
|
| 1464 |
```
|
| 1465 |
|
| 1466 |
+
#### The numeric category <a id="category.numeric">[[category.numeric]]</a>
|
| 1467 |
|
| 1468 |
+
##### General <a id="category.numeric.general">[[category.numeric.general]]</a>
|
| 1469 |
|
| 1470 |
The classes `num_get<>` and `num_put<>` handle numeric formatting and
|
| 1471 |
parsing. Virtual functions are provided for several numeric types.
|
| 1472 |
Implementations may (but are not required to) delegate extraction of
|
| 1473 |
smaller types to extractors for larger types.[^11]
|
|
|
|
| 1485 |
|
| 1486 |
Extractor and inserter members of the standard iostreams use `num_get<>`
|
| 1487 |
and `num_put<>` member functions for formatting and parsing numeric
|
| 1488 |
values [[istream.formatted.reqmts]], [[ostream.formatted.reqmts]].
|
| 1489 |
|
| 1490 |
+
##### Class template `num_get` <a id="locale.num.get">[[locale.num.get]]</a>
|
| 1491 |
|
| 1492 |
+
###### General <a id="locale.num.get.general">[[locale.num.get.general]]</a>
|
| 1493 |
|
| 1494 |
``` cpp
|
| 1495 |
namespace std {
|
| 1496 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 1497 |
class num_get : public locale::facet {
|
|
|
|
| 1555 |
```
|
| 1556 |
|
| 1557 |
The facet `num_get` is used to parse numeric values from an input
|
| 1558 |
sequence such as an istream.
|
| 1559 |
|
| 1560 |
+
###### Members <a id="facet.num.get.members">[[facet.num.get.members]]</a>
|
| 1561 |
|
| 1562 |
``` cpp
|
| 1563 |
iter_type get(iter_type in, iter_type end, ios_base& str,
|
| 1564 |
ios_base::iostate& err, bool& val) const;
|
| 1565 |
iter_type get(iter_type in, iter_type end, ios_base& str,
|
|
|
|
| 1584 |
ios_base::iostate& err, void*& val) const;
|
| 1585 |
```
|
| 1586 |
|
| 1587 |
*Returns:* `do_get(in, end, str, err, val)`.
|
| 1588 |
|
| 1589 |
+
###### Virtual functions <a id="facet.num.get.virtuals">[[facet.num.get.virtuals]]</a>
|
| 1590 |
|
| 1591 |
``` cpp
|
| 1592 |
iter_type do_get(iter_type in, iter_type end, ios_base& str,
|
| 1593 |
ios_base::iostate& err, long& val) const;
|
| 1594 |
iter_type do_get(iter_type in, iter_type end, ios_base& str,
|
|
|
|
| 1613 |
|
| 1614 |
*Effects:* Reads characters from `in`, interpreting them according to
|
| 1615 |
`str.flags()`, `use_facet<ctype<charT>>(loc)`, and
|
| 1616 |
`use_facet<numpunct<charT>>(loc)`, where `loc` is `str.getloc()`.
|
| 1617 |
|
| 1618 |
+
The details of this operation occur in three stages:
|
| 1619 |
|
| 1620 |
+
- Stage 1: Determine a conversion specifier.
|
| 1621 |
- Stage 2: Extract characters from `in` and determine a corresponding
|
| 1622 |
`char` value for the format expected by the conversion specification
|
| 1623 |
determined in stage 1.
|
| 1624 |
+
- Stage 3: Store results.
|
| 1625 |
|
| 1626 |
The details of the stages are presented below.
|
| 1627 |
|
| 1628 |
[*Example 1*:
|
| 1629 |
|
|
|
|
| 1673 |
|
| 1674 |
The `in` iterator is always left pointing one position beyond the last
|
| 1675 |
character successfully matched. If `val` is set, then `err` is set to
|
| 1676 |
`str.goodbit`; or to `str.eofbit` if, when seeking another character to
|
| 1677 |
match, it is found that `(in == end)`. If `val` is not set, then `err`
|
| 1678 |
+
is set to `str.failbit`; or to `(str.failbit | str.eofbit)` if the
|
| 1679 |
+
reason for the failure was that `(in == end)`.
|
| 1680 |
|
| 1681 |
[*Example 2*: For targets `true`: `"a"` and `false`: `"abb"`, the input
|
| 1682 |
sequence `"a"` yields `val == true` and `err == str.eofbit`; the input
|
| 1683 |
sequence `"abc"` yields `err = str.failbit`, with `in` ending at the
|
| 1684 |
`’c’` element. For targets `true`: `"1"` and `false`: `"0"`, the input
|
|
|
|
| 1686 |
targets `("")`, any input sequence yields
|
| 1687 |
`err == str.failbit`. — *end example*]
|
| 1688 |
|
| 1689 |
*Returns:* `in`.
|
| 1690 |
|
| 1691 |
+
##### Class template `num_put` <a id="locale.nm.put">[[locale.nm.put]]</a>
|
| 1692 |
|
| 1693 |
+
###### General <a id="locale.nm.put.general">[[locale.nm.put.general]]</a>
|
| 1694 |
|
| 1695 |
``` cpp
|
| 1696 |
namespace std {
|
| 1697 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 1698 |
class num_put : public locale::facet {
|
|
|
|
| 1728 |
```
|
| 1729 |
|
| 1730 |
The facet `num_put` is used to format numeric values to a character
|
| 1731 |
sequence such as an ostream.
|
| 1732 |
|
| 1733 |
+
###### Members <a id="facet.num.put.members">[[facet.num.put.members]]</a>
|
| 1734 |
|
| 1735 |
``` cpp
|
| 1736 |
iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
|
| 1737 |
iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
|
| 1738 |
iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
|
|
|
|
| 1743 |
iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
|
| 1744 |
```
|
| 1745 |
|
| 1746 |
*Returns:* `do_put(out, str, fill, val)`.
|
| 1747 |
|
| 1748 |
+
###### Virtual functions <a id="facet.num.put.virtuals">[[facet.num.put.virtuals]]</a>
|
| 1749 |
|
| 1750 |
``` cpp
|
| 1751 |
iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
|
| 1752 |
iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
|
| 1753 |
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
|
|
|
|
| 1826 |
|
| 1827 |
**Table: Floating-point conversions** <a id="facet.num.put.fp">[facet.num.put.fp]</a>
|
| 1828 |
|
| 1829 |
| State | `stdio` equivalent |
|
| 1830 |
| ---------------------------------------------------------------------- | ------------------ |
|
| 1831 |
+
| `floatfield == ios_base::fixed && !uppercase` | `%f` |
|
| 1832 |
+
| `floatfield == ios_base::fixed` | `%F` |
|
| 1833 |
| `floatfield == ios_base::scientific && !uppercase` | `%e` |
|
| 1834 |
| `floatfield == ios_base::scientific` | `%E` |
|
| 1835 |
| `floatfield == (ios_base::fixed | ios_base::scientific) && !uppercase` | `%a` |
|
| 1836 |
| `floatfield == (ios_base::fixed | ios_base::scientific)` | `%A` |
|
| 1837 |
| `!uppercase` | `%g` |
|
|
|
|
| 1953 |
```
|
| 1954 |
|
| 1955 |
and then inserts each character `c` of `s` into `out` via `*out++ = c`
|
| 1956 |
and returns `out`.
|
| 1957 |
|
| 1958 |
+
#### The numeric punctuation facet <a id="facet.numpunct">[[facet.numpunct]]</a>
|
| 1959 |
|
| 1960 |
+
##### Class template `numpunct` <a id="locale.numpunct">[[locale.numpunct]]</a>
|
| 1961 |
|
| 1962 |
+
###### General <a id="locale.numpunct.general">[[locale.numpunct.general]]</a>
|
| 1963 |
|
| 1964 |
``` cpp
|
| 1965 |
namespace std {
|
| 1966 |
template<class charT>
|
| 1967 |
class numpunct : public locale::facet {
|
|
|
|
| 2050 |
|
| 2051 |
where the number of digits between is as specified by `do_grouping()`.
|
| 2052 |
For parsing, if the portion contains no thousands-separators, no
|
| 2053 |
grouping constraint is applied.
|
| 2054 |
|
| 2055 |
+
###### Members <a id="facet.numpunct.members">[[facet.numpunct.members]]</a>
|
| 2056 |
|
| 2057 |
``` cpp
|
| 2058 |
char_type decimal_point() const;
|
| 2059 |
```
|
| 2060 |
|
|
|
|
| 2077 |
string_type falsename() const;
|
| 2078 |
```
|
| 2079 |
|
| 2080 |
*Returns:* `do_truename()` or `do_falsename()`, respectively.
|
| 2081 |
|
| 2082 |
+
###### Virtual functions <a id="facet.numpunct.virtuals">[[facet.numpunct.virtuals]]</a>
|
| 2083 |
|
| 2084 |
``` cpp
|
| 2085 |
char_type do_decimal_point() const;
|
| 2086 |
```
|
| 2087 |
|
|
|
|
| 2119 |
`false`, respectively.
|
| 2120 |
|
| 2121 |
In the base class implementation these names are `"true"` and `"false"`,
|
| 2122 |
or `L"true"` and `L"false"`.
|
| 2123 |
|
| 2124 |
+
##### Class template `numpunct_byname` <a id="locale.numpunct.byname">[[locale.numpunct.byname]]</a>
|
| 2125 |
|
| 2126 |
``` cpp
|
| 2127 |
namespace std {
|
| 2128 |
template<class charT>
|
| 2129 |
class numpunct_byname : public numpunct<charT> {
|
|
|
|
| 2139 |
~numpunct_byname();
|
| 2140 |
};
|
| 2141 |
}
|
| 2142 |
```
|
| 2143 |
|
| 2144 |
+
#### The collate category <a id="category.collate">[[category.collate]]</a>
|
| 2145 |
|
| 2146 |
+
##### Class template `collate` <a id="locale.collate">[[locale.collate]]</a>
|
| 2147 |
|
| 2148 |
+
###### General <a id="locale.collate.general">[[locale.collate.general]]</a>
|
| 2149 |
|
| 2150 |
``` cpp
|
| 2151 |
namespace std {
|
| 2152 |
template<class charT>
|
| 2153 |
class collate : public locale::facet {
|
|
|
|
| 2184 |
[[alg.lex.comparison]].
|
| 2185 |
|
| 2186 |
Each function compares a string of characters `*p` in the range \[`low`,
|
| 2187 |
`high`).
|
| 2188 |
|
| 2189 |
+
###### Members <a id="locale.collate.members">[[locale.collate.members]]</a>
|
| 2190 |
|
| 2191 |
``` cpp
|
| 2192 |
int compare(const charT* low1, const charT* high1,
|
| 2193 |
const charT* low2, const charT* high2) const;
|
| 2194 |
```
|
|
|
|
| 2205 |
long hash(const charT* low, const charT* high) const;
|
| 2206 |
```
|
| 2207 |
|
| 2208 |
*Returns:* `do_hash(low, high)`.
|
| 2209 |
|
| 2210 |
+
###### Virtual functions <a id="locale.collate.virtuals">[[locale.collate.virtuals]]</a>
|
| 2211 |
|
| 2212 |
``` cpp
|
| 2213 |
int do_compare(const charT* low1, const charT* high1,
|
| 2214 |
const charT* low2, const charT* high2) const;
|
| 2215 |
```
|
|
|
|
| 2239 |
|
| 2240 |
*Recommended practice:* The probability that the result equals that for
|
| 2241 |
another string which does not compare equal should be very small,
|
| 2242 |
approaching `(1.0/numeric_limits<unsigned long>::max())`.
|
| 2243 |
|
| 2244 |
+
##### Class template `collate_byname` <a id="locale.collate.byname">[[locale.collate.byname]]</a>
|
| 2245 |
|
| 2246 |
``` cpp
|
| 2247 |
namespace std {
|
| 2248 |
template<class charT>
|
| 2249 |
class collate_byname : public collate<charT> {
|
|
|
|
| 2257 |
~collate_byname();
|
| 2258 |
};
|
| 2259 |
}
|
| 2260 |
```
|
| 2261 |
|
| 2262 |
+
#### The time category <a id="category.time">[[category.time]]</a>
|
| 2263 |
|
| 2264 |
+
##### General <a id="category.time.general">[[category.time.general]]</a>
|
| 2265 |
|
| 2266 |
Templates `time_get<charT, InputIterator>` and
|
| 2267 |
`time_put<charT, OutputIterator>` provide date and time formatting and
|
| 2268 |
parsing. All specifications of member functions for `time_put` and
|
| 2269 |
`time_get` in the subclauses of [[category.time]] only apply to the
|
|
|
|
| 2271 |
[[tab:locale.spec]] [[locale.category]]. Their members use their
|
| 2272 |
`ios_base&`, `ios_base::iostate&`, and `fill` arguments as described in
|
| 2273 |
[[locale.categories]], and the `ctype<>` facet, to determine formatting
|
| 2274 |
details.
|
| 2275 |
|
| 2276 |
+
##### Class template `time_get` <a id="locale.time.get">[[locale.time.get]]</a>
|
| 2277 |
|
| 2278 |
+
###### General <a id="locale.time.get.general">[[locale.time.get.general]]</a>
|
| 2279 |
|
| 2280 |
``` cpp
|
| 2281 |
namespace std {
|
| 2282 |
class time_base {
|
| 2283 |
public:
|
|
|
|
| 2339 |
are assigned.[^15]
|
| 2340 |
|
| 2341 |
If the end iterator is reached during parsing by any of the `get()`
|
| 2342 |
member functions, the member sets `ios_base::eofbit` in `err`.
|
| 2343 |
|
| 2344 |
+
###### Members <a id="locale.time.get.members">[[locale.time.get.members]]</a>
|
| 2345 |
|
| 2346 |
``` cpp
|
| 2347 |
dateorder date_order() const;
|
| 2348 |
```
|
| 2349 |
|
|
|
|
| 2432 |
whether multi-character sequences are considered while doing
|
| 2433 |
so. — *end note*]
|
| 2434 |
|
| 2435 |
*Returns:* `s`.
|
| 2436 |
|
| 2437 |
+
###### Virtual functions <a id="locale.time.get.virtuals">[[locale.time.get.virtuals]]</a>
|
| 2438 |
|
| 2439 |
``` cpp
|
| 2440 |
dateorder do_date_order() const;
|
| 2441 |
```
|
| 2442 |
|
|
|
|
| 2550 |
*Remarks:* It is unspecified whether multiple calls to `do_get()` with
|
| 2551 |
the address of the same `tm` object will update the current contents of
|
| 2552 |
the object or simply overwrite its members. Portable programs should
|
| 2553 |
zero out the object before invoking the function.
|
| 2554 |
|
| 2555 |
+
##### Class template `time_get_byname` <a id="locale.time.get.byname">[[locale.time.get.byname]]</a>
|
| 2556 |
|
| 2557 |
``` cpp
|
| 2558 |
namespace std {
|
| 2559 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 2560 |
class time_get_byname : public time_get<charT, InputIterator> {
|
|
|
|
| 2569 |
~time_get_byname();
|
| 2570 |
};
|
| 2571 |
}
|
| 2572 |
```
|
| 2573 |
|
| 2574 |
+
##### Class template `time_put` <a id="locale.time.put">[[locale.time.put]]</a>
|
| 2575 |
+
|
| 2576 |
+
###### General <a id="locale.time.put.general">[[locale.time.put.general]]</a>
|
| 2577 |
|
| 2578 |
``` cpp
|
| 2579 |
namespace std {
|
| 2580 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 2581 |
class time_put : public locale::facet {
|
|
|
|
| 2599 |
char format, char modifier) const;
|
| 2600 |
};
|
| 2601 |
}
|
| 2602 |
```
|
| 2603 |
|
| 2604 |
+
###### Members <a id="locale.time.put.members">[[locale.time.put.members]]</a>
|
| 2605 |
|
| 2606 |
``` cpp
|
| 2607 |
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
|
| 2608 |
const charT* pattern, const charT* pat_end) const;
|
| 2609 |
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
|
|
|
|
| 2618 |
interleaved in the output in the order in which they appear in the
|
| 2619 |
pattern. Format sequences are identified by converting each character
|
| 2620 |
`c` to a `char` value as if by `ct.narrow(c, 0)`, where `ct` is a
|
| 2621 |
reference to `ctype<charT>` obtained from `str.getloc()`. The first
|
| 2622 |
character of each sequence is equal to `’%’`, followed by an optional
|
| 2623 |
+
modifier character `mod` and a format specifier character `spec` as
|
| 2624 |
+
defined for the function `strftime`. If no modifier character is
|
| 2625 |
+
present, `mod` is zero. For each valid format sequence identified, calls
|
|
|
|
|
|
|
| 2626 |
`do_put(s, str, fill, t, spec, mod)`.
|
| 2627 |
|
| 2628 |
The second form calls `do_put(s, str, fill, t, format, modifier)`.
|
| 2629 |
|
| 2630 |
+
[*Note 2*: The `fill` argument can be used in the
|
| 2631 |
implementation-defined formats or by derivations. A space character is a
|
| 2632 |
reasonable default for this argument. — *end note*]
|
| 2633 |
|
| 2634 |
*Returns:* An iterator pointing immediately after the last character
|
| 2635 |
produced.
|
| 2636 |
|
| 2637 |
+
###### Virtual functions <a id="locale.time.put.virtuals">[[locale.time.put.virtuals]]</a>
|
| 2638 |
|
| 2639 |
``` cpp
|
| 2640 |
iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
|
| 2641 |
char format, char modifier) const;
|
| 2642 |
```
|
|
|
|
| 2647 |
format specifiers in the string argument to the standard library
|
| 2648 |
function `strftime()`, except that the sequence of characters produced
|
| 2649 |
for those specifiers that are described as depending on the C locale are
|
| 2650 |
instead *implementation-defined*.
|
| 2651 |
|
| 2652 |
+
[*Note 3*: Interpretation of the `modifier` argument is
|
| 2653 |
implementation-defined. — *end note*]
|
| 2654 |
|
| 2655 |
*Returns:* An iterator pointing immediately after the last character
|
| 2656 |
produced.
|
| 2657 |
|
| 2658 |
+
[*Note 4*: The `fill` argument can be used in the
|
| 2659 |
implementation-defined formats or by derivations. A space character is a
|
| 2660 |
reasonable default for this argument. — *end note*]
|
| 2661 |
|
| 2662 |
*Recommended practice:* Interpretation of the `modifier` should follow
|
| 2663 |
POSIX conventions. Implementations should refer to other standards such
|
| 2664 |
as POSIX for a specification of the character sequences produced for
|
| 2665 |
those specifiers described as depending on the C locale.
|
| 2666 |
|
| 2667 |
+
##### Class template `time_put_byname` <a id="locale.time.put.byname">[[locale.time.put.byname]]</a>
|
| 2668 |
|
| 2669 |
``` cpp
|
| 2670 |
namespace std {
|
| 2671 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 2672 |
class time_put_byname : public time_put<charT, OutputIterator> {
|
|
|
|
| 2681 |
~time_put_byname();
|
| 2682 |
};
|
| 2683 |
}
|
| 2684 |
```
|
| 2685 |
|
| 2686 |
+
#### The monetary category <a id="category.monetary">[[category.monetary]]</a>
|
| 2687 |
|
| 2688 |
+
##### General <a id="category.monetary.general">[[category.monetary.general]]</a>
|
| 2689 |
|
| 2690 |
These templates handle monetary formats. A template parameter indicates
|
| 2691 |
whether local or international monetary formats are to be used.
|
| 2692 |
|
| 2693 |
All specifications of member functions for `money_put` and `money_get`
|
|
|
|
| 2696 |
[[tab:locale.spec]] [[locale.category]]. Their members use their
|
| 2697 |
`ios_base&`, `ios_base::iostate&`, and `fill` arguments as described in
|
| 2698 |
[[locale.categories]], and the `moneypunct<>` and `ctype<>` facets, to
|
| 2699 |
determine formatting details.
|
| 2700 |
|
| 2701 |
+
##### Class template `money_get` <a id="locale.money.get">[[locale.money.get]]</a>
|
| 2702 |
+
|
| 2703 |
+
###### General <a id="locale.money.get.general">[[locale.money.get.general]]</a>
|
| 2704 |
|
| 2705 |
``` cpp
|
| 2706 |
namespace std {
|
| 2707 |
template<class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 2708 |
class money_get : public locale::facet {
|
|
|
|
| 2730 |
ios_base::iostate& err, string_type& digits) const;
|
| 2731 |
};
|
| 2732 |
}
|
| 2733 |
```
|
| 2734 |
|
| 2735 |
+
###### Members <a id="locale.money.get.members">[[locale.money.get.members]]</a>
|
| 2736 |
|
| 2737 |
``` cpp
|
| 2738 |
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
| 2739 |
ios_base::iostate& err, long double& quant) const;
|
| 2740 |
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
|
| 2741 |
ios_base::iostate& err, string_type& quant) const;
|
| 2742 |
```
|
| 2743 |
|
| 2744 |
*Returns:* `do_get(s, end, intl, f, err, quant)`.
|
| 2745 |
|
| 2746 |
+
###### Virtual functions <a id="locale.money.get.virtuals">[[locale.money.get.virtuals]]</a>
|
| 2747 |
|
| 2748 |
``` cpp
|
| 2749 |
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
| 2750 |
ios_base::iostate& err, long double& units) const;
|
| 2751 |
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
|
|
|
|
| 2755 |
*Effects:* Reads characters from `s` to parse and construct a monetary
|
| 2756 |
value according to the format specified by a `moneypunct<charT, Intl>`
|
| 2757 |
facet reference `mp` and the character mapping specified by a
|
| 2758 |
`ctype<charT>` facet reference `ct` obtained from the locale returned by
|
| 2759 |
`str.getloc()`, and `str.flags()`. If a valid sequence is recognized,
|
| 2760 |
+
does not change `err`; otherwise, sets `err` to `(err | str.failbit)`,
|
| 2761 |
+
or `(err | str.failbit | str.eofbit)` if no more characters are
|
| 2762 |
+
available, and does not change `units` or `digits`. Uses the pattern
|
| 2763 |
+
returned by `mp.neg_format()` to parse all values. The result is
|
| 2764 |
+
returned as an integral value stored in `units` or as a sequence of
|
| 2765 |
+
digits possibly preceded by a minus sign (as produced by `ct.widen(c)`
|
| 2766 |
+
where `c` is `’-’` or in the range from `’0’` through `’9’` (inclusive))
|
| 2767 |
+
stored in `digits`.
|
| 2768 |
|
| 2769 |
[*Example 1*: The sequence `$1,056.23` in a common United States locale
|
| 2770 |
would yield, for `units`, `105623`, or, for `digits`,
|
| 2771 |
`"105623"`. — *end example*]
|
| 2772 |
|
|
|
|
| 2807 |
|
| 2808 |
Digits in the numeric monetary component are extracted and placed in
|
| 2809 |
`digits`, or into a character buffer `buf1` for conversion to produce a
|
| 2810 |
value for `units`, in the order in which they appear, preceded by a
|
| 2811 |
minus sign if and only if the result is negative. The value `units` is
|
| 2812 |
+
produced as if by[^17]
|
| 2813 |
|
| 2814 |
``` cpp
|
| 2815 |
for (int i = 0; i < n; ++i)
|
| 2816 |
buf2[i] = src[find(atoms, atoms + sizeof(src), buf1[i]) - atoms];
|
| 2817 |
buf2[n] = 0;
|
|
|
|
| 2828 |
```
|
| 2829 |
|
| 2830 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 2831 |
recognized as part of a valid monetary quantity.
|
| 2832 |
|
| 2833 |
+
##### Class template `money_put` <a id="locale.money.put">[[locale.money.put]]</a>
|
| 2834 |
+
|
| 2835 |
+
###### General <a id="locale.money.put.general">[[locale.money.put.general]]</a>
|
| 2836 |
|
| 2837 |
``` cpp
|
| 2838 |
namespace std {
|
| 2839 |
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
|
| 2840 |
class money_put : public locale::facet {
|
|
|
|
| 2860 |
const string_type& digits) const;
|
| 2861 |
};
|
| 2862 |
}
|
| 2863 |
```
|
| 2864 |
|
| 2865 |
+
###### Members <a id="locale.money.put.members">[[locale.money.put.members]]</a>
|
| 2866 |
|
| 2867 |
``` cpp
|
| 2868 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
|
| 2869 |
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
|
| 2870 |
```
|
| 2871 |
|
| 2872 |
+
*Returns:* `do_put(s, intl, f, fill, quant)`.
|
| 2873 |
|
| 2874 |
+
###### Virtual functions <a id="locale.money.put.virtuals">[[locale.money.put.virtuals]]</a>
|
| 2875 |
|
| 2876 |
``` cpp
|
| 2877 |
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
| 2878 |
char_type fill, long double units) const;
|
| 2879 |
iter_type do_put(iter_type s, bool intl, ios_base& str,
|
|
|
|
| 2918 |
|
| 2919 |
[*Note 1*: It is possible, with some combinations of format patterns
|
| 2920 |
and flag values, to produce output that cannot be parsed using
|
| 2921 |
`num_get<>::get`. — *end note*]
|
| 2922 |
|
| 2923 |
+
##### Class template `moneypunct` <a id="locale.moneypunct">[[locale.moneypunct]]</a>
|
| 2924 |
|
| 2925 |
+
###### General <a id="locale.moneypunct.general">[[locale.moneypunct.general]]</a>
|
| 2926 |
|
| 2927 |
``` cpp
|
| 2928 |
namespace std {
|
| 2929 |
class money_base {
|
| 2930 |
public:
|
|
|
|
| 2970 |
|
| 2971 |
The `moneypunct<>` facet defines monetary formatting parameters used by
|
| 2972 |
`money_get<>` and `money_put<>`. A monetary format is a sequence of four
|
| 2973 |
components, specified by a `pattern` value `p`, such that the `part`
|
| 2974 |
value `static_cast<part>(p.field[i])` determines the `i`ᵗʰ component of
|
| 2975 |
+
the format.[^18]
|
| 2976 |
|
| 2977 |
In the `field` member of a `pattern` object, each value `symbol`,
|
| 2978 |
`sign`, `value`, and either `space` or `none` appears exactly once. The
|
| 2979 |
value `none`, if present, is not first; the value `space`, if present,
|
| 2980 |
is neither first nor last.
|
|
|
|
| 3037 |
|
| 3038 |
The placement of thousands-separator characters (if any) is determined
|
| 3039 |
by the value returned by `grouping()`, defined identically as the member
|
| 3040 |
`numpunct<>::do_grouping()`.
|
| 3041 |
|
| 3042 |
+
###### Members <a id="locale.moneypunct.members">[[locale.moneypunct.members]]</a>
|
| 3043 |
|
| 3044 |
``` cpp
|
| 3045 |
charT decimal_point() const;
|
| 3046 |
charT thousands_sep() const;
|
| 3047 |
string grouping() const;
|
|
|
|
| 3054 |
```
|
| 3055 |
|
| 3056 |
Each of these functions `F` returns the result of calling the
|
| 3057 |
corresponding virtual member function `do_F()`.
|
| 3058 |
|
| 3059 |
+
###### Virtual functions <a id="locale.moneypunct.virtuals">[[locale.moneypunct.virtuals]]</a>
|
| 3060 |
|
| 3061 |
``` cpp
|
| 3062 |
charT do_decimal_point() const;
|
| 3063 |
```
|
| 3064 |
|
| 3065 |
*Returns:* The radix separator to use in case `do_frac_digits()` is
|
| 3066 |
+
greater than zero.[^19]
|
| 3067 |
|
| 3068 |
``` cpp
|
| 3069 |
charT do_thousands_sep() const;
|
| 3070 |
```
|
| 3071 |
|
| 3072 |
*Returns:* The digit group separator to use in case `do_grouping()`
|
| 3073 |
+
specifies a digit grouping pattern.[^20]
|
| 3074 |
|
| 3075 |
``` cpp
|
| 3076 |
string do_grouping() const;
|
| 3077 |
```
|
| 3078 |
|
| 3079 |
*Returns:* A pattern defined identically as, but not necessarily equal
|
| 3080 |
+
to, the result of `numpunct<charT>::do_grouping()`.[^21]
|
| 3081 |
|
| 3082 |
``` cpp
|
| 3083 |
string_type do_curr_symbol() const;
|
| 3084 |
```
|
| 3085 |
|
| 3086 |
*Returns:* A string to use as the currency identifier symbol.
|
| 3087 |
|
| 3088 |
+
[*Note 2*: For specializations where the second template parameter is
|
| 3089 |
`true`, this is typically four characters long: a three-letter code as
|
| 3090 |
specified by ISO 4217 followed by a space. — *end note*]
|
| 3091 |
|
| 3092 |
``` cpp
|
| 3093 |
string_type do_positive_sign() const;
|
| 3094 |
string_type do_negative_sign() const;
|
| 3095 |
```
|
| 3096 |
|
| 3097 |
*Returns:* `do_positive_sign()` returns the string to use to indicate a
|
| 3098 |
+
positive monetary value;[^22]
|
| 3099 |
|
| 3100 |
`do_negative_sign()` returns the string to use to indicate a negative
|
| 3101 |
value.
|
| 3102 |
|
| 3103 |
``` cpp
|
| 3104 |
int do_frac_digits() const;
|
| 3105 |
```
|
| 3106 |
|
| 3107 |
*Returns:* The number of digits after the decimal radix separator, if
|
| 3108 |
+
any.[^23]
|
| 3109 |
|
| 3110 |
``` cpp
|
| 3111 |
pattern do_pos_format() const;
|
| 3112 |
pattern do_neg_format() const;
|
| 3113 |
```
|
|
|
|
| 3119 |
- `moneypunct<wchar_t>`,
|
| 3120 |
- `moneypunct<char, true>`, and
|
| 3121 |
- `moneypunct<wchar_t, true>`,
|
| 3122 |
|
| 3123 |
return an object of type `pattern` initialized to
|
| 3124 |
+
`{ symbol, sign, none, value }`.[^24]
|
| 3125 |
|
| 3126 |
+
##### Class template `moneypunct_byname` <a id="locale.moneypunct.byname">[[locale.moneypunct.byname]]</a>
|
| 3127 |
|
| 3128 |
``` cpp
|
| 3129 |
namespace std {
|
| 3130 |
template<class charT, bool Intl = false>
|
| 3131 |
class moneypunct_byname : public moneypunct<charT, Intl> {
|
|
|
|
| 3140 |
~moneypunct_byname();
|
| 3141 |
};
|
| 3142 |
}
|
| 3143 |
```
|
| 3144 |
|
| 3145 |
+
#### The message retrieval category <a id="category.messages">[[category.messages]]</a>
|
| 3146 |
|
| 3147 |
+
##### General <a id="category.messages.general">[[category.messages.general]]</a>
|
| 3148 |
|
| 3149 |
Class `messages<charT>` implements retrieval of strings from message
|
| 3150 |
catalogs.
|
| 3151 |
|
| 3152 |
+
##### Class template `messages` <a id="locale.messages">[[locale.messages]]</a>
|
| 3153 |
|
| 3154 |
+
###### General <a id="locale.messages.general">[[locale.messages.general]]</a>
|
| 3155 |
|
| 3156 |
``` cpp
|
| 3157 |
namespace std {
|
| 3158 |
class messages_base {
|
| 3159 |
public:
|
|
|
|
| 3186 |
```
|
| 3187 |
|
| 3188 |
Values of type `messages_base::catalog` usable as arguments to members
|
| 3189 |
`get` and `close` can be obtained only by calling member `open`.
|
| 3190 |
|
| 3191 |
+
###### Members <a id="locale.messages.members">[[locale.messages.members]]</a>
|
| 3192 |
|
| 3193 |
``` cpp
|
| 3194 |
catalog open(const string& name, const locale& loc) const;
|
| 3195 |
```
|
| 3196 |
|
|
|
|
| 3206 |
void close(catalog cat) const;
|
| 3207 |
```
|
| 3208 |
|
| 3209 |
*Effects:* Calls `do_close(cat)`.
|
| 3210 |
|
| 3211 |
+
###### Virtual functions <a id="locale.messages.virtuals">[[locale.messages.virtuals]]</a>
|
| 3212 |
|
| 3213 |
``` cpp
|
| 3214 |
catalog do_open(const string& name, const locale& loc) const;
|
| 3215 |
```
|
| 3216 |
|
|
|
|
| 3245 |
*Effects:* Releases unspecified resources associated with `cat`.
|
| 3246 |
|
| 3247 |
*Remarks:* The limit on such resources, if any, is
|
| 3248 |
*implementation-defined*.
|
| 3249 |
|
| 3250 |
+
##### Class template `messages_byname` <a id="locale.messages.byname">[[locale.messages.byname]]</a>
|
| 3251 |
|
| 3252 |
``` cpp
|
| 3253 |
namespace std {
|
| 3254 |
template<class charT>
|
| 3255 |
class messages_byname : public messages<charT> {
|
|
|
|
| 3264 |
~messages_byname();
|
| 3265 |
};
|
| 3266 |
}
|
| 3267 |
```
|
| 3268 |
|
| 3269 |
+
### C library locales <a id="c.locales">[[c.locales]]</a>
|
| 3270 |
|
| 3271 |
+
#### Header `<clocale>` synopsis <a id="clocale.syn">[[clocale.syn]]</a>
|
| 3272 |
|
| 3273 |
``` cpp
|
| 3274 |
namespace std {
|
| 3275 |
struct lconv;
|
| 3276 |
|
|
|
|
| 3288 |
```
|
| 3289 |
|
| 3290 |
The contents and meaning of the header `<clocale>` are the same as the C
|
| 3291 |
standard library header `<locale.h>`.
|
| 3292 |
|
| 3293 |
+
#### Data races <a id="clocale.data.races">[[clocale.data.races]]</a>
|
| 3294 |
|
| 3295 |
Calls to the function `setlocale` may introduce a data race
|
| 3296 |
[[res.on.data.races]] with other calls to `setlocale` or with calls to
|
| 3297 |
the functions listed in [[setlocale.data.races]].
|
| 3298 |
|
|
|
|
| 3311 |
| `isdigit` | `iswblank` | `iswupper` | `strerror` | `wcstombs` |
|
| 3312 |
| `isgraph` | `iswcntrl` | `iswxdigit` | `strtod` | `wcsxfrm` |
|
| 3313 |
| `islower` | `iswctype` | `isxdigit` | `strxfrm` | `wctomb` |
|
| 3314 |
|
| 3315 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|