tmp/tmp0iwsimo7/{from.md → to.md}
RENAMED
|
@@ -1,34 +1,30 @@
|
|
| 1 |
-
#### `ctype`
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<>
|
| 6 |
class ctype<char> : public locale::facet, public ctype_base {
|
| 7 |
public:
|
| 8 |
using char_type = char;
|
| 9 |
|
| 10 |
-
explicit ctype(const mask* tab =
|
| 11 |
-
size_t refs = 0);
|
| 12 |
|
| 13 |
bool is(mask m, char c) const;
|
| 14 |
const char* is(const char* low, const char* high, mask* vec) const;
|
| 15 |
-
const char* scan_is (mask m,
|
| 16 |
-
|
| 17 |
-
const char* scan_not(mask m,
|
| 18 |
-
const char* low, const char* high) const;
|
| 19 |
|
| 20 |
char toupper(char c) const;
|
| 21 |
const char* toupper(char* low, const char* high) const;
|
| 22 |
char tolower(char c) const;
|
| 23 |
const char* tolower(char* low, const char* high) const;
|
| 24 |
|
| 25 |
char widen(char c) const;
|
| 26 |
const char* widen(const char* low, const char* high, char* to) const;
|
| 27 |
char narrow(char c, char dfault) const;
|
| 28 |
-
const char* narrow(const char* low, const char* high, char dfault,
|
| 29 |
-
char* to) const;
|
| 30 |
|
| 31 |
static locale::id id;
|
| 32 |
static const size_t table_size = implementation-defined;
|
| 33 |
|
| 34 |
const mask* table() const noexcept;
|
|
@@ -40,66 +36,60 @@ namespace std {
|
|
| 40 |
virtual const char* do_toupper(char* low, const char* high) const;
|
| 41 |
virtual char do_tolower(char c) const;
|
| 42 |
virtual const char* do_tolower(char* low, const char* high) const;
|
| 43 |
|
| 44 |
virtual char do_widen(char c) const;
|
| 45 |
-
virtual const char* do_widen(const char* low,
|
| 46 |
-
const char* high,
|
| 47 |
-
char* to) const;
|
| 48 |
virtual char do_narrow(char c, char dfault) const;
|
| 49 |
-
virtual const char* do_narrow(const char* low,
|
| 50 |
-
const char* high,
|
| 51 |
char dfault, char* to) const;
|
| 52 |
};
|
| 53 |
}
|
| 54 |
```
|
| 55 |
|
| 56 |
A specialization `ctype<char>` is provided so that the member functions
|
| 57 |
-
on type `char` can be implemented
|
| 58 |
*implementation-defined* value of member `table_size` is at least 256.
|
| 59 |
|
| 60 |
-
#####
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
~ctype();
|
| 64 |
```
|
| 65 |
|
| 66 |
*Effects:* If the constructor’s first argument was nonzero, and its
|
| 67 |
second argument was `true`, does `delete [] table()`.
|
| 68 |
|
| 69 |
-
#####
|
| 70 |
|
| 71 |
In the following member descriptions, for `unsigned char` values `v`
|
| 72 |
where `v >= table_size`, `table()[v]` is assumed to have an
|
| 73 |
implementation-specific value (possibly different for each such value
|
| 74 |
`v`) without performing the array lookup.
|
| 75 |
|
| 76 |
``` cpp
|
| 77 |
-
explicit ctype(const mask* tbl =
|
| 78 |
-
size_t refs = 0);
|
| 79 |
```
|
| 80 |
|
| 81 |
-
*
|
| 82 |
-
|
| 83 |
|
| 84 |
*Effects:* Passes its `refs` argument to its base class constructor.
|
| 85 |
|
| 86 |
``` cpp
|
| 87 |
bool is(mask m, char c) const;
|
| 88 |
-
const char* is(const char* low, const char* high,
|
| 89 |
-
mask* vec) const;
|
| 90 |
```
|
| 91 |
|
| 92 |
*Effects:* The second form, for all `*p` in the range \[`low`, `high`),
|
| 93 |
assigns into `vec[p - low]` the value `table()[(unsigned char)*p]`.
|
| 94 |
|
| 95 |
*Returns:* The first form returns `table()[(unsigned char)c] & m`; the
|
| 96 |
second form returns `high`.
|
| 97 |
|
| 98 |
``` cpp
|
| 99 |
-
const char* scan_is(mask m,
|
| 100 |
-
const char* low, const char* high) const;
|
| 101 |
```
|
| 102 |
|
| 103 |
*Returns:* The smallest `p` in the range \[`low`, `high`) such that
|
| 104 |
|
| 105 |
``` cpp
|
|
@@ -107,12 +97,11 @@ table()[(unsigned char) *p] & m
|
|
| 107 |
```
|
| 108 |
|
| 109 |
is `true`.
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
-
const char* scan_not(mask m,
|
| 113 |
-
const char* low, const char* high) const;
|
| 114 |
```
|
| 115 |
|
| 116 |
*Returns:* The smallest `p` in the range \[`low`, `high`) such that
|
| 117 |
|
| 118 |
``` cpp
|
|
@@ -135,20 +124,18 @@ const char* tolower(char* low, const char* high) const;
|
|
| 135 |
|
| 136 |
*Returns:* `do_tolower(c)` or `do_tolower(low, high)`, respectively.
|
| 137 |
|
| 138 |
``` cpp
|
| 139 |
char widen(char c) const;
|
| 140 |
-
const char* widen(const char* low, const char* high,
|
| 141 |
-
char* to) const;
|
| 142 |
```
|
| 143 |
|
| 144 |
*Returns:* `do_widen(c)` or `do_widen(low, high, to)`, respectively.
|
| 145 |
|
| 146 |
``` cpp
|
| 147 |
char narrow(char c, char dfault) const;
|
| 148 |
-
const char* narrow(const char* low, const char* high,
|
| 149 |
-
char dfault, char* to) const;
|
| 150 |
```
|
| 151 |
|
| 152 |
*Returns:* `do_narrow(c, dfault)` or `do_narrow(low, high, dfault, to)`,
|
| 153 |
respectively.
|
| 154 |
|
|
@@ -157,36 +144,33 @@ const mask* table() const noexcept;
|
|
| 157 |
```
|
| 158 |
|
| 159 |
*Returns:* The first constructor argument, if it was nonzero, otherwise
|
| 160 |
`classic_table()`.
|
| 161 |
|
| 162 |
-
#####
|
| 163 |
|
| 164 |
``` cpp
|
| 165 |
static const mask* classic_table() noexcept;
|
| 166 |
```
|
| 167 |
|
| 168 |
*Returns:* A pointer to the initial element of an array of size
|
| 169 |
`table_size` which represents the classifications of characters in the
|
| 170 |
`"C"` locale.
|
| 171 |
|
| 172 |
-
#####
|
| 173 |
|
| 174 |
``` cpp
|
| 175 |
char do_toupper(char) const;
|
| 176 |
const char* do_toupper(char* low, const char* high) const;
|
| 177 |
char do_tolower(char) const;
|
| 178 |
const char* do_tolower(char* low, const char* high) const;
|
| 179 |
|
| 180 |
virtual char do_widen(char c) const;
|
| 181 |
-
virtual const char* do_widen(const char* low,
|
| 182 |
-
const char* high,
|
| 183 |
-
char* to) const;
|
| 184 |
virtual char do_narrow(char c, char dfault) const;
|
| 185 |
-
virtual const char* do_narrow(const char* low,
|
| 186 |
-
const char* high,
|
| 187 |
char dfault, char* to) const;
|
| 188 |
```
|
| 189 |
|
| 190 |
These functions are described identically as those members of the same
|
| 191 |
-
name in the `ctype` class template
|
| 192 |
|
|
|
|
| 1 |
+
#### `ctype<char>` specialization <a id="facet.ctype.special">[[facet.ctype.special]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<>
|
| 6 |
class ctype<char> : public locale::facet, public ctype_base {
|
| 7 |
public:
|
| 8 |
using char_type = char;
|
| 9 |
|
| 10 |
+
explicit ctype(const mask* tab = nullptr, bool del = false, size_t refs = 0);
|
|
|
|
| 11 |
|
| 12 |
bool is(mask m, char c) const;
|
| 13 |
const char* is(const char* low, const char* high, mask* vec) const;
|
| 14 |
+
const char* scan_is (mask m, const char* low, const char* high) const;
|
| 15 |
+
const char* scan_not(mask m, const char* low, const char* high) const;
|
|
|
|
|
|
|
| 16 |
|
| 17 |
char toupper(char c) const;
|
| 18 |
const char* toupper(char* low, const char* high) const;
|
| 19 |
char tolower(char c) const;
|
| 20 |
const char* tolower(char* low, const char* high) const;
|
| 21 |
|
| 22 |
char widen(char c) const;
|
| 23 |
const char* widen(const char* low, const char* high, char* to) const;
|
| 24 |
char narrow(char c, char dfault) const;
|
| 25 |
+
const char* narrow(const char* low, const char* high, char dfault, char* to) const;
|
|
|
|
| 26 |
|
| 27 |
static locale::id id;
|
| 28 |
static const size_t table_size = implementation-defined;
|
| 29 |
|
| 30 |
const mask* table() const noexcept;
|
|
|
|
| 36 |
virtual const char* do_toupper(char* low, const char* high) const;
|
| 37 |
virtual char do_tolower(char c) const;
|
| 38 |
virtual const char* do_tolower(char* low, const char* high) const;
|
| 39 |
|
| 40 |
virtual char do_widen(char c) const;
|
| 41 |
+
virtual const char* do_widen(const char* low, const char* high, char* to) const;
|
|
|
|
|
|
|
| 42 |
virtual char do_narrow(char c, char dfault) const;
|
| 43 |
+
virtual const char* do_narrow(const char* low, const char* high,
|
|
|
|
| 44 |
char dfault, char* to) const;
|
| 45 |
};
|
| 46 |
}
|
| 47 |
```
|
| 48 |
|
| 49 |
A specialization `ctype<char>` is provided so that the member functions
|
| 50 |
+
on type `char` can be implemented inline.[^7] The
|
| 51 |
*implementation-defined* value of member `table_size` is at least 256.
|
| 52 |
|
| 53 |
+
##### Destructor <a id="facet.ctype.char.dtor">[[facet.ctype.char.dtor]]</a>
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
~ctype();
|
| 57 |
```
|
| 58 |
|
| 59 |
*Effects:* If the constructor’s first argument was nonzero, and its
|
| 60 |
second argument was `true`, does `delete [] table()`.
|
| 61 |
|
| 62 |
+
##### Members <a id="facet.ctype.char.members">[[facet.ctype.char.members]]</a>
|
| 63 |
|
| 64 |
In the following member descriptions, for `unsigned char` values `v`
|
| 65 |
where `v >= table_size`, `table()[v]` is assumed to have an
|
| 66 |
implementation-specific value (possibly different for each such value
|
| 67 |
`v`) without performing the array lookup.
|
| 68 |
|
| 69 |
``` cpp
|
| 70 |
+
explicit ctype(const mask* tbl = nullptr, bool del = false, size_t refs = 0);
|
|
|
|
| 71 |
```
|
| 72 |
|
| 73 |
+
*Preconditions:* Either `tbl == nullptr` is `true` or \[`tbl`,
|
| 74 |
+
`tbl+table_size`) is a valid range.
|
| 75 |
|
| 76 |
*Effects:* Passes its `refs` argument to its base class constructor.
|
| 77 |
|
| 78 |
``` cpp
|
| 79 |
bool is(mask m, char c) const;
|
| 80 |
+
const char* is(const char* low, const char* high, mask* vec) const;
|
|
|
|
| 81 |
```
|
| 82 |
|
| 83 |
*Effects:* The second form, for all `*p` in the range \[`low`, `high`),
|
| 84 |
assigns into `vec[p - low]` the value `table()[(unsigned char)*p]`.
|
| 85 |
|
| 86 |
*Returns:* The first form returns `table()[(unsigned char)c] & m`; the
|
| 87 |
second form returns `high`.
|
| 88 |
|
| 89 |
``` cpp
|
| 90 |
+
const char* scan_is(mask m, const char* low, const char* high) const;
|
|
|
|
| 91 |
```
|
| 92 |
|
| 93 |
*Returns:* The smallest `p` in the range \[`low`, `high`) such that
|
| 94 |
|
| 95 |
``` cpp
|
|
|
|
| 97 |
```
|
| 98 |
|
| 99 |
is `true`.
|
| 100 |
|
| 101 |
``` cpp
|
| 102 |
+
const char* scan_not(mask m, const char* low, const char* high) const;
|
|
|
|
| 103 |
```
|
| 104 |
|
| 105 |
*Returns:* The smallest `p` in the range \[`low`, `high`) such that
|
| 106 |
|
| 107 |
``` cpp
|
|
|
|
| 124 |
|
| 125 |
*Returns:* `do_tolower(c)` or `do_tolower(low, high)`, respectively.
|
| 126 |
|
| 127 |
``` cpp
|
| 128 |
char widen(char c) const;
|
| 129 |
+
const char* widen(const char* low, const char* high, char* to) const;
|
|
|
|
| 130 |
```
|
| 131 |
|
| 132 |
*Returns:* `do_widen(c)` or `do_widen(low, high, to)`, respectively.
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
char narrow(char c, char dfault) const;
|
| 136 |
+
const char* narrow(const char* low, const char* high, char dfault, char* to) const;
|
|
|
|
| 137 |
```
|
| 138 |
|
| 139 |
*Returns:* `do_narrow(c, dfault)` or `do_narrow(low, high, dfault, to)`,
|
| 140 |
respectively.
|
| 141 |
|
|
|
|
| 144 |
```
|
| 145 |
|
| 146 |
*Returns:* The first constructor argument, if it was nonzero, otherwise
|
| 147 |
`classic_table()`.
|
| 148 |
|
| 149 |
+
##### Static members <a id="facet.ctype.char.statics">[[facet.ctype.char.statics]]</a>
|
| 150 |
|
| 151 |
``` cpp
|
| 152 |
static const mask* classic_table() noexcept;
|
| 153 |
```
|
| 154 |
|
| 155 |
*Returns:* A pointer to the initial element of an array of size
|
| 156 |
`table_size` which represents the classifications of characters in the
|
| 157 |
`"C"` locale.
|
| 158 |
|
| 159 |
+
##### Virtual functions <a id="facet.ctype.char.virtuals">[[facet.ctype.char.virtuals]]</a>
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
char do_toupper(char) const;
|
| 163 |
const char* do_toupper(char* low, const char* high) const;
|
| 164 |
char do_tolower(char) const;
|
| 165 |
const char* do_tolower(char* low, const char* high) const;
|
| 166 |
|
| 167 |
virtual char do_widen(char c) const;
|
| 168 |
+
virtual const char* do_widen(const char* low, const char* high, char* to) const;
|
|
|
|
|
|
|
| 169 |
virtual char do_narrow(char c, char dfault) const;
|
| 170 |
+
virtual const char* do_narrow(const char* low, const char* high,
|
|
|
|
| 171 |
char dfault, char* to) const;
|
| 172 |
```
|
| 173 |
|
| 174 |
These functions are described identically as those members of the same
|
| 175 |
+
name in the `ctype` class template [[locale.ctype.members]].
|
| 176 |
|