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

183 lines
5.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[locale.cons]
# 28 Text processing library [[text]](./#text)
## 28.3 Localization library [[localization]](localization#locale.cons)
### 28.3.3 Locales [[locales]](locales#locale.cons)
#### 28.3.3.1 Class locale [[locale]](locale#cons)
#### 28.3.3.1.3 Constructors and destructor [locale.cons]
[🔗](#lib:locale,constructor)
`locale() noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L865)
*Effects*: Constructs a copy of the argument last passed tolocale::global(locale&),
if it has been called;
else, the resulting facets have virtual function semantics identical to
those of locale::classic()[.](#1.sentence-1)
[*Note [1](#note-1)*:
This constructor yields a copy of the current global locale[.](#1.sentence-2)
It is commonly used as a default argument for
function parameters of type const locale&[.](#1.sentence-3)
— *end note*]
[🔗](#lib:locale,constructor_)
`explicit locale(const char* std_name);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L885)
*Effects*: Constructs a locale using standard C locale names, e.g., "POSIX"[.](#2.sentence-1)
The resulting locale implements semantics defined to be associated
with that name[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L891)
*Throws*: runtime_error if the argument is not valid, or is null[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L895)
*Remarks*: The set of valid string argument values is"C", "", and any implementation-defined values[.](#4.sentence-1)
[🔗](#lib:locale,constructor__)
`explicit locale(const string& std_name);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L907)
*Effects*: Equivalent to locale(std_name.c_str())[.](#5.sentence-1)
[🔗](#lib:locale,constructor___)
`locale(const locale& other, const char* std_name, category cats);
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L918)
*Preconditions*: cats is a valid category value ([[locale.category]](locale.category "28.3.3.1.2.1Type locale::category"))[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L922)
*Effects*: Constructs a locale as a copy of other except for the facets identified by the category argument,
which instead implement the same semantics as locale(std_name)[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L928)
*Throws*: runtime_error if the second argument is not valid, or is null[.](#8.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L932)
*Remarks*: The locale has a name if and only if other has a name[.](#9.sentence-1)
[🔗](#lib:locale,constructor____)
`locale(const locale& other, const string& std_name, category cats);
`
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L943)
*Effects*: Equivalent to locale(other, std_name.c_str(), cats)[.](#10.sentence-1)
[🔗](#lib:locale,constructor_____)
`template<class Facet> locale(const locale& other, Facet* f);
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L954)
*Effects*: Constructs a locale incorporating all facets from the first argument
except that of type Facet,
and installs the second argument as the remaining facet[.](#11.sentence-1)
If f is null, the resulting object is a copy of other[.](#11.sentence-2)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L961)
*Remarks*: If f is null,
the resulting locale has the same name as other[.](#12.sentence-1)
Otherwise, the resulting locale has no name[.](#12.sentence-2)
[🔗](#lib:locale,constructor______)
`locale(const locale& other, const locale& one, category cats);
`
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L974)
*Preconditions*: cats is a valid category value[.](#13.sentence-1)
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L978)
*Effects*: Constructs a locale incorporating all facets from the first argument
except those that implement cats,
which are instead incorporated from the second argument[.](#14.sentence-1)
[15](#15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L984)
*Remarks*: If cats is equal to locale::none,
the resulting locale has a name if and only if the first argument has a name[.](#15.sentence-1)
Otherwise, the resulting locale has a name if and only if
the first two arguments both have names[.](#15.sentence-2)
[🔗](#lib:operator=,locale)
`const locale& operator=(const locale& other) noexcept;
`
[16](#16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L998)
*Effects*: Creates a copy of other, replacing the current value[.](#16.sentence-1)
[17](#17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1002)
*Returns*: *this[.](#17.sentence-1)