This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
[locale.time.get.general]
# 28 Text processing library [[text]](./#text)
## 28.3 Localization library [[localization]](localization#locale.time.get.general)
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.time.get.general)
#### 28.3.4.6 The time category [[category.time]](category.time#locale.time.get.general)
#### 28.3.4.6.2 Class template time_get [[locale.time.get]](locale.time.get#general)
#### 28.3.4.6.2.1 General [locale.time.get.general]
[🔗](#lib:time_get)
namespace std {class time_base {public:enum dateorder { no_order, dmy, mdy, ymd, ydm }; }; template<class charT, class InputIterator = istreambuf_iterator<charT>>class time_get : public locale::facet, public time_base {public:using char_type = charT; using iter_type = InputIterator; explicit time_get(size_t refs = 0);
dateorder date_order() const { return do_date_order(); } iter_type get_time(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get_date(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get_weekday(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get_monthname(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get_year(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t, char format, char modifier = 0) const;
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; static locale::id id; protected:~time_get(); virtual dateorder do_date_order() const; virtual iter_type do_get_time(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; virtual iter_type do_get_date(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; virtual iter_type do_get_weekday(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; virtual iter_type do_get_monthname(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; virtual iter_type do_get_year(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; virtual iter_type do_get(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t, char format, char modifier) const; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3585)
time_get is used to parse a character sequence,
extracting components of a time or date into a tm object[.](#1.sentence-1)
Each get member parses a format as produced by a corresponding format specifier totime_put<>::put[.](#1.sentence-2)
If the sequence being parsed matches the correct format, the corresponding
members of thetm argument are set to the values used to produce the sequence; otherwise
either an error is reported or unspecified values are assigned[.](#1.sentence-3)[227](#footnote-227 "In other words, user confirmation is required for reliable parsing of user-entered dates and times, but machine-generated formats can be parsed reliably. This allows parsers to be aggressive about interpreting user variations on standard formats.")
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L3604)
If the end iterator is reached during parsing by any of theget() member functions, the member setsios_base::eofbit in err[.](#2.sentence-1)
[227)](#footnote-227)[227)](#footnoteref-227)
In
other words, user confirmation is required for reliable parsing of
user-entered dates and times, but machine-generated formats can be
parsed reliably[.](#footnote-227.sentence-1)
This allows parsers to be aggressive about
interpreting user variations on standard formats[.](#footnote-227.sentence-2)