132 lines
5.4 KiB
Markdown
132 lines
5.4 KiB
Markdown
[locale.time.put]
|
|
|
|
# 28 Text processing library [[text]](./#text)
|
|
|
|
## 28.3 Localization library [[localization]](localization#locale.time.put)
|
|
|
|
### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.time.put)
|
|
|
|
#### 28.3.4.6 The time category [[category.time]](category.time#locale.time.put)
|
|
|
|
#### 28.3.4.6.4 Class template time_put [locale.time.put]
|
|
|
|
#### [28.3.4.6.4.1](#general) General [[locale.time.put.general]](locale.time.put.general)
|
|
|
|
[ð](#lib:time_put)
|
|
|
|
namespace std {template<class charT, class OutputIterator = ostreambuf_iterator<charT>>class time_put : public locale::facet {public:using char_type = charT; using iter_type = OutputIterator; explicit time_put(size_t refs = 0); // the following is implemented in terms of other member functions. iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb, const charT* pattern, const charT* pat_end) const;
|
|
iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb, char format, char modifier = 0) const; static locale::id id; protected:~time_put(); virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t, char format, char modifier) const; };}
|
|
|
|
#### [28.3.4.6.4.2](#members) Members [[locale.time.put.members]](locale.time.put.members)
|
|
|
|
[ð](#lib:time_put,put)
|
|
|
|
`iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
|
|
const charT* pattern, const charT* pat_end) const;
|
|
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
|
|
char format, char modifier = 0) const;
|
|
`
|
|
|
|
[1](#members-1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4008)
|
|
|
|
*Effects*: The first form steps through the sequence
|
|
from pattern to pat_end,
|
|
identifying characters that are part of a format sequence[.](#members-1.sentence-1)
|
|
|
|
Each character that is not part of a format sequence
|
|
is written to s immediately, and
|
|
each format sequence, as it is identified, results in a call to do_put;
|
|
thus, format elements and other characters are interleaved in the output
|
|
in the order in which they appear in the pattern[.](#members-1.sentence-2)
|
|
|
|
Format sequences are identified by converting each character c to
|
|
a char value as if by ct.narrow(c, 0),
|
|
where ct is a reference to ctype<charT> obtained from str.getloc()[.](#members-1.sentence-3)
|
|
|
|
The first character of each sequence is equal to '%',
|
|
followed by an optional modifier character mod and a format specifier character spec as defined for the function strftime[.](#members-1.sentence-4)
|
|
|
|
If no modifier character is present, mod is zero[.](#members-1.sentence-5)
|
|
|
|
For each valid format sequence identified,
|
|
calls do_put(s, str, fill, t, spec, mod)[.](#members-1.sentence-6)
|
|
|
|
[2](#members-2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4030)
|
|
|
|
The second form calls do_put(s, str, fill, t, format, modifier)[.](#members-2.sentence-1)
|
|
|
|
[3](#members-3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4033)
|
|
|
|
[*Note [1](#members-note-1)*:
|
|
|
|
The fill argument can be used
|
|
in the implementation-defined formats or by derivations[.](#members-3.sentence-1)
|
|
|
|
A space character is a reasonable default for this argument[.](#members-3.sentence-2)
|
|
|
|
â *end note*]
|
|
|
|
[4](#members-4)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4040)
|
|
|
|
*Returns*: An iterator pointing immediately after the last character produced[.](#members-4.sentence-1)
|
|
|
|
#### [28.3.4.6.4.3](#virtuals) Virtual functions [[locale.time.put.virtuals]](locale.time.put.virtuals)
|
|
|
|
[ð](#lib:time_put,do_put)
|
|
|
|
`iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
|
|
char format, char modifier) const;
|
|
`
|
|
|
|
[1](#virtuals-1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4054)
|
|
|
|
*Effects*: Formats the contents of the parameter t into characters placed on the output sequence s[.](#virtuals-1.sentence-1)
|
|
|
|
Formatting is controlled by the parameters format and modifier,
|
|
interpreted identically as the format specifiers
|
|
in the string argument to the standard library functionstrftime(),
|
|
except that the sequence of characters produced for those specifiers
|
|
that are described as depending on the C locale
|
|
are insteadimplementation-defined[.](#virtuals-1.sentence-2)
|
|
|
|
[*Note [1](#virtuals-note-1)*:
|
|
|
|
Interpretation of the modifier argument is implementation-defined[.](#virtuals-1.sentence-3)
|
|
|
|
â *end note*]
|
|
|
|
[2](#virtuals-2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4072)
|
|
|
|
*Returns*: An iterator pointing immediately after the last character produced[.](#virtuals-2.sentence-1)
|
|
|
|
[*Note [2](#virtuals-note-2)*:
|
|
|
|
The fill argument can be used
|
|
in the implementation-defined formats or by derivations[.](#virtuals-2.sentence-2)
|
|
|
|
A space character is a reasonable default for this argument[.](#virtuals-2.sentence-3)
|
|
|
|
â *end note*]
|
|
|
|
[3](#virtuals-3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4081)
|
|
|
|
*Recommended practice*: Interpretation of the modifier should follow POSIX conventions[.](#virtuals-3.sentence-1)
|
|
|
|
Implementations should refer to other standards such as POSIX
|
|
for a specification of the character sequences produced for
|
|
those specifiers described as depending on the C locale[.](#virtuals-3.sentence-2)
|