212 lines
8.0 KiB
Markdown
212 lines
8.0 KiB
Markdown
[locale.time.get.virtuals]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.3 Localization library [[localization]](localization#locale.time.get.virtuals)
|
||
|
||
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.time.get.virtuals)
|
||
|
||
#### 28.3.4.6 The time category [[category.time]](category.time#locale.time.get.virtuals)
|
||
|
||
#### 28.3.4.6.2 Class template time_get [[locale.time.get]](locale.time.get#virtuals)
|
||
|
||
#### 28.3.4.6.2.3 Virtual functions [locale.time.get.virtuals]
|
||
|
||
[ð](#lib:time_get,do_date_order)
|
||
|
||
`dateorder do_date_order() const;
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3775)
|
||
|
||
*Returns*: An enumeration value indicating the preferred order of components
|
||
for those date formats that are composed of day, month, and year[.](#1.sentence-1)[228](#footnote-228 "This function is intended as a convenience only, for common formats, and can return no_order in valid locales.")
|
||
|
||
Returns no_order if the date format specified by 'x' contains other variable components (e.g., Julian day, week number, week day)[.](#1.sentence-2)
|
||
|
||
[ð](#lib:time_get,do_get_time)
|
||
|
||
`iter_type do_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#L3794)
|
||
|
||
*Effects*: Reads characters starting at s until it has extracted those tm members, and
|
||
remaining format characters,
|
||
used by time_put<>::put to produce the format specified by "%H:%M:%S",
|
||
or until it encounters an error or end of sequence[.](#2.sentence-1)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3803)
|
||
|
||
*Returns*: An iterator pointing immediately beyond
|
||
the last character recognized as possibly part of a valid time[.](#3.sentence-1)
|
||
|
||
[ð](#lib:time_get,do_get_date)
|
||
|
||
`iter_type do_get_date(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#L3816)
|
||
|
||
*Effects*: Reads characters starting at s until it has extracted those tm members and
|
||
remaining format characters
|
||
used by time_put<>::put to produce one of the following formats,
|
||
or until it encounters an error[.](#4.sentence-1)
|
||
|
||
The format depends on the value returned by date_order() as shown in Table [102](#tab:locale.time.get.dogetdate "Table 102: do_get_date effects")[.](#4.sentence-2)
|
||
|
||
Table [102](#tab:locale.time.get.dogetdate) — do_get_date effects [[tab:locale.time.get.dogetdate]](./tab:locale.time.get.dogetdate)
|
||
|
||
| [ð](#tab:locale.time.get.dogetdate-row-1)<br>**date_order()** | **Format** |
|
||
| --- | --- |
|
||
| [ð](#tab:locale.time.get.dogetdate-row-2)<br>no_order | "%m%d%y" |
|
||
| [ð](#tab:locale.time.get.dogetdate-row-3)<br>dmy | "%d%m%y" |
|
||
| [ð](#tab:locale.time.get.dogetdate-row-4)<br>mdy | "%m%d%y" |
|
||
| [ð](#tab:locale.time.get.dogetdate-row-5)<br>ymd | "%y%m%d" |
|
||
| [ð](#tab:locale.time.get.dogetdate-row-6)<br>ydm | "%y%d%m" |
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3836)
|
||
|
||
An implementation may also accept additionalimplementation-defined formats[.](#5.sentence-1)
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3840)
|
||
|
||
*Returns*: An iterator pointing immediately beyond
|
||
the last character recognized as possibly part of a valid date[.](#6.sentence-1)
|
||
|
||
[ð](#lib:time_get,do_get_weekday)
|
||
|
||
`iter_type do_get_weekday(iter_type s, iter_type end, ios_base& str,
|
||
ios_base::iostate& err, tm* t) const;
|
||
iter_type do_get_monthname(iter_type s, iter_type end, ios_base& str,
|
||
ios_base::iostate& err, tm* t) const;
|
||
`
|
||
|
||
[7](#7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3856)
|
||
|
||
*Effects*: Reads characters starting at s until it has extracted the (perhaps abbreviated) name of a weekday or month[.](#7.sentence-1)
|
||
|
||
If it finds an abbreviation
|
||
that is followed by characters that can match a full name,
|
||
it continues reading until it matches the full name or fails[.](#7.sentence-2)
|
||
|
||
It sets the appropriate tm member accordingly[.](#7.sentence-3)
|
||
|
||
[8](#8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3865)
|
||
|
||
*Returns*: An iterator pointing immediately beyond the last character recognized
|
||
as part of a valid name[.](#8.sentence-1)
|
||
|
||
[ð](#lib:time_get,do_get_year)
|
||
|
||
`iter_type do_get_year(iter_type s, iter_type end, ios_base& str,
|
||
ios_base::iostate& err, tm* t) const;
|
||
`
|
||
|
||
[9](#9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3878)
|
||
|
||
*Effects*: Reads characters starting at s until it has extracted an unambiguous year identifier[.](#9.sentence-1)
|
||
|
||
It isimplementation-defined
|
||
whether two-digit year numbers are accepted,
|
||
and (if so) what century they are assumed to lie in[.](#9.sentence-2)
|
||
|
||
Sets the t->tm_year member accordingly[.](#9.sentence-3)
|
||
|
||
[10](#10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3888)
|
||
|
||
*Returns*: An iterator pointing immediately beyond
|
||
the last character recognized as part of a valid year identifier[.](#10.sentence-1)
|
||
|
||
[ð](#lib:do_get,time_get)
|
||
|
||
`iter_type do_get(iter_type s, iter_type end, ios_base& f,
|
||
ios_base::iostate& err, tm* t, char format, char modifier) const;
|
||
`
|
||
|
||
[11](#11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3901)
|
||
|
||
*Preconditions*: t points to an object[.](#11.sentence-1)
|
||
|
||
[12](#12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3905)
|
||
|
||
*Effects*: The function starts by evaluating err = ios_base::goodbit[.](#12.sentence-1)
|
||
|
||
It then reads characters starting at s until it encounters an error, or
|
||
until it has extracted and assigned those tm members, and
|
||
any remaining format characters,
|
||
corresponding to a conversion specification appropriate for
|
||
the POSIX function strptime,
|
||
formed by concatenating '%',
|
||
the modifier character, when non-NUL, and
|
||
the format character[.](#12.sentence-2)
|
||
|
||
When the concatenation fails to yield a complete valid directive
|
||
the function leaves the object pointed to by t unchanged and
|
||
evaluates err |= ios_base::failbit[.](#12.sentence-3)
|
||
|
||
When s == end evaluates to true after reading a character
|
||
the function evaluates err |= ios_base::eofbit[.](#12.sentence-4)
|
||
|
||
[13](#13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3922)
|
||
|
||
For complex conversion specifications
|
||
such as %c, %x, or %X, or
|
||
conversion specifications that involve the optional modifiers E or O,
|
||
when the function is unable to unambiguously determine
|
||
some or all tm members from the input sequence [s, end),
|
||
it evaluates err |= ios_base::eofbit[.](#13.sentence-1)
|
||
|
||
In such cases the values of those tm members are unspecified
|
||
and may be outside their valid range[.](#13.sentence-2)
|
||
|
||
[14](#14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3932)
|
||
|
||
*Returns*: An iterator pointing immediately beyond
|
||
the last character recognized as possibly part of
|
||
a valid input sequence for the given format and modifier[.](#14.sentence-1)
|
||
|
||
[15](#15)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3938)
|
||
|
||
*Remarks*: It is unspecified whether multiple calls to do_get() with the address of the same tm object
|
||
will update the current contents of the object or simply overwrite its members[.](#15.sentence-1)
|
||
|
||
Portable programs should zero out the object before invoking the function[.](#15.sentence-2)
|
||
|
||
[228)](#footnote-228)[228)](#footnoteref-228)
|
||
|
||
This function is intended as a convenience only, for common formats, and
|
||
can return no_order in valid locales[.](#footnote-228.sentence-1)
|