Files
2025-10-25 03:02:53 +03:00

179 lines
5.7 KiB
Markdown
Raw Permalink 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.time.get.members]
# 28 Text processing library [[text]](./#text)
## 28.3 Localization library [[localization]](localization#locale.time.get.members)
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.time.get.members)
#### 28.3.4.6 The time category [[category.time]](category.time#locale.time.get.members)
#### 28.3.4.6.2 Class template time_get [[locale.time.get]](locale.time.get#members)
#### 28.3.4.6.2.2 Members [locale.time.get.members]
[🔗](#lib:time_get,date_order)
`dateorder date_order() const;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3619)
*Returns*: do_date_order()[.](#1.sentence-1)
[🔗](#lib:time_get,get_time)
`iter_type get_time(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3631)
*Returns*: do_get_time(s, end, str, err, t)[.](#2.sentence-1)
[🔗](#lib:time_get,get_date)
`iter_type get_date(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3643)
*Returns*: do_get_date(s, end, str, err, t)[.](#3.sentence-1)
[🔗](#lib:time_get,get_weekday)
`iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3658)
*Returns*: do_get_weekday(s, end, str, err, t) ordo_get_monthname(s, end, str, err, t)[.](#4.sentence-1)
[🔗](#lib:time_get,get_year)
`iter_type get_year(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3672)
*Returns*: do_get_year(s, end, str, err, t)[.](#5.sentence-1)
[🔗](#lib:get,time_get)
`iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
tm* t, char format, char modifier = 0) const;
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3684)
*Returns*: do_get(s, end, f, err, t, format, modifier)[.](#6.sentence-1)
[🔗](#lib:get,time_get_)
`iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
tm* t, const char_type* fmt, const char_type* fmtend) const;
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3696)
*Preconditions*: [fmt, fmtend) is a valid range[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3700)
*Effects*: The function starts by evaluating err = ios_base::goodbit[.](#8.sentence-1)
It then enters a loop,
reading zero or more characters from s at each iteration[.](#8.sentence-2)
Unless otherwise specified below,
the loop terminates when the first of the following conditions holds:
- [(8.1)](#8.1)
The expression fmt == fmtend evaluates to true[.](#8.1.sentence-1)
- [(8.2)](#8.2)
The expression err == ios_base::goodbit evaluates to false[.](#8.2.sentence-1)
- [(8.3)](#8.3)
The expression s == end evaluates to true,
in which case
the function evaluates err = ios_base::eofbit | ios_base::failbit[.](#8.3.sentence-1)
- [(8.4)](#8.4)
The next element of fmt is equal to '%',
optionally followed by a modifier character,
followed by a conversion specifier character, format,
together forming a conversion specification
valid for the POSIX function strptime[.](#8.4.sentence-1)
If the number of elements in the range [fmt, fmtend)
is not sufficient to unambiguously determine
whether the conversion specification is complete and valid,
the function evaluates err = ios_base::failbit[.](#8.4.sentence-2)
Otherwise,
the function evaluates s = do_get(s, end, f, err, t, format, modifier),
where the value of modifier is '\0' when the optional modifier is absent from the conversion specification[.](#8.4.sentence-3)
If err == ios_base::goodbit holds
after the evaluation of the expression,
the function increments fmt to point just past the end of the conversion specification and
continues looping[.](#8.4.sentence-4)
- [(8.5)](#8.5)
The expression isspace(*fmt, f.getloc()) evaluates to true,
in which case the function first increments fmt untilfmt == fmtend || !isspace(*fmt, f.getloc()) evaluates to true,
then advances s until s == end || !isspace(*s, f.getloc()) is true, and
finally resumes looping[.](#8.5.sentence-1)
- [(8.6)](#8.6)
The next character read from s matches the element pointed to by fmt in a case-insensitive comparison,
in which case the function evaluates ++fmt, ++s and continues looping[.](#8.6.sentence-1)
Otherwise, the function evaluates err = ios_base::failbit[.](#8.6.sentence-2)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3752)
[*Note [1](#note-1)*:
The function uses the ctype<charT> facet
installed in f's locale
to determine valid whitespace characters[.](#9.sentence-1)
It is unspecified
by what means the function performs case-insensitive comparison or
whether multi-character sequences are considered while doing so[.](#9.sentence-2)
— *end note*]
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3762)
*Returns*: s[.](#10.sentence-1)