tmp/tmp5algimxl/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Members <a id="text.encoding.members">[[text.encoding.members]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
constexpr explicit text_encoding(string_view enc) noexcept;
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
*Preconditions:*
|
| 8 |
+
|
| 9 |
+
- `enc` represents a string in the ordinary literal encoding consisting
|
| 10 |
+
only of elements of the basic character set [[lex.charset]].
|
| 11 |
+
- `enc.size() <= max_name_length` is `true`.
|
| 12 |
+
- `enc.contains(’\0’)` is `false`.
|
| 13 |
+
|
| 14 |
+
*Ensures:*
|
| 15 |
+
|
| 16 |
+
- If there exists a primary name or alias `a` of a known registered
|
| 17 |
+
character encoding such that *`comp-name`*`(a, enc)` is `true`,
|
| 18 |
+
*mib\_* has the value of the enumerator of `id` associated with that
|
| 19 |
+
registered character encoding. Otherwise, *`mib_`*` == id::other` is
|
| 20 |
+
`true`.
|
| 21 |
+
- `enc.compare(`*`name_`*`) == 0` is `true`.
|
| 22 |
+
|
| 23 |
+
``` cpp
|
| 24 |
+
constexpr text_encoding(id i) noexcept;
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
*Preconditions:* `i` has the value of one of the enumerators of `id`.
|
| 28 |
+
|
| 29 |
+
*Ensures:*
|
| 30 |
+
|
| 31 |
+
- *`mib_`*` == i` is `true`.
|
| 32 |
+
- If `(`*`mib_`*` == id::unknown || `*`mib_`*` == id::other)` is `true`,
|
| 33 |
+
`strlen(`*`name_`*`) == 0` is `true`. Otherwise,
|
| 34 |
+
`ranges::contains(aliases(), string_view(`*`name_`*`))` is `true`.
|
| 35 |
+
|
| 36 |
+
``` cpp
|
| 37 |
+
constexpr id mib() const noexcept;
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
*Returns:* *mib\_*.
|
| 41 |
+
|
| 42 |
+
``` cpp
|
| 43 |
+
constexpr const char* name() const noexcept;
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
*Returns:* *name\_*.
|
| 47 |
+
|
| 48 |
+
*Remarks:* `name()` is an NTBS and accessing elements of *name\_*
|
| 49 |
+
outside of the range `name()`+\[0, `strlen(name()) + 1`) is undefined
|
| 50 |
+
behavior.
|
| 51 |
+
|
| 52 |
+
``` cpp
|
| 53 |
+
constexpr aliases_view aliases() const noexcept;
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Let `r` denote an instance of `aliases_view`. If `*this` represents a
|
| 57 |
+
known registered character encoding, then:
|
| 58 |
+
|
| 59 |
+
- `r.front()` is the primary name of the registered character encoding,
|
| 60 |
+
- `r` contains the aliases of the registered character encoding, and
|
| 61 |
+
- `r` does not contain duplicate values when compared with `strcmp`.
|
| 62 |
+
|
| 63 |
+
Otherwise, `r` is an empty range.
|
| 64 |
+
|
| 65 |
+
Each element in `r` is a non-null, non-empty NTBS encoded in the literal
|
| 66 |
+
character encoding and comprising only characters from the basic
|
| 67 |
+
character set.
|
| 68 |
+
|
| 69 |
+
*Returns:* `r`.
|
| 70 |
+
|
| 71 |
+
[*Note 1*: The order of aliases in `r` is unspecified. — *end note*]
|
| 72 |
+
|
| 73 |
+
``` cpp
|
| 74 |
+
static consteval text_encoding literal() noexcept;
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
*Mandates:* `CHAR_BIT == 8` is `true`.
|
| 78 |
+
|
| 79 |
+
*Returns:* A `text_encoding` object representing the ordinary character
|
| 80 |
+
literal encoding [[lex.charset]].
|
| 81 |
+
|
| 82 |
+
``` cpp
|
| 83 |
+
static text_encoding environment();
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
*Mandates:* `CHAR_BIT == 8` is `true`.
|
| 87 |
+
|
| 88 |
+
*Returns:* A `text_encoding` object representing the
|
| 89 |
+
*implementation-defined* character encoding scheme of the environment.
|
| 90 |
+
On a POSIX implementation, this is the encoding scheme associated with
|
| 91 |
+
the POSIX locale denoted by the empty string `""`.
|
| 92 |
+
|
| 93 |
+
[*Note 2*: This function is not affected by calls to
|
| 94 |
+
`setlocale`. — *end note*]
|
| 95 |
+
|
| 96 |
+
*Recommended practice:* Implementations should return a value that is
|
| 97 |
+
not affected by calls to the POSIX function `setenv` and other functions
|
| 98 |
+
which can modify the environment [[support.runtime]].
|
| 99 |
+
|
| 100 |
+
``` cpp
|
| 101 |
+
template<id i>
|
| 102 |
+
static bool environment_is();
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
*Mandates:* `CHAR_BIT == 8` is `true`.
|
| 106 |
+
|
| 107 |
+
*Returns:* `environment() == i`.
|
| 108 |
+
|
| 109 |
+
``` cpp
|
| 110 |
+
static constexpr bool comp-name(string_view a, string_view b);
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
*Returns:* `true` if the two strings `a` and `b` encoded in the ordinary
|
| 114 |
+
literal encoding are equal, ignoring, from left-to-right,
|
| 115 |
+
|
| 116 |
+
- all elements that are not digits or letters [[character.seq.general]],
|
| 117 |
+
- character case, and
|
| 118 |
+
- any sequence of one or more `0` characters not immediately preceded by
|
| 119 |
+
a numeric prefix, where a numeric prefix is a sequence consisting of a
|
| 120 |
+
digit in the range \[`1`, `9`\] optionally followed by one or more
|
| 121 |
+
elements which are not digits or letters,
|
| 122 |
+
|
| 123 |
+
and `false` otherwise.
|
| 124 |
+
|
| 125 |
+
[*Note 3*: This comparison is identical to the “Charset Alias Matching”
|
| 126 |
+
algorithm described in the Unicode Technical Standard 22. — *end note*]
|
| 127 |
+
|
| 128 |
+
[*Example 1*:
|
| 129 |
+
|
| 130 |
+
``` cpp
|
| 131 |
+
static_assert(comp-name("UTF-8", "utf8") == true);
|
| 132 |
+
static_assert(comp-name("u.t.f-008", "utf8") == true);
|
| 133 |
+
static_assert(comp-name("ut8", "utf8") == false);
|
| 134 |
+
static_assert(comp-name("utf-80", "utf8") == false);
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
— *end example*]
|
| 138 |
+
|