tmp/tmp3q_l_nxh/{from.md → to.md}
RENAMED
|
@@ -109,38 +109,71 @@ classification named by the character sequence designated by the
|
|
| 109 |
iterator range \[`first`, `last`). If the parameter `icase` is true then
|
| 110 |
the returned mask identifies the character classification without regard
|
| 111 |
to the case of the characters being matched, otherwise it does honor the
|
| 112 |
case of the characters being matched.[^1] The value returned shall be
|
| 113 |
independent of the case of the characters in the character sequence. If
|
| 114 |
-
the name is not recognized then returns
|
| 115 |
-
0.
|
| 116 |
|
| 117 |
-
*Remarks:* For `regex_traits<char>`, at least the
|
| 118 |
-
|
| 119 |
-
`
|
| 120 |
-
shall be recognized.
|
| 121 |
-
`L"d"`, `L"w"`, `L"s"`, `L"alnum"`, `L"alpha"`, `L"blank"`, `L"cntrl"`,
|
| 122 |
-
`L"digit"`, `L"graph"`, `L"lower"`, `L"print"`, `L"punct"`, `L"space"`,
|
| 123 |
-
`L"upper"` and `L"xdigit"` shall be recognized.
|
| 124 |
|
| 125 |
``` cpp
|
| 126 |
bool isctype(charT c, char_class_type f) const;
|
| 127 |
```
|
| 128 |
|
| 129 |
*Effects:* Determines if the character `c` is a member of the character
|
| 130 |
classification represented by `f`.
|
| 131 |
|
| 132 |
-
*Returns:*
|
| 133 |
-
|
| 134 |
-
`
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
``` cpp
|
| 144 |
int value(charT ch, int radix) const;
|
| 145 |
```
|
| 146 |
|
|
@@ -170,5 +203,26 @@ locale_type getloc()const;
|
|
| 170 |
|
| 171 |
*Returns:* if no locale has been imbued then a copy of the global locale
|
| 172 |
in effect at the time of construction of `*this`, otherwise a copy of
|
| 173 |
the last argument passed to `imbue`.
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
iterator range \[`first`, `last`). If the parameter `icase` is true then
|
| 110 |
the returned mask identifies the character classification without regard
|
| 111 |
to the case of the characters being matched, otherwise it does honor the
|
| 112 |
case of the characters being matched.[^1] The value returned shall be
|
| 113 |
independent of the case of the characters in the character sequence. If
|
| 114 |
+
the name is not recognized then returns `char_class_type()`.
|
|
|
|
| 115 |
|
| 116 |
+
*Remarks:* For `regex_traits<char>`, at least the narrow character names
|
| 117 |
+
in Table [[tab:re.traits.classnames]] shall be recognized. For
|
| 118 |
+
`regex_traits<wchar_t>`, at least the wide character names in
|
| 119 |
+
Table [[tab:re.traits.classnames]] shall be recognized.
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
``` cpp
|
| 122 |
bool isctype(charT c, char_class_type f) const;
|
| 123 |
```
|
| 124 |
|
| 125 |
*Effects:* Determines if the character `c` is a member of the character
|
| 126 |
classification represented by `f`.
|
| 127 |
|
| 128 |
+
*Returns:* Given the following function prototype:
|
| 129 |
+
|
| 130 |
+
``` cpp
|
| 131 |
+
// for exposition only
|
| 132 |
+
template<class C>
|
| 133 |
+
ctype_base::mask convert(typename regex_traits<C>::char_class_type f);
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
that returns a value in which each `ctype_base::mask` value
|
| 137 |
+
corresponding to a value in `f` named in
|
| 138 |
+
Table [[tab:re.traits.classnames]] is set, then the result is
|
| 139 |
+
determined as if by:
|
| 140 |
+
|
| 141 |
+
``` cpp
|
| 142 |
+
ctype_base::mask m = convert<charT>(f);
|
| 143 |
+
const ctype<charT>& ct = use_facet<ctype<charT>>(getloc());
|
| 144 |
+
if (ct.is(m, c)) {
|
| 145 |
+
return true;
|
| 146 |
+
} else if (c == ct.widen('_')) {
|
| 147 |
+
charT w[1] = { ct.widen('w') };
|
| 148 |
+
char_class_type x = lookup_classname(w, w+1);
|
| 149 |
+
|
| 150 |
+
return (f&x) == x;
|
| 151 |
+
} else {
|
| 152 |
+
return false;
|
| 153 |
+
}
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
``` cpp
|
| 157 |
+
regex_traits<char> t;
|
| 158 |
+
string d("d");
|
| 159 |
+
string u("upper");
|
| 160 |
+
regex_traits<char>::char_class_type f;
|
| 161 |
+
f = t.lookup_classname(d.begin(), d.end());
|
| 162 |
+
f |= t.lookup_classname(u.begin(), u.end());
|
| 163 |
+
ctype_base::mask m = convert<char>(f); // m == ctype_base::digit|ctype_base::upper
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
``` cpp
|
| 167 |
+
regex_traits<char> t;
|
| 168 |
+
string w("w");
|
| 169 |
+
regex_traits<char>::char_class_type f;
|
| 170 |
+
f = t.lookup_classname(w.begin(), w.end());
|
| 171 |
+
t.isctype('A', f); // returns true
|
| 172 |
+
t.isctype('_', f); // returns true
|
| 173 |
+
t.isctype(' ', f); // returns false
|
| 174 |
+
```
|
| 175 |
|
| 176 |
``` cpp
|
| 177 |
int value(charT ch, int radix) const;
|
| 178 |
```
|
| 179 |
|
|
|
|
| 203 |
|
| 204 |
*Returns:* if no locale has been imbued then a copy of the global locale
|
| 205 |
in effect at the time of construction of `*this`, otherwise a copy of
|
| 206 |
the last argument passed to `imbue`.
|
| 207 |
|
| 208 |
+
**Table: Character class names and corresponding `ctype` masks** <a id="tab:re.traits.classnames">[tab:re.traits.classnames]</a>
|
| 209 |
+
|
| 210 |
+
| Narrow character name | Wide character name | Corresponding `ctype_base::mask` value |
|
| 211 |
+
| --------------------- | ------------------- | -------------------------------------- |
|
| 212 |
+
| `"alnum"` | `L"alnum"` | `ctype_base::alnum` |
|
| 213 |
+
| `"alpha"` | `L"alpha"` | `ctype_base::alpha` |
|
| 214 |
+
| `"blank"` | `L"blank"` | `ctype_base::blank` |
|
| 215 |
+
| `"cntrl"` | `L"cntrl"` | `ctype_base::cntrl` |
|
| 216 |
+
| `"digit"` | `L"digit"` | `ctype_base::digit` |
|
| 217 |
+
| `"d"` | `L"d"` | `ctype_base::digit` |
|
| 218 |
+
| `"graph"` | `L"graph"` | `ctype_base::graph` |
|
| 219 |
+
| `"lower"` | `L"lower"` | `ctype_base::lower` |
|
| 220 |
+
| `"print"` | `L"print"` | `ctype_base::print` |
|
| 221 |
+
| `"punct"` | `L"punct"` | `ctype_base::punct` |
|
| 222 |
+
| `"space"` | `L"space"` | `ctype_base::space` |
|
| 223 |
+
| `"s"` | `L"s"` | `ctype_base::space` |
|
| 224 |
+
| `"upper"` | `L"upper"` | `ctype_base::upper` |
|
| 225 |
+
| `"w"` | `L"w"` | `ctype_base::alnum` |
|
| 226 |
+
| `"xdigit"` | `L"xdigit"` | `ctype_base::xdigit` |
|
| 227 |
+
|
| 228 |
+
|