- tmp/tmpe2g4mj4c/{from.md → to.md} +58 -333
tmp/tmpe2g4mj4c/{from.md → to.md}
RENAMED
|
@@ -7,11 +7,11 @@ namespace std {
|
|
| 7 |
class locale {
|
| 8 |
public:
|
| 9 |
// types:
|
| 10 |
class facet;
|
| 11 |
class id;
|
| 12 |
-
|
| 13 |
static const category // values assigned here are for exposition only
|
| 14 |
none = 0,
|
| 15 |
collate = 0x010, ctype = 0x020,
|
| 16 |
monetary = 0x040, numeric = 0x080,
|
| 17 |
time = 0x100, messages = 0x200,
|
|
@@ -53,10 +53,12 @@ it’s just a class interface; at the same time, it’s an index into a
|
|
| 53 |
locale’s set of facets.
|
| 54 |
|
| 55 |
Access to the facets of a `locale` is via two function templates,
|
| 56 |
`use_facet<>` and `has_facet<>`.
|
| 57 |
|
|
|
|
|
|
|
| 58 |
An iostream `operator<<` might be implemented as:[^2]
|
| 59 |
|
| 60 |
``` cpp
|
| 61 |
template <class charT, class traits>
|
| 62 |
basic_ostream<charT, traits>&
|
|
@@ -71,18 +73,22 @@ operator<< (basic_ostream<charT,traits>& s, Date d) {
|
|
| 71 |
}
|
| 72 |
return s;
|
| 73 |
}
|
| 74 |
```
|
| 75 |
|
|
|
|
|
|
|
| 76 |
In the call to `use_facet<Facet>(loc)`, the type argument chooses a
|
| 77 |
facet, making available all members of the named type. If `Facet` is not
|
| 78 |
present in a locale, it throws the standard exception `bad_cast`. A
|
| 79 |
C++program can check if a locale implements a particular facet with the
|
| 80 |
function template `has_facet<Facet>()`. User-defined facets may be
|
| 81 |
installed in a locale, and used identically as may standard facets (
|
| 82 |
[[facets.examples]]).
|
| 83 |
|
|
|
|
|
|
|
| 84 |
All locale semantics are accessed via `use_facet<>` and `has_facet<>`,
|
| 85 |
except that:
|
| 86 |
|
| 87 |
- A member operator template
|
| 88 |
`operator()(const basic_string<C, T, A>&, const basic_string<{}C, T, A>&)`
|
|
@@ -91,10 +97,12 @@ except that:
|
|
| 91 |
- Convenient global interfaces are provided for traditional `ctype`
|
| 92 |
functions such as `isdigit()` and `isspace()`, so that given a locale
|
| 93 |
object `loc` a C++program can call `isspace(c, loc)`. (This eases
|
| 94 |
upgrading existing extractors ([[istream.formatted]]).)
|
| 95 |
|
|
|
|
|
|
|
| 96 |
Once a facet reference is obtained from a locale object by calling
|
| 97 |
`use_facet<>`, that reference remains usable, and the results from
|
| 98 |
member functions of it may be cached and re-used, as long as some locale
|
| 99 |
object refers to that facet.
|
| 100 |
|
|
@@ -117,11 +125,11 @@ implementations are not required to avoid data races on it (
|
|
| 117 |
#### `locale` types <a id="locale.types">[[locale.types]]</a>
|
| 118 |
|
| 119 |
##### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
|
| 120 |
|
| 121 |
``` cpp
|
| 122 |
-
|
| 123 |
```
|
| 124 |
|
| 125 |
*Valid* `category` values include the `locale` member bitmask elements
|
| 126 |
`collate`, `ctype`, `monetary`, `numeric`, `time`, and `messages`, each
|
| 127 |
of which represents a single locale category. In addition, `locale`
|
|
@@ -147,11 +155,11 @@ including at least those shown in Table
|
|
| 147 |
[[tab:localization.category.facets]].
|
| 148 |
|
| 149 |
**Table: Locale category facets** <a id="tab:localization.category.facets">[tab:localization.category.facets]</a>
|
| 150 |
|
| 151 |
| Category | Includes facets |
|
| 152 |
-
| -------- | --------------------------------------------------- |
|
| 153 |
| collate | `collate<char>`, `collate<wchar_t>` |
|
| 154 |
| ctype | `ctype<char>`, `ctype<wchar_t>` |
|
| 155 |
| | `codecvt<char, char, mbstate_t>` |
|
| 156 |
| | `codecvt<char16_t, char, mbstate_t>` |
|
| 157 |
| | `codecvt<char32_t, char, mbstate_t>` |
|
|
@@ -168,22 +176,22 @@ including at least those shown in Table
|
|
| 168 |
| messages | `messages<char>`, `messages<wchar_t>` |
|
| 169 |
|
| 170 |
|
| 171 |
For any locale `loc` either constructed, or returned by
|
| 172 |
`locale::classic()`, and any facet `Facet` shown in Table
|
| 173 |
-
[[tab:localization.category.facets]], `has_facet<Facet>(loc)` is true.
|
| 174 |
Each `locale` member function which takes a `locale::category` argument
|
| 175 |
operates on the corresponding set of facets.
|
| 176 |
|
| 177 |
An implementation is required to provide those specializations for facet
|
| 178 |
templates identified as members of a category, and for those shown in
|
| 179 |
Table [[tab:localization.required.specializations]].
|
| 180 |
|
| 181 |
**Table: Required specializations** <a id="tab:localization.required.specializations">[tab:localization.required.specializations]</a>
|
| 182 |
|
| 183 |
| Category | Includes facets |
|
| 184 |
-
| -------- | ------------------------------------------------------- |
|
| 185 |
| collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
|
| 186 |
| ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
|
| 187 |
| | `codecvt_byname<char, char, mbstate_t>` |
|
| 188 |
| | `codecvt_byname<char16_t, char, mbstate_t>` |
|
| 189 |
| | `codecvt_byname<char32_t, char, mbstate_t>` |
|
|
@@ -215,14 +223,14 @@ In declarations of facets, a template parameter with name
|
|
| 215 |
`InputIterator` or `OutputIterator` indicates the set of all possible
|
| 216 |
specializations on parameters that satisfy the requirements of an Input
|
| 217 |
Iterator or an Output Iterator, respectively (
|
| 218 |
[[iterator.requirements]]). A template parameter with name `C`
|
| 219 |
represents the set of types containing `char`, `wchar_t`, and any other
|
| 220 |
-
implementation-defined character types that satisfy the requirements
|
| 221 |
-
a character on which any of the iostream components can be
|
| 222 |
-
A template parameter with name `International` represents
|
| 223 |
-
possible specializations on a bool parameter.
|
| 224 |
|
| 225 |
##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
|
| 226 |
|
| 227 |
``` cpp
|
| 228 |
namespace std {
|
|
@@ -234,25 +242,32 @@ namespace std {
|
|
| 234 |
void operator=(const facet&) = delete;
|
| 235 |
};
|
| 236 |
}
|
| 237 |
```
|
| 238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
Template parameters in this Clause which are required to be facets are
|
| 240 |
those named `Facet` in declarations. A program that passes a type that
|
| 241 |
is *not* a facet, or a type that refers to a volatile-qualified facet,
|
| 242 |
as an (explicit or deduced) template parameter to a locale function
|
| 243 |
expecting a facet, is ill-formed. A const-qualified facet is a valid
|
| 244 |
template argument to any locale function that expects a Facet template
|
| 245 |
parameter.
|
| 246 |
|
| 247 |
The `refs` argument to the constructor is used for lifetime management.
|
| 248 |
-
|
| 249 |
-
- For `refs == 0`, the implementation performs
|
| 250 |
`delete static_cast<locale::facet*>(f)` (where `f` is a pointer to the
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
facet.
|
| 254 |
|
| 255 |
Constructors of all facets defined in this Clause take such an argument
|
| 256 |
and pass it along to their `facet` base class constructor. All
|
| 257 |
one-argument constructors defined in this Clause are *explicit*,
|
| 258 |
preventing their participation in automatic conversions.
|
|
@@ -280,21 +295,21 @@ namespace std {
|
|
| 280 |
id(const id&) = delete;
|
| 281 |
};
|
| 282 |
}
|
| 283 |
```
|
| 284 |
|
| 285 |
-
The class locale::id provides identification of a locale facet
|
| 286 |
interface, used as an index for lookup and to encapsulate
|
| 287 |
initialization.
|
| 288 |
|
| 289 |
-
Because facets are used by iostreams, potentially while
|
| 290 |
-
constructors are running, their initialization cannot depend on
|
| 291 |
programmed static initialization. One initialization strategy is for
|
| 292 |
`locale` to initialize each facet’s `id` member the first time an
|
| 293 |
instance of the facet is installed into a locale. This depends only on
|
| 294 |
static storage being zero before constructors run (
|
| 295 |
-
[[basic.start.
|
| 296 |
|
| 297 |
#### `locale` constructors and destructor <a id="locale.cons">[[locale.cons]]</a>
|
| 298 |
|
| 299 |
``` cpp
|
| 300 |
locale() noexcept;
|
|
@@ -303,12 +318,15 @@ locale() noexcept;
|
|
| 303 |
Default constructor: a snapshot of the current global locale.
|
| 304 |
|
| 305 |
*Effects:* Constructs a copy of the argument last passed to
|
| 306 |
`locale::global(locale&)`, if it has been called; else, the resulting
|
| 307 |
facets have virtual function semantics identical to those of
|
| 308 |
-
`locale::classic()`.
|
| 309 |
-
|
|
|
|
|
|
|
|
|
|
| 310 |
|
| 311 |
``` cpp
|
| 312 |
locale(const locale& other) noexcept;
|
| 313 |
```
|
| 314 |
|
|
@@ -377,11 +395,11 @@ arguments have names.
|
|
| 377 |
const locale& operator=(const locale& other) noexcept;
|
| 378 |
```
|
| 379 |
|
| 380 |
*Effects:* Creates a copy of `other`, replacing the current value.
|
| 381 |
|
| 382 |
-
*Returns:* `*this`
|
| 383 |
|
| 384 |
``` cpp
|
| 385 |
~locale();
|
| 386 |
```
|
| 387 |
|
|
@@ -396,23 +414,20 @@ template <class Facet> locale combine(const locale& other) const;
|
|
| 396 |
*Effects:* Constructs a locale incorporating all facets from `*this`
|
| 397 |
except for that one facet of `other` that is identified by `Facet`.
|
| 398 |
|
| 399 |
*Returns:* The newly created locale.
|
| 400 |
|
| 401 |
-
*Throws:* `runtime_error` if `has_facet<Facet>(other)` is false.
|
| 402 |
|
| 403 |
*Remarks:* The resulting locale has no name.
|
| 404 |
|
| 405 |
``` cpp
|
| 406 |
basic_string<char> name() const;
|
| 407 |
```
|
| 408 |
|
| 409 |
*Returns:* The name of `*this`, if it has one; otherwise, the string
|
| 410 |
-
`"*"`.
|
| 411 |
-
`locale(name().c`\textunderscore`str())` is equivalent to `*this`.
|
| 412 |
-
Details of the contents of the resulting string are otherwise
|
| 413 |
-
implementation-defined.
|
| 414 |
|
| 415 |
#### `locale` operators <a id="locale.operators">[[locale.operators]]</a>
|
| 416 |
|
| 417 |
``` cpp
|
| 418 |
bool operator==(const locale& other) const;
|
|
@@ -424,11 +439,11 @@ copy of the other, or each has a name and the names are identical;
|
|
| 424 |
|
| 425 |
``` cpp
|
| 426 |
bool operator!=(const locale& other) const;
|
| 427 |
```
|
| 428 |
|
| 429 |
-
*Returns:*
|
| 430 |
|
| 431 |
``` cpp
|
| 432 |
template <class charT, class traits, class Allocator>
|
| 433 |
bool operator()(const basic_string<charT, traits, Allocator>& s1,
|
| 434 |
const basic_string<charT, traits, Allocator>& s2) const;
|
|
@@ -438,24 +453,28 @@ template <class charT, class traits, class Allocator>
|
|
| 438 |
|
| 439 |
*Remarks:* This member operator template (and therefore `locale` itself)
|
| 440 |
satisfies requirements for a comparator predicate template argument
|
| 441 |
(Clause [[algorithms]]) applied to strings.
|
| 442 |
|
| 443 |
-
*Returns:*
|
| 444 |
|
| 445 |
``` cpp
|
| 446 |
-
use_facet<
|
| 447 |
-
|
| 448 |
```
|
| 449 |
|
|
|
|
|
|
|
| 450 |
A vector of strings `v` can be collated according to collation rules in
|
| 451 |
locale `loc` simply by ([[alg.sort]], [[vector]]):
|
| 452 |
|
| 453 |
``` cpp
|
| 454 |
std::sort(v.begin(), v.end(), loc);
|
| 455 |
```
|
| 456 |
|
|
|
|
|
|
|
| 457 |
#### `locale` static members <a id="locale.statics">[[locale.statics]]</a>
|
| 458 |
|
| 459 |
``` cpp
|
| 460 |
static locale global(const locale& loc);
|
| 461 |
```
|
|
@@ -464,18 +483,19 @@ Sets the global locale to its argument.
|
|
| 464 |
|
| 465 |
*Effects:* Causes future calls to the constructor `locale()` to return a
|
| 466 |
copy of the argument. If the argument has a name, does
|
| 467 |
|
| 468 |
``` cpp
|
| 469 |
-
|
| 470 |
```
|
| 471 |
|
| 472 |
otherwise, the effect on the C locale, if any, is
|
| 473 |
*implementation-defined*. No library function other than
|
| 474 |
`locale::global()` shall affect the value returned by `locale()`.
|
| 475 |
-
|
| 476 |
-
|
|
|
|
| 477 |
|
| 478 |
*Returns:* The previous value of `locale()`.
|
| 479 |
|
| 480 |
``` cpp
|
| 481 |
static const locale& classic();
|
|
@@ -507,12 +527,12 @@ copy of `loc` exists.
|
|
| 507 |
|
| 508 |
``` cpp
|
| 509 |
template <class Facet> bool has_facet(const locale& loc) noexcept;
|
| 510 |
```
|
| 511 |
|
| 512 |
-
*Returns:*
|
| 513 |
-
false.
|
| 514 |
|
| 515 |
### Convenience interfaces <a id="locale.convenience">[[locale.convenience]]</a>
|
| 516 |
|
| 517 |
#### Character classification <a id="classification">[[classification]]</a>
|
| 518 |
|
|
@@ -529,19 +549,18 @@ template <class charT> bool isxdigit(charT c, const locale& loc);
|
|
| 529 |
template <class charT> bool isalnum (charT c, const locale& loc);
|
| 530 |
template <class charT> bool isgraph (charT c, const locale& loc);
|
| 531 |
template <class charT> bool isblank (charT c, const locale& loc);
|
| 532 |
```
|
| 533 |
|
| 534 |
-
Each of these functions `
|
| 535 |
-
expression:
|
| 536 |
|
| 537 |
``` cpp
|
| 538 |
use_facet<ctype<charT>>(loc).is(ctype_base::F, c)
|
| 539 |
```
|
| 540 |
|
| 541 |
-
where
|
| 542 |
-
function ([[category.ctype]]).[^
|
| 543 |
|
| 544 |
#### Conversions <a id="conversions">[[conversions]]</a>
|
| 545 |
|
| 546 |
##### Character conversions <a id="conversions.character">[[conversions.character]]</a>
|
| 547 |
|
|
@@ -555,299 +574,5 @@ template <class charT> charT toupper(charT c, const locale& loc);
|
|
| 555 |
template <class charT> charT tolower(charT c, const locale& loc);
|
| 556 |
```
|
| 557 |
|
| 558 |
*Returns:* `use_facet<ctype<charT>>(loc).tolower(c)`.
|
| 559 |
|
| 560 |
-
##### `string` conversions <a id="conversions.string">[[conversions.string]]</a>
|
| 561 |
-
|
| 562 |
-
Class template `wstring_convert` performs conversions between a wide
|
| 563 |
-
string and a byte string. It lets you specify a code conversion facet
|
| 564 |
-
(like class template `codecvt`) to perform the conversions, without
|
| 565 |
-
affecting any streams or locales. If you want to use the code conversion
|
| 566 |
-
facet `codecvt_utf8` to output to `cout` a UTF-8 multibyte sequence
|
| 567 |
-
corresponding to a wide string, but you don’t want to alter the locale
|
| 568 |
-
for `cout`, you can write something like:
|
| 569 |
-
|
| 570 |
-
``` cpp
|
| 571 |
-
wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
|
| 572 |
-
std::string mbstring = myconv.to_bytes(L"Hello\n");
|
| 573 |
-
std::cout << mbstring;
|
| 574 |
-
```
|
| 575 |
-
|
| 576 |
-
``` cpp
|
| 577 |
-
namespace std {
|
| 578 |
-
template<class Codecvt, class Elem = wchar_t,
|
| 579 |
-
class Wide_alloc = std::allocator<Elem>,
|
| 580 |
-
class Byte_alloc = std::allocator<char> > class wstring_convert {
|
| 581 |
-
public:
|
| 582 |
-
typedef std::basic_string<char, char_traits<char>, Byte_alloc> byte_string;
|
| 583 |
-
typedef std::basic_string<Elem, char_traits<Elem>, Wide_alloc> wide_string;
|
| 584 |
-
typedef typename Codecvt::state_type state_type;
|
| 585 |
-
typedef typename wide_string::traits_type::int_type int_type;
|
| 586 |
-
|
| 587 |
-
explicit wstring_convert(Codecvt* pcvt = new Codecvt);
|
| 588 |
-
wstring_convert(Codecvt* pcvt, state_type state);
|
| 589 |
-
explicit wstring_convert(const byte_string& byte_err,
|
| 590 |
-
const wide_string& wide_err = wide_string());
|
| 591 |
-
~wstring_convert();
|
| 592 |
-
|
| 593 |
-
wstring_convert(const wstring_convert&) = delete;
|
| 594 |
-
wstring_convert& operator=(const wstring_convert&) = delete;
|
| 595 |
-
|
| 596 |
-
wide_string from_bytes(char byte);
|
| 597 |
-
wide_string from_bytes(const char* ptr);
|
| 598 |
-
wide_string from_bytes(const byte_string& str);
|
| 599 |
-
wide_string from_bytes(const char* first, const char* last);
|
| 600 |
-
|
| 601 |
-
byte_string to_bytes(Elem wchar);
|
| 602 |
-
byte_string to_bytes(const Elem* wptr);
|
| 603 |
-
byte_string to_bytes(const wide_string& wstr);
|
| 604 |
-
byte_string to_bytes(const Elem* first, const Elem* last);
|
| 605 |
-
|
| 606 |
-
size_t converted() const noexcept;
|
| 607 |
-
state_type state() const;
|
| 608 |
-
private:
|
| 609 |
-
byte_string byte_err_string; // exposition only
|
| 610 |
-
wide_string wide_err_string; // exposition only
|
| 611 |
-
Codecvt* cvtptr; // exposition only
|
| 612 |
-
state_type cvtstate; // exposition only
|
| 613 |
-
size_t cvtcount; // exposition only
|
| 614 |
-
};
|
| 615 |
-
}
|
| 616 |
-
```
|
| 617 |
-
|
| 618 |
-
The class template describes an object that controls conversions between
|
| 619 |
-
wide string objects of class `std::basic_string<Elem, char_traits<Elem>,
|
| 620 |
-
Wide_alloc>` and byte string objects of class `std::\\basic_string<char,
|
| 621 |
-
char_traits<char>, Byte_alloc>`. The class template defines the types
|
| 622 |
-
`wide_string` and `byte_string` as synonyms for these two types.
|
| 623 |
-
Conversion between a sequence of `Elem` values (stored in a
|
| 624 |
-
`wide_string` object) and multibyte sequences (stored in a `byte_string`
|
| 625 |
-
object) is performed by an object of class `Codecvt`, which meets the
|
| 626 |
-
requirements of the standard code-conversion facet `std::codecvt<Elem,
|
| 627 |
-
char, std::mbstate_t>`.
|
| 628 |
-
|
| 629 |
-
An object of this class template stores:
|
| 630 |
-
|
| 631 |
-
- `byte_err_string` — a byte string to display on errors
|
| 632 |
-
- `wide_err_string` — a wide string to display on errors
|
| 633 |
-
- `cvtptr` — a pointer to the allocated conversion object (which is
|
| 634 |
-
freed when the `wstring_convert` object is destroyed)
|
| 635 |
-
- `cvtstate` — a conversion state object
|
| 636 |
-
- `cvtcount` — a conversion count
|
| 637 |
-
|
| 638 |
-
``` cpp
|
| 639 |
-
typedef std::basic_string<char, char_traits<char>, Byte_alloc> byte_string;
|
| 640 |
-
```
|
| 641 |
-
|
| 642 |
-
The type shall be a synonym for
|
| 643 |
-
`std::basic_string<char, char_traits<char>, Byte_alloc>`
|
| 644 |
-
|
| 645 |
-
``` cpp
|
| 646 |
-
size_t converted() const noexcept;
|
| 647 |
-
```
|
| 648 |
-
|
| 649 |
-
*Returns:* `cvtcount`.
|
| 650 |
-
|
| 651 |
-
``` cpp
|
| 652 |
-
wide_string from_bytes(char byte);
|
| 653 |
-
wide_string from_bytes(const char* ptr);
|
| 654 |
-
wide_string from_bytes(const byte_string& str);
|
| 655 |
-
wide_string from_bytes(const char* first, const char* last);
|
| 656 |
-
```
|
| 657 |
-
|
| 658 |
-
*Effects:* The first member function shall convert the single-element
|
| 659 |
-
sequence `byte` to a wide string. The second member function shall
|
| 660 |
-
convert the null-terminated sequence beginning at `ptr` to a wide
|
| 661 |
-
string. The third member function shall convert the sequence stored in
|
| 662 |
-
`str` to a wide string. The fourth member function shall convert the
|
| 663 |
-
sequence defined by the range \[`first`, `last`) to a wide string.
|
| 664 |
-
|
| 665 |
-
In all cases:
|
| 666 |
-
|
| 667 |
-
- If the `cvtstate` object was not constructed with an explicit value,
|
| 668 |
-
it shall be set to its default value (the initial conversion state)
|
| 669 |
-
before the conversion begins. Otherwise it shall be left unchanged.
|
| 670 |
-
- The number of input elements successfully converted shall be stored in
|
| 671 |
-
`cvtcount`.
|
| 672 |
-
|
| 673 |
-
*Returns:* If no conversion error occurs, the member function shall
|
| 674 |
-
return the converted wide string. Otherwise, if the object was
|
| 675 |
-
constructed with a wide-error string, the member function shall return
|
| 676 |
-
the wide-error string. Otherwise, the member function throws an object
|
| 677 |
-
of class `std::range_error`.
|
| 678 |
-
|
| 679 |
-
``` cpp
|
| 680 |
-
typedef typename wide_string::traits_type::int_type int_type;
|
| 681 |
-
```
|
| 682 |
-
|
| 683 |
-
The type shall be a synonym for `wide_string::traits_type::int_type`.
|
| 684 |
-
|
| 685 |
-
``` cpp
|
| 686 |
-
state_type state() const;
|
| 687 |
-
```
|
| 688 |
-
|
| 689 |
-
returns `cvtstate`.
|
| 690 |
-
|
| 691 |
-
``` cpp
|
| 692 |
-
typedef typename Codecvt::state_type state_type;
|
| 693 |
-
```
|
| 694 |
-
|
| 695 |
-
The type shall be a synonym for `Codecvt::state_type`.
|
| 696 |
-
|
| 697 |
-
``` cpp
|
| 698 |
-
byte_string to_bytes(Elem wchar);
|
| 699 |
-
byte_string to_bytes(const Elem* wptr);
|
| 700 |
-
byte_string to_bytes(const wide_string& wstr);
|
| 701 |
-
byte_string to_bytes(const Elem* first, const Elem* last);
|
| 702 |
-
```
|
| 703 |
-
|
| 704 |
-
*Effects:* The first member function shall convert the single-element
|
| 705 |
-
sequence `wchar` to a byte string. The second member function shall
|
| 706 |
-
convert the null-terminated sequence beginning at `wptr` to a byte
|
| 707 |
-
string. The third member function shall convert the sequence stored in
|
| 708 |
-
`wstr` to a byte string. The fourth member function shall convert the
|
| 709 |
-
sequence defined by the range \[`first`, `last`) to a byte string.
|
| 710 |
-
|
| 711 |
-
In all cases:
|
| 712 |
-
|
| 713 |
-
- If the `cvtstate` object was not constructed with an explicit value,
|
| 714 |
-
it shall be set to its default value (the initial conversion state)
|
| 715 |
-
before the conversion begins. Otherwise it shall be left unchanged.
|
| 716 |
-
- The number of input elements successfully converted shall be stored in
|
| 717 |
-
`cvtcount`.
|
| 718 |
-
|
| 719 |
-
*Returns:* If no conversion error occurs, the member function shall
|
| 720 |
-
return the converted byte string. Otherwise, if the object was
|
| 721 |
-
constructed with a byte-error string, the member function shall return
|
| 722 |
-
the byte-error string. Otherwise, the member function shall throw an
|
| 723 |
-
object of class `std::range_error`.
|
| 724 |
-
|
| 725 |
-
``` cpp
|
| 726 |
-
typedef std::basic_string<Elem, char_traits<Elem>, Wide_alloc> wide_string;
|
| 727 |
-
```
|
| 728 |
-
|
| 729 |
-
The type shall be a synonym for
|
| 730 |
-
`std::basic_string<Elem, char_traits<Elem>, Wide_alloc>`.
|
| 731 |
-
|
| 732 |
-
``` cpp
|
| 733 |
-
explicit wstring_convert(Codecvt* pcvt = new Codecvt);
|
| 734 |
-
wstring_convert(Codecvt* pcvt, state_type state);
|
| 735 |
-
explicit wstring_convert(const byte_string& byte_err,
|
| 736 |
-
const wide_string& wide_err = wide_string());
|
| 737 |
-
```
|
| 738 |
-
|
| 739 |
-
*Requires:* For the first and second constructors, `pcvt != nullptr`.
|
| 740 |
-
|
| 741 |
-
*Effects:* The first constructor shall store `pcvt` in `cvtptr` and
|
| 742 |
-
default values in `cvtstate`, `byte_err_string`, and `wide_err_string`.
|
| 743 |
-
The second constructor shall store `pcvt` in `cvtptr`, `state` in
|
| 744 |
-
`cvtstate`, and default values in `byte_err_string` and
|
| 745 |
-
`wide_err_string`; moreover the stored state shall be retained between
|
| 746 |
-
calls to `from_bytes` and `to_bytes`. The third constructor shall store
|
| 747 |
-
`new Codecvt` in `cvtptr`, `state_type()` in `cvtstate`, `byte_err` in
|
| 748 |
-
`byte_err_string`, and `wide_err` in `wide_err_string`.
|
| 749 |
-
|
| 750 |
-
``` cpp
|
| 751 |
-
~wstring_convert();
|
| 752 |
-
```
|
| 753 |
-
|
| 754 |
-
*Effects:* The destructor shall delete `cvtptr`.
|
| 755 |
-
|
| 756 |
-
##### Buffer conversions <a id="conversions.buffer">[[conversions.buffer]]</a>
|
| 757 |
-
|
| 758 |
-
Class template `wbuffer_convert` looks like a wide stream buffer, but
|
| 759 |
-
performs all its I/O through an underlying byte stream buffer that you
|
| 760 |
-
specify when you construct it. Like class template `wstring_convert`, it
|
| 761 |
-
lets you specify a code conversion facet to perform the conversions,
|
| 762 |
-
without affecting any streams or locales.
|
| 763 |
-
|
| 764 |
-
``` cpp
|
| 765 |
-
namespace std {
|
| 766 |
-
template<class Codecvt,
|
| 767 |
-
class Elem = wchar_t,
|
| 768 |
-
class Tr = std::char_traits<Elem> >
|
| 769 |
-
class wbuffer_convert
|
| 770 |
-
: public std::basic_streambuf<Elem, Tr> {
|
| 771 |
-
public:
|
| 772 |
-
typedef typename Codecvt::state_type state_type;
|
| 773 |
-
|
| 774 |
-
explicit wbuffer_convert(std::streambuf* bytebuf = 0,
|
| 775 |
-
Codecvt* pcvt = new Codecvt,
|
| 776 |
-
state_type state = state_type());
|
| 777 |
-
|
| 778 |
-
~wbuffer_convert();
|
| 779 |
-
|
| 780 |
-
wbuffer_convert(const wbuffer_convert&) = delete;
|
| 781 |
-
wbuffer_convert& operator=(const wbuffer_convert&) = delete;
|
| 782 |
-
|
| 783 |
-
std::streambuf* rdbuf() const;
|
| 784 |
-
std::streambuf* rdbuf(std::streambuf* bytebuf);
|
| 785 |
-
|
| 786 |
-
state_type state() const;
|
| 787 |
-
|
| 788 |
-
private:
|
| 789 |
-
std::streambuf* bufptr; // exposition only
|
| 790 |
-
Codecvt* cvtptr; // exposition only
|
| 791 |
-
state_type cvtstate; // exposition only
|
| 792 |
-
};
|
| 793 |
-
}
|
| 794 |
-
```
|
| 795 |
-
|
| 796 |
-
The class template describes a stream buffer that controls the
|
| 797 |
-
transmission of elements of type `Elem`, whose character traits are
|
| 798 |
-
described by the class `Tr`, to and from a byte stream buffer of type
|
| 799 |
-
`std::streambuf`. Conversion between a sequence of `Elem` values and
|
| 800 |
-
multibyte sequences is performed by an object of class `Codecvt`, which
|
| 801 |
-
shall meet the requirements of the standard code-conversion facet
|
| 802 |
-
`std::codecvt<Elem, char, std::mbstate_t>`.
|
| 803 |
-
|
| 804 |
-
An object of this class template stores:
|
| 805 |
-
|
| 806 |
-
- `bufptr` — a pointer to its underlying byte stream buffer
|
| 807 |
-
- `cvtptr` — a pointer to the allocated conversion object (which is
|
| 808 |
-
freed when the `wbuffer_convert` object is destroyed)
|
| 809 |
-
- `cvtstate` — a conversion state object
|
| 810 |
-
|
| 811 |
-
``` cpp
|
| 812 |
-
state_type state() const;
|
| 813 |
-
```
|
| 814 |
-
|
| 815 |
-
*Returns:* `cvtstate`.
|
| 816 |
-
|
| 817 |
-
``` cpp
|
| 818 |
-
std::streambuf* rdbuf() const;
|
| 819 |
-
```
|
| 820 |
-
|
| 821 |
-
*Returns:* `bufptr`.
|
| 822 |
-
|
| 823 |
-
``` cpp
|
| 824 |
-
std::streambuf* rdbuf(std::streambuf* bytebuf);
|
| 825 |
-
```
|
| 826 |
-
|
| 827 |
-
*Effects:* stores `bytebuf` in `bufptr`.
|
| 828 |
-
|
| 829 |
-
*Returns:* The previous value of `bufptr`.
|
| 830 |
-
|
| 831 |
-
``` cpp
|
| 832 |
-
typedef typename Codecvt::state_type state_type;
|
| 833 |
-
```
|
| 834 |
-
|
| 835 |
-
The type shall be a synonym for `Codecvt::state_type`.
|
| 836 |
-
|
| 837 |
-
``` cpp
|
| 838 |
-
explicit wbuffer_convert(std::streambuf* bytebuf = 0,
|
| 839 |
-
Codecvt* pcvt = new Codecvt, state_type state = state_type());
|
| 840 |
-
```
|
| 841 |
-
|
| 842 |
-
*Requires:* `pcvt != nullptr`.
|
| 843 |
-
|
| 844 |
-
*Effects:* The constructor constructs a stream buffer object,
|
| 845 |
-
initializes `bufptr` to `bytebuf`, initializes `cvtptr` to `pcvt`, and
|
| 846 |
-
initializes `cvtstate` to `state`.
|
| 847 |
-
|
| 848 |
-
``` cpp
|
| 849 |
-
~wbuffer_convert();
|
| 850 |
-
```
|
| 851 |
-
|
| 852 |
-
*Effects:* The destructor shall delete `cvtptr`.
|
| 853 |
-
|
|
|
|
| 7 |
class locale {
|
| 8 |
public:
|
| 9 |
// types:
|
| 10 |
class facet;
|
| 11 |
class id;
|
| 12 |
+
using category = int;
|
| 13 |
static const category // values assigned here are for exposition only
|
| 14 |
none = 0,
|
| 15 |
collate = 0x010, ctype = 0x020,
|
| 16 |
monetary = 0x040, numeric = 0x080,
|
| 17 |
time = 0x100, messages = 0x200,
|
|
|
|
| 53 |
locale’s set of facets.
|
| 54 |
|
| 55 |
Access to the facets of a `locale` is via two function templates,
|
| 56 |
`use_facet<>` and `has_facet<>`.
|
| 57 |
|
| 58 |
+
[*Example 1*:
|
| 59 |
+
|
| 60 |
An iostream `operator<<` might be implemented as:[^2]
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
template <class charT, class traits>
|
| 64 |
basic_ostream<charT, traits>&
|
|
|
|
| 73 |
}
|
| 74 |
return s;
|
| 75 |
}
|
| 76 |
```
|
| 77 |
|
| 78 |
+
— *end example*]
|
| 79 |
+
|
| 80 |
In the call to `use_facet<Facet>(loc)`, the type argument chooses a
|
| 81 |
facet, making available all members of the named type. If `Facet` is not
|
| 82 |
present in a locale, it throws the standard exception `bad_cast`. A
|
| 83 |
C++program can check if a locale implements a particular facet with the
|
| 84 |
function template `has_facet<Facet>()`. User-defined facets may be
|
| 85 |
installed in a locale, and used identically as may standard facets (
|
| 86 |
[[facets.examples]]).
|
| 87 |
|
| 88 |
+
[*Note 1*:
|
| 89 |
+
|
| 90 |
All locale semantics are accessed via `use_facet<>` and `has_facet<>`,
|
| 91 |
except that:
|
| 92 |
|
| 93 |
- A member operator template
|
| 94 |
`operator()(const basic_string<C, T, A>&, const basic_string<{}C, T, A>&)`
|
|
|
|
| 97 |
- Convenient global interfaces are provided for traditional `ctype`
|
| 98 |
functions such as `isdigit()` and `isspace()`, so that given a locale
|
| 99 |
object `loc` a C++program can call `isspace(c, loc)`. (This eases
|
| 100 |
upgrading existing extractors ([[istream.formatted]]).)
|
| 101 |
|
| 102 |
+
— *end note*]
|
| 103 |
+
|
| 104 |
Once a facet reference is obtained from a locale object by calling
|
| 105 |
`use_facet<>`, that reference remains usable, and the results from
|
| 106 |
member functions of it may be cached and re-used, as long as some locale
|
| 107 |
object refers to that facet.
|
| 108 |
|
|
|
|
| 125 |
#### `locale` types <a id="locale.types">[[locale.types]]</a>
|
| 126 |
|
| 127 |
##### Type `locale::category` <a id="locale.category">[[locale.category]]</a>
|
| 128 |
|
| 129 |
``` cpp
|
| 130 |
+
using category = int;
|
| 131 |
```
|
| 132 |
|
| 133 |
*Valid* `category` values include the `locale` member bitmask elements
|
| 134 |
`collate`, `ctype`, `monetary`, `numeric`, `time`, and `messages`, each
|
| 135 |
of which represents a single locale category. In addition, `locale`
|
|
|
|
| 155 |
[[tab:localization.category.facets]].
|
| 156 |
|
| 157 |
**Table: Locale category facets** <a id="tab:localization.category.facets">[tab:localization.category.facets]</a>
|
| 158 |
|
| 159 |
| Category | Includes facets |
|
| 160 |
+
| -------- | ----------------------------------------------------- |
|
| 161 |
| collate | `collate<char>`, `collate<wchar_t>` |
|
| 162 |
| ctype | `ctype<char>`, `ctype<wchar_t>` |
|
| 163 |
| | `codecvt<char, char, mbstate_t>` |
|
| 164 |
| | `codecvt<char16_t, char, mbstate_t>` |
|
| 165 |
| | `codecvt<char32_t, char, mbstate_t>` |
|
|
|
|
| 176 |
| messages | `messages<char>`, `messages<wchar_t>` |
|
| 177 |
|
| 178 |
|
| 179 |
For any locale `loc` either constructed, or returned by
|
| 180 |
`locale::classic()`, and any facet `Facet` shown in Table
|
| 181 |
+
[[tab:localization.category.facets]], `has_facet<Facet>(loc)` is `true`.
|
| 182 |
Each `locale` member function which takes a `locale::category` argument
|
| 183 |
operates on the corresponding set of facets.
|
| 184 |
|
| 185 |
An implementation is required to provide those specializations for facet
|
| 186 |
templates identified as members of a category, and for those shown in
|
| 187 |
Table [[tab:localization.required.specializations]].
|
| 188 |
|
| 189 |
**Table: Required specializations** <a id="tab:localization.required.specializations">[tab:localization.required.specializations]</a>
|
| 190 |
|
| 191 |
| Category | Includes facets |
|
| 192 |
+
| -------- | --------------------------------------------------------- |
|
| 193 |
| collate | `collate_byname<char>`, `collate_byname<wchar_t>` |
|
| 194 |
| ctype | `ctype_byname<char>`, `ctype_byname<wchar_t>` |
|
| 195 |
| | `codecvt_byname<char, char, mbstate_t>` |
|
| 196 |
| | `codecvt_byname<char16_t, char, mbstate_t>` |
|
| 197 |
| | `codecvt_byname<char32_t, char, mbstate_t>` |
|
|
|
|
| 223 |
`InputIterator` or `OutputIterator` indicates the set of all possible
|
| 224 |
specializations on parameters that satisfy the requirements of an Input
|
| 225 |
Iterator or an Output Iterator, respectively (
|
| 226 |
[[iterator.requirements]]). A template parameter with name `C`
|
| 227 |
represents the set of types containing `char`, `wchar_t`, and any other
|
| 228 |
+
*implementation-defined* character types that satisfy the requirements
|
| 229 |
+
for a character on which any of the iostream components can be
|
| 230 |
+
instantiated. A template parameter with name `International` represents
|
| 231 |
+
the set of all possible specializations on a bool parameter.
|
| 232 |
|
| 233 |
##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
|
| 234 |
|
| 235 |
``` cpp
|
| 236 |
namespace std {
|
|
|
|
| 242 |
void operator=(const facet&) = delete;
|
| 243 |
};
|
| 244 |
}
|
| 245 |
```
|
| 246 |
|
| 247 |
+
Class `facet` is the base class for locale feature sets. A class is a
|
| 248 |
+
*facet* if it is publicly derived from another facet, or if it is a
|
| 249 |
+
class derived from `locale::facet` and contains a publicly accessible
|
| 250 |
+
declaration as follows: [^3]
|
| 251 |
+
|
| 252 |
+
``` cpp
|
| 253 |
+
static ::std::locale::id id;
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
Template parameters in this Clause which are required to be facets are
|
| 257 |
those named `Facet` in declarations. A program that passes a type that
|
| 258 |
is *not* a facet, or a type that refers to a volatile-qualified facet,
|
| 259 |
as an (explicit or deduced) template parameter to a locale function
|
| 260 |
expecting a facet, is ill-formed. A const-qualified facet is a valid
|
| 261 |
template argument to any locale function that expects a Facet template
|
| 262 |
parameter.
|
| 263 |
|
| 264 |
The `refs` argument to the constructor is used for lifetime management.
|
| 265 |
+
For `refs == 0`, the implementation performs
|
|
|
|
| 266 |
`delete static_cast<locale::facet*>(f)` (where `f` is a pointer to the
|
| 267 |
+
facet) when the last `locale` object containing the facet is destroyed;
|
| 268 |
+
for `refs == 1`, the implementation never destroys the facet.
|
|
|
|
| 269 |
|
| 270 |
Constructors of all facets defined in this Clause take such an argument
|
| 271 |
and pass it along to their `facet` base class constructor. All
|
| 272 |
one-argument constructors defined in this Clause are *explicit*,
|
| 273 |
preventing their participation in automatic conversions.
|
|
|
|
| 295 |
id(const id&) = delete;
|
| 296 |
};
|
| 297 |
}
|
| 298 |
```
|
| 299 |
|
| 300 |
+
The class `locale::id` provides identification of a locale facet
|
| 301 |
interface, used as an index for lookup and to encapsulate
|
| 302 |
initialization.
|
| 303 |
|
| 304 |
+
[*Note 1*: Because facets are used by iostreams, potentially while
|
| 305 |
+
static constructors are running, their initialization cannot depend on
|
| 306 |
programmed static initialization. One initialization strategy is for
|
| 307 |
`locale` to initialize each facet’s `id` member the first time an
|
| 308 |
instance of the facet is installed into a locale. This depends only on
|
| 309 |
static storage being zero before constructors run (
|
| 310 |
+
[[basic.start.static]]). — *end note*]
|
| 311 |
|
| 312 |
#### `locale` constructors and destructor <a id="locale.cons">[[locale.cons]]</a>
|
| 313 |
|
| 314 |
``` cpp
|
| 315 |
locale() noexcept;
|
|
|
|
| 318 |
Default constructor: a snapshot of the current global locale.
|
| 319 |
|
| 320 |
*Effects:* Constructs a copy of the argument last passed to
|
| 321 |
`locale::global(locale&)`, if it has been called; else, the resulting
|
| 322 |
facets have virtual function semantics identical to those of
|
| 323 |
+
`locale::classic()`.
|
| 324 |
+
|
| 325 |
+
[*Note 1*: This constructor is commonly used as the default value for
|
| 326 |
+
arguments of functions that take a `const locale&`
|
| 327 |
+
argument. — *end note*]
|
| 328 |
|
| 329 |
``` cpp
|
| 330 |
locale(const locale& other) noexcept;
|
| 331 |
```
|
| 332 |
|
|
|
|
| 395 |
const locale& operator=(const locale& other) noexcept;
|
| 396 |
```
|
| 397 |
|
| 398 |
*Effects:* Creates a copy of `other`, replacing the current value.
|
| 399 |
|
| 400 |
+
*Returns:* `*this`.
|
| 401 |
|
| 402 |
``` cpp
|
| 403 |
~locale();
|
| 404 |
```
|
| 405 |
|
|
|
|
| 414 |
*Effects:* Constructs a locale incorporating all facets from `*this`
|
| 415 |
except for that one facet of `other` that is identified by `Facet`.
|
| 416 |
|
| 417 |
*Returns:* The newly created locale.
|
| 418 |
|
| 419 |
+
*Throws:* `runtime_error` if `has_facet<Facet>(other)` is `false`.
|
| 420 |
|
| 421 |
*Remarks:* The resulting locale has no name.
|
| 422 |
|
| 423 |
``` cpp
|
| 424 |
basic_string<char> name() const;
|
| 425 |
```
|
| 426 |
|
| 427 |
*Returns:* The name of `*this`, if it has one; otherwise, the string
|
| 428 |
+
`"*"`.
|
|
|
|
|
|
|
|
|
|
| 429 |
|
| 430 |
#### `locale` operators <a id="locale.operators">[[locale.operators]]</a>
|
| 431 |
|
| 432 |
``` cpp
|
| 433 |
bool operator==(const locale& other) const;
|
|
|
|
| 439 |
|
| 440 |
``` cpp
|
| 441 |
bool operator!=(const locale& other) const;
|
| 442 |
```
|
| 443 |
|
| 444 |
+
*Returns:* `!(*this == other)`.
|
| 445 |
|
| 446 |
``` cpp
|
| 447 |
template <class charT, class traits, class Allocator>
|
| 448 |
bool operator()(const basic_string<charT, traits, Allocator>& s1,
|
| 449 |
const basic_string<charT, traits, Allocator>& s2) const;
|
|
|
|
| 453 |
|
| 454 |
*Remarks:* This member operator template (and therefore `locale` itself)
|
| 455 |
satisfies requirements for a comparator predicate template argument
|
| 456 |
(Clause [[algorithms]]) applied to strings.
|
| 457 |
|
| 458 |
+
*Returns:*
|
| 459 |
|
| 460 |
``` cpp
|
| 461 |
+
use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
|
| 462 |
+
s2.data(), s2.data() + s2.size()) < 0
|
| 463 |
```
|
| 464 |
|
| 465 |
+
[*Example 1*:
|
| 466 |
+
|
| 467 |
A vector of strings `v` can be collated according to collation rules in
|
| 468 |
locale `loc` simply by ([[alg.sort]], [[vector]]):
|
| 469 |
|
| 470 |
``` cpp
|
| 471 |
std::sort(v.begin(), v.end(), loc);
|
| 472 |
```
|
| 473 |
|
| 474 |
+
— *end example*]
|
| 475 |
+
|
| 476 |
#### `locale` static members <a id="locale.statics">[[locale.statics]]</a>
|
| 477 |
|
| 478 |
``` cpp
|
| 479 |
static locale global(const locale& loc);
|
| 480 |
```
|
|
|
|
| 483 |
|
| 484 |
*Effects:* Causes future calls to the constructor `locale()` to return a
|
| 485 |
copy of the argument. If the argument has a name, does
|
| 486 |
|
| 487 |
``` cpp
|
| 488 |
+
setlocale(LC_ALL, loc.name().c_str());
|
| 489 |
```
|
| 490 |
|
| 491 |
otherwise, the effect on the C locale, if any, is
|
| 492 |
*implementation-defined*. No library function other than
|
| 493 |
`locale::global()` shall affect the value returned by `locale()`.
|
| 494 |
+
|
| 495 |
+
[*Note 1*: See [[c.locales]] for data race considerations when
|
| 496 |
+
`setlocale` is invoked. — *end note*]
|
| 497 |
|
| 498 |
*Returns:* The previous value of `locale()`.
|
| 499 |
|
| 500 |
``` cpp
|
| 501 |
static const locale& classic();
|
|
|
|
| 527 |
|
| 528 |
``` cpp
|
| 529 |
template <class Facet> bool has_facet(const locale& loc) noexcept;
|
| 530 |
```
|
| 531 |
|
| 532 |
+
*Returns:* `true` if the facet requested is present in `loc`; otherwise
|
| 533 |
+
`false`.
|
| 534 |
|
| 535 |
### Convenience interfaces <a id="locale.convenience">[[locale.convenience]]</a>
|
| 536 |
|
| 537 |
#### Character classification <a id="classification">[[classification]]</a>
|
| 538 |
|
|
|
|
| 549 |
template <class charT> bool isalnum (charT c, const locale& loc);
|
| 550 |
template <class charT> bool isgraph (charT c, const locale& loc);
|
| 551 |
template <class charT> bool isblank (charT c, const locale& loc);
|
| 552 |
```
|
| 553 |
|
| 554 |
+
Each of these functions `isF` returns the result of the expression:
|
|
|
|
| 555 |
|
| 556 |
``` cpp
|
| 557 |
use_facet<ctype<charT>>(loc).is(ctype_base::F, c)
|
| 558 |
```
|
| 559 |
|
| 560 |
+
where `F` is the `ctype_base::mask` value corresponding to that
|
| 561 |
+
function ([[category.ctype]]).[^4]
|
| 562 |
|
| 563 |
#### Conversions <a id="conversions">[[conversions]]</a>
|
| 564 |
|
| 565 |
##### Character conversions <a id="conversions.character">[[conversions.character]]</a>
|
| 566 |
|
|
|
|
| 574 |
template <class charT> charT tolower(charT c, const locale& loc);
|
| 575 |
```
|
| 576 |
|
| 577 |
*Returns:* `use_facet<ctype<charT>>(loc).tolower(c)`.
|
| 578 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|