tmp/tmptvpup3h6/{from.md → to.md}
RENAMED
|
@@ -8,12 +8,12 @@ namespace std {
|
|
| 8 |
};
|
| 9 |
|
| 10 |
template <class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 11 |
class time_get : public locale::facet, public time_base {
|
| 12 |
public:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
explicit time_get(size_t refs = 0);
|
| 17 |
|
| 18 |
dateorder date_order() const { return do_date_order(); }
|
| 19 |
iter_type get_time(iter_type s, iter_type end, ios_base& f,
|
|
@@ -54,81 +54,81 @@ namespace std {
|
|
| 54 |
```
|
| 55 |
|
| 56 |
`time_get`
|
| 57 |
|
| 58 |
is used to parse a character sequence, extracting components of a time
|
| 59 |
-
or date into a `struct tm`
|
| 60 |
produced by a corresponding format specifier to `time_put<>::put`. If
|
| 61 |
the sequence being parsed matches the correct format, the corresponding
|
| 62 |
members of the `struct tm` argument are set to the values used to
|
| 63 |
produce the sequence; otherwise either an error is reported or
|
| 64 |
-
unspecified values are assigned.[^
|
| 65 |
|
| 66 |
If the end iterator is reached during parsing by any of the `get()`
|
| 67 |
member functions, the member sets `ios_base::eofbit` in `err`.
|
| 68 |
|
| 69 |
##### `time_get` members <a id="locale.time.get.members">[[locale.time.get.members]]</a>
|
| 70 |
|
| 71 |
``` cpp
|
| 72 |
dateorder date_order() const;
|
| 73 |
```
|
| 74 |
|
| 75 |
-
*Returns:* `do_date_order()`
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
iter_type get_time(iter_type s, iter_type end, ios_base& str,
|
| 79 |
ios_base::iostate& err, tm* t) const;
|
| 80 |
```
|
| 81 |
|
| 82 |
-
*Returns:* `do_get_time(s, end, str, err, t)`
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
iter_type get_date(iter_type s, iter_type end, ios_base& str,
|
| 86 |
ios_base::iostate& err, tm* t) const;
|
| 87 |
```
|
| 88 |
|
| 89 |
-
*Returns:* `do_get_date(s, end, str, err, t)`
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
|
| 93 |
ios_base::iostate& err, tm* t) const;
|
| 94 |
iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
|
| 95 |
ios_base::iostate& err, tm* t) const;
|
| 96 |
```
|
| 97 |
|
| 98 |
*Returns:* `do_get_weekday(s, end, str, err, t)` or
|
| 99 |
-
`do_get_monthname(s, end, str, err, t)`
|
| 100 |
|
| 101 |
``` cpp
|
| 102 |
iter_type get_year(iter_type s, iter_type end, ios_base& str,
|
| 103 |
ios_base::iostate& err, tm* t) const;
|
| 104 |
```
|
| 105 |
|
| 106 |
-
*Returns:* `do_get_year(s, end, str, err, t)`
|
| 107 |
|
| 108 |
``` cpp
|
| 109 |
-
iter_type get(iter_type s, iter_type end, ios_base& f,
|
| 110 |
-
|
| 111 |
```
|
| 112 |
|
| 113 |
-
*Returns:* `do_get(s, end, f, err, t, format, modifier)`
|
| 114 |
|
| 115 |
``` cpp
|
| 116 |
-
iter_type get(iter_type s, iter_type end, ios_base& f,
|
| 117 |
-
|
| 118 |
```
|
| 119 |
|
| 120 |
*Requires:* \[`fmt`, `fmtend`) shall be a valid range.
|
| 121 |
|
| 122 |
*Effects:* The function starts by evaluating `err = ios_base::goodbit`.
|
| 123 |
It then enters a loop, reading zero or more characters from `s` at each
|
| 124 |
iteration. Unless otherwise specified below, the loop terminates when
|
| 125 |
the first of the following conditions holds:
|
| 126 |
|
| 127 |
-
- The expression `fmt == fmtend` evaluates to true.
|
| 128 |
-
- The expression `err == ios_base::goodbit` evaluates to false.
|
| 129 |
-
- The expression `s == end` evaluates to true, in which case the
|
| 130 |
function evaluates `err = ios_base::eofbit | ios_base::failbit`.
|
| 131 |
- The next element of `fmt` is equal to `’%’`, optionally followed by a
|
| 132 |
modifier character, followed by a conversion specifier character,
|
| 133 |
`format`, together forming a conversion specification valid for the
|
| 134 |
ISO/IEC 9945 function `strptime`. If the number of elements in the
|
|
@@ -139,36 +139,37 @@ the first of the following conditions holds:
|
|
| 139 |
value of `modifier` is `’\0’` when the optional modifier is absent
|
| 140 |
from the conversion specification. If `err == ios_base::goodbit` holds
|
| 141 |
after the evaluation of the expression, the function increments `fmt`
|
| 142 |
to point just past the end of the conversion specification and
|
| 143 |
continues looping.
|
| 144 |
-
- The expression `isspace(*fmt, f.getloc())` evaluates to true, in
|
| 145 |
-
case the function first increments `fmt` until
|
| 146 |
-
`fmt == fmtend || !isspace(*fmt, f.getloc())` evaluates to true,
|
| 147 |
-
advances `s` until `s == end || !isspace(*s, f.getloc())` is
|
| 148 |
-
finally resumes looping.
|
| 149 |
- The next character read from `s` matches the element pointed to by
|
| 150 |
`fmt` in a case-insensitive comparison, in which case the function
|
| 151 |
evaluates `++fmt, ++s` and continues looping. Otherwise, the function
|
| 152 |
evaluates `err = ios_base::failbit`.
|
| 153 |
|
| 154 |
-
The function uses the `ctype<charT>` facet installed in
|
| 155 |
-
determine valid whitespace characters. It is unspecified
|
| 156 |
-
the function performs case-insensitive comparison or
|
| 157 |
-
multi-character sequences are considered while doing
|
|
|
|
| 158 |
|
| 159 |
-
*Returns:* `s`
|
| 160 |
|
| 161 |
##### `time_get` virtual functions <a id="locale.time.get.virtuals">[[locale.time.get.virtuals]]</a>
|
| 162 |
|
| 163 |
``` cpp
|
| 164 |
dateorder do_date_order() const;
|
| 165 |
```
|
| 166 |
|
| 167 |
*Returns:* An enumeration value indicating the preferred order of
|
| 168 |
components for those date formats that are composed of day, month, and
|
| 169 |
-
year.[^
|
| 170 |
contains other variable components (e.g., Julian day, week number, week
|
| 171 |
day).
|
| 172 |
|
| 173 |
``` cpp
|
| 174 |
iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
|
|
@@ -255,24 +256,24 @@ any remaining format characters, corresponding to a conversion directive
|
|
| 255 |
appropriate for the ISO/IEC 9945 function `strptime`, formed by
|
| 256 |
concatenating `’%’`, the `modifier` character, when non-NUL, and the
|
| 257 |
`format` character. When the concatenation fails to yield a complete
|
| 258 |
valid directive the function leaves the object pointed to by `t`
|
| 259 |
unchanged and evaluates `err |= ios_base::failbit`. When `s == end`
|
| 260 |
-
evaluates to true after reading a character the function evaluates
|
| 261 |
`err |= ios_base::eofbit`.
|
| 262 |
|
| 263 |
For complex conversion directives such as `%c`, `%x`, or `%X`, or
|
| 264 |
directives that involve the optional modifiers `E` or `O`, when the
|
| 265 |
function is unable to unambiguously determine some or all `struct tm`
|
| 266 |
members from the input sequence \[`s`, `end`), it evaluates
|
| 267 |
`err |= ios_base::eofbit`. In such cases the values of those `struct tm`
|
| 268 |
members are unspecified and may be outside their valid range.
|
| 269 |
|
| 270 |
-
It is unspecified whether multiple calls to `do_get()` with
|
| 271 |
-
of the same `struct tm` object will update the current
|
| 272 |
-
object or simply overwrite its members. Portable
|
| 273 |
-
the object before invoking the function.
|
| 274 |
|
| 275 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 276 |
recognized as possibly part of a valid input sequence for the given
|
| 277 |
`format` and `modifier`.
|
| 278 |
|
|
|
|
| 8 |
};
|
| 9 |
|
| 10 |
template <class charT, class InputIterator = istreambuf_iterator<charT>>
|
| 11 |
class time_get : public locale::facet, public time_base {
|
| 12 |
public:
|
| 13 |
+
using char_type = charT;
|
| 14 |
+
using iter_type = InputIterator;
|
| 15 |
|
| 16 |
explicit time_get(size_t refs = 0);
|
| 17 |
|
| 18 |
dateorder date_order() const { return do_date_order(); }
|
| 19 |
iter_type get_time(iter_type s, iter_type end, ios_base& f,
|
|
|
|
| 54 |
```
|
| 55 |
|
| 56 |
`time_get`
|
| 57 |
|
| 58 |
is used to parse a character sequence, extracting components of a time
|
| 59 |
+
or date into a `struct tm` object. Each `get` member parses a format as
|
| 60 |
produced by a corresponding format specifier to `time_put<>::put`. If
|
| 61 |
the sequence being parsed matches the correct format, the corresponding
|
| 62 |
members of the `struct tm` argument are set to the values used to
|
| 63 |
produce the sequence; otherwise either an error is reported or
|
| 64 |
+
unspecified values are assigned.[^15]
|
| 65 |
|
| 66 |
If the end iterator is reached during parsing by any of the `get()`
|
| 67 |
member functions, the member sets `ios_base::eofbit` in `err`.
|
| 68 |
|
| 69 |
##### `time_get` members <a id="locale.time.get.members">[[locale.time.get.members]]</a>
|
| 70 |
|
| 71 |
``` cpp
|
| 72 |
dateorder date_order() const;
|
| 73 |
```
|
| 74 |
|
| 75 |
+
*Returns:* `do_date_order()`.
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
iter_type get_time(iter_type s, iter_type end, ios_base& str,
|
| 79 |
ios_base::iostate& err, tm* t) const;
|
| 80 |
```
|
| 81 |
|
| 82 |
+
*Returns:* `do_get_time(s, end, str, err, t)`.
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
iter_type get_date(iter_type s, iter_type end, ios_base& str,
|
| 86 |
ios_base::iostate& err, tm* t) const;
|
| 87 |
```
|
| 88 |
|
| 89 |
+
*Returns:* `do_get_date(s, end, str, err, t)`.
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
|
| 93 |
ios_base::iostate& err, tm* t) const;
|
| 94 |
iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
|
| 95 |
ios_base::iostate& err, tm* t) const;
|
| 96 |
```
|
| 97 |
|
| 98 |
*Returns:* `do_get_weekday(s, end, str, err, t)` or
|
| 99 |
+
`do_get_monthname(s, end, str, err, t)`.
|
| 100 |
|
| 101 |
``` cpp
|
| 102 |
iter_type get_year(iter_type s, iter_type end, ios_base& str,
|
| 103 |
ios_base::iostate& err, tm* t) const;
|
| 104 |
```
|
| 105 |
|
| 106 |
+
*Returns:* `do_get_year(s, end, str, err, t)`.
|
| 107 |
|
| 108 |
``` cpp
|
| 109 |
+
iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
|
| 110 |
+
tm* t, char format, char modifier = 0) const;
|
| 111 |
```
|
| 112 |
|
| 113 |
+
*Returns:* `do_get(s, end, f, err, t, format, modifier)`.
|
| 114 |
|
| 115 |
``` cpp
|
| 116 |
+
iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
|
| 117 |
+
tm* t, const char_type* fmt, const char_type* fmtend) const;
|
| 118 |
```
|
| 119 |
|
| 120 |
*Requires:* \[`fmt`, `fmtend`) shall be a valid range.
|
| 121 |
|
| 122 |
*Effects:* The function starts by evaluating `err = ios_base::goodbit`.
|
| 123 |
It then enters a loop, reading zero or more characters from `s` at each
|
| 124 |
iteration. Unless otherwise specified below, the loop terminates when
|
| 125 |
the first of the following conditions holds:
|
| 126 |
|
| 127 |
+
- The expression `fmt == fmtend` evaluates to `true`.
|
| 128 |
+
- The expression `err == ios_base::goodbit` evaluates to `false`.
|
| 129 |
+
- The expression `s == end` evaluates to `true`, in which case the
|
| 130 |
function evaluates `err = ios_base::eofbit | ios_base::failbit`.
|
| 131 |
- The next element of `fmt` is equal to `’%’`, optionally followed by a
|
| 132 |
modifier character, followed by a conversion specifier character,
|
| 133 |
`format`, together forming a conversion specification valid for the
|
| 134 |
ISO/IEC 9945 function `strptime`. If the number of elements in the
|
|
|
|
| 139 |
value of `modifier` is `’\0’` when the optional modifier is absent
|
| 140 |
from the conversion specification. If `err == ios_base::goodbit` holds
|
| 141 |
after the evaluation of the expression, the function increments `fmt`
|
| 142 |
to point just past the end of the conversion specification and
|
| 143 |
continues looping.
|
| 144 |
+
- The expression `isspace(*fmt, f.getloc())` evaluates to `true`, in
|
| 145 |
+
which case the function first increments `fmt` until
|
| 146 |
+
`fmt == fmtend || !isspace(*fmt, f.getloc())` evaluates to `true`,
|
| 147 |
+
then advances `s` until `s == end || !isspace(*s, f.getloc())` is
|
| 148 |
+
`true`, and finally resumes looping.
|
| 149 |
- The next character read from `s` matches the element pointed to by
|
| 150 |
`fmt` in a case-insensitive comparison, in which case the function
|
| 151 |
evaluates `++fmt, ++s` and continues looping. Otherwise, the function
|
| 152 |
evaluates `err = ios_base::failbit`.
|
| 153 |
|
| 154 |
+
[*Note 1*: The function uses the `ctype<charT>` facet installed in
|
| 155 |
+
`f`’s locale to determine valid whitespace characters. It is unspecified
|
| 156 |
+
by what means the function performs case-insensitive comparison or
|
| 157 |
+
whether multi-character sequences are considered while doing
|
| 158 |
+
so. — *end note*]
|
| 159 |
|
| 160 |
+
*Returns:* `s`.
|
| 161 |
|
| 162 |
##### `time_get` virtual functions <a id="locale.time.get.virtuals">[[locale.time.get.virtuals]]</a>
|
| 163 |
|
| 164 |
``` cpp
|
| 165 |
dateorder do_date_order() const;
|
| 166 |
```
|
| 167 |
|
| 168 |
*Returns:* An enumeration value indicating the preferred order of
|
| 169 |
components for those date formats that are composed of day, month, and
|
| 170 |
+
year.[^16] Returns `no_order` if the date format specified by `’x’`
|
| 171 |
contains other variable components (e.g., Julian day, week number, week
|
| 172 |
day).
|
| 173 |
|
| 174 |
``` cpp
|
| 175 |
iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
|
|
|
|
| 256 |
appropriate for the ISO/IEC 9945 function `strptime`, formed by
|
| 257 |
concatenating `’%’`, the `modifier` character, when non-NUL, and the
|
| 258 |
`format` character. When the concatenation fails to yield a complete
|
| 259 |
valid directive the function leaves the object pointed to by `t`
|
| 260 |
unchanged and evaluates `err |= ios_base::failbit`. When `s == end`
|
| 261 |
+
evaluates to `true` after reading a character the function evaluates
|
| 262 |
`err |= ios_base::eofbit`.
|
| 263 |
|
| 264 |
For complex conversion directives such as `%c`, `%x`, or `%X`, or
|
| 265 |
directives that involve the optional modifiers `E` or `O`, when the
|
| 266 |
function is unable to unambiguously determine some or all `struct tm`
|
| 267 |
members from the input sequence \[`s`, `end`), it evaluates
|
| 268 |
`err |= ios_base::eofbit`. In such cases the values of those `struct tm`
|
| 269 |
members are unspecified and may be outside their valid range.
|
| 270 |
|
| 271 |
+
*Remarks:* It is unspecified whether multiple calls to `do_get()` with
|
| 272 |
+
the address of the same `struct tm` object will update the current
|
| 273 |
+
contents of the object or simply overwrite its members. Portable
|
| 274 |
+
programs must zero out the object before invoking the function.
|
| 275 |
|
| 276 |
*Returns:* An iterator pointing immediately beyond the last character
|
| 277 |
recognized as possibly part of a valid input sequence for the given
|
| 278 |
`format` and `modifier`.
|
| 279 |
|