1 #ifndef _DATE_TIME_DATE_FACET__HPP___
2 #define _DATE_TIME_DATE_FACET__HPP___
4 /* Copyright (c) 2004-2005 CrystalClear Software, Inc.
5 * Use, modification and distribution is subject to the
6 * Boost Software License, Version 1.0. (See accompanying
7 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
8 * Author: Martin Andrian, Jeff Garland, Bart Garst
15 #include <iterator> // ostreambuf_iterator
16 #include <boost/throw_exception.hpp>
17 #include <boost/algorithm/string/replace.hpp>
18 #include <boost/date_time/compiler_config.hpp>
19 #include <boost/date_time/period.hpp>
20 #include <boost/date_time/special_defs.hpp>
21 #include <boost/date_time/special_values_formatter.hpp>
22 #include <boost/date_time/period_formatter.hpp>
23 #include <boost/date_time/period_parser.hpp>
24 #include <boost/date_time/date_generator_formatter.hpp>
25 #include <boost/date_time/date_generator_parser.hpp>
26 #include <boost/date_time/format_date_parser.hpp>
28 namespace boost
{ namespace date_time
{
31 /*! Class that provides format based I/O facet for date types.
33 * This class allows the formatting of dates by using format string.
36 * - %A => long_weekday_format - Full name Ex: Tuesday
37 * - %a => short_weekday_format - Three letter abbreviation Ex: Tue
38 * - %B => long_month_format - Full name Ex: October
39 * - %b => short_month_format - Three letter abbreviation Ex: Oct
40 * - %x => standard_format_specifier - defined by the locale
41 * - %Y-%b-%d => default_date_format - YYYY-Mon-dd
43 * Default month format == %b
44 * Default weekday format == %a
46 template <class date_type
,
48 class OutItrT
= std::ostreambuf_iterator
<CharT
, std::char_traits
<CharT
> > >
49 class date_facet
: public std::locale::facet
{
51 typedef typename
date_type::duration_type duration_type
;
52 // greg_weekday is gregorian_calendar::day_of_week_type
53 typedef typename
date_type::day_of_week_type day_of_week_type
;
54 typedef typename
date_type::day_type day_type
;
55 typedef typename
date_type::month_type month_type
;
56 typedef boost::date_time::period
<date_type
,duration_type
> period_type
;
57 typedef std::basic_string
<CharT
> string_type
;
58 typedef CharT char_type
;
59 typedef boost::date_time::period_formatter
<CharT
> period_formatter_type
;
60 typedef boost::date_time::special_values_formatter
<CharT
> special_values_formatter_type
;
61 typedef std::vector
<std::basic_string
<CharT
> > input_collection_type
;
62 // used for the output of the date_generators
63 typedef date_generator_formatter
<date_type
, CharT
> date_gen_formatter_type
;
64 typedef partial_date
<date_type
> partial_date_type
;
65 typedef nth_kday_of_month
<date_type
> nth_kday_type
;
66 typedef first_kday_of_month
<date_type
> first_kday_type
;
67 typedef last_kday_of_month
<date_type
> last_kday_type
;
68 typedef first_kday_after
<date_type
> kday_after_type
;
69 typedef first_kday_before
<date_type
> kday_before_type
;
70 static const char_type long_weekday_format
[3];
71 static const char_type short_weekday_format
[3];
72 static const char_type long_month_format
[3];
73 static const char_type short_month_format
[3];
74 static const char_type default_period_separator
[4];
75 static const char_type standard_format_specifier
[3];
76 static const char_type iso_format_specifier
[7];
77 static const char_type iso_format_extended_specifier
[9];
78 static const char_type default_date_format
[9]; // YYYY-Mon-DD
79 static std::locale::id id
;
81 #if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
82 std::locale::id
& __get_id (void) const { return id
; }
85 explicit date_facet(::size_t a_ref
= 0)
86 : std::locale::facet(a_ref
),
87 //m_format(standard_format_specifier)
88 m_format(default_date_format
),
89 m_month_format(short_month_format
),
90 m_weekday_format(short_weekday_format
)
93 explicit date_facet(const char_type
* format_str
,
94 const input_collection_type
& short_names
,
95 ::size_t ref_count
= 0)
96 : std::locale::facet(ref_count
),
98 m_month_format(short_month_format
),
99 m_weekday_format(short_weekday_format
),
100 m_month_short_names(short_names
)
104 explicit date_facet(const char_type
* format_str
,
105 period_formatter_type per_formatter
= period_formatter_type(),
106 special_values_formatter_type sv_formatter
= special_values_formatter_type(),
107 date_gen_formatter_type dg_formatter
= date_gen_formatter_type(),
108 ::size_t ref_count
= 0)
109 : std::locale::facet(ref_count
),
110 m_format(format_str
),
111 m_month_format(short_month_format
),
112 m_weekday_format(short_weekday_format
),
113 m_period_formatter(per_formatter
),
114 m_date_gen_formatter(dg_formatter
),
115 m_special_values_formatter(sv_formatter
)
117 void format(const char_type
* const format_str
) {
118 m_format
= format_str
;
120 virtual void set_iso_format()
122 m_format
= iso_format_specifier
;
124 virtual void set_iso_extended_format()
126 m_format
= iso_format_extended_specifier
;
128 void month_format(const char_type
* const format_str
) {
129 m_month_format
= format_str
;
131 void weekday_format(const char_type
* const format_str
) {
132 m_weekday_format
= format_str
;
135 void period_formatter(period_formatter_type per_formatter
) {
136 m_period_formatter
= per_formatter
;
138 void special_values_formatter(const special_values_formatter_type
& svf
)
140 m_special_values_formatter
= svf
;
142 void short_weekday_names(const input_collection_type
& short_names
)
144 m_weekday_short_names
= short_names
;
146 void long_weekday_names(const input_collection_type
& long_names
)
148 m_weekday_long_names
= long_names
;
151 void short_month_names(const input_collection_type
& short_names
)
153 m_month_short_names
= short_names
;
156 void long_month_names(const input_collection_type
& long_names
)
158 m_month_long_names
= long_names
;
161 void date_gen_phrase_strings(const input_collection_type
& new_strings
,
162 typename
date_gen_formatter_type::phrase_elements beg_pos
=date_gen_formatter_type::first
)
164 m_date_gen_formatter
.elements(new_strings
, beg_pos
);
167 OutItrT
put(OutItrT next
,
168 std::ios_base
& a_ios
,
170 const date_type
& d
) const
172 if (d
.is_special()) {
173 return do_put_special(next
, a_ios
, fill_char
, d
.as_special());
175 //The following line of code required the date to support a to_tm function
176 return do_put_tm(next
, a_ios
, fill_char
, to_tm(d
), m_format
);
179 OutItrT
put(OutItrT next
,
180 std::ios_base
& a_ios
,
182 const duration_type
& dd
) const
184 if (dd
.is_special()) {
185 return do_put_special(next
, a_ios
, fill_char
, dd
.get_rep().as_special());
188 typedef std::num_put
<CharT
, OutItrT
> num_put
;
189 if (std::has_facet
<num_put
>(a_ios
.getloc())) {
190 return std::use_facet
<num_put
>(a_ios
.getloc()).put(next
, a_ios
, fill_char
, dd
.get_rep().as_number());
193 num_put
* f
= new num_put();
194 std::locale l
= std::locale(a_ios
.getloc(), f
);
196 return f
->put(next
, a_ios
, fill_char
, dd
.get_rep().as_number());
202 OutItrT
put(OutItrT next
,
203 std::ios_base
& a_ios
,
205 const month_type
& m
) const
207 //if (d.is_special()) {
208 // return do_put_special(next, a_ios, fill_char, d.as_special());
210 //The following line of code required the date to support a to_tm function
214 return do_put_tm(next
, a_ios
, fill_char
, dtm
, m_month_format
);
217 //! puts the day of month
218 OutItrT
put(OutItrT next
,
219 std::ios_base
& a_ios
,
221 const day_type
& day
) const
225 dtm
.tm_mday
= day
.as_number();
226 char_type tmp
[3] = {'%','d'};
227 string_type
temp_format(tmp
);
228 return do_put_tm(next
, a_ios
, fill_char
, dtm
, temp_format
);
231 OutItrT
put(OutItrT next
,
232 std::ios_base
& a_ios
,
234 const day_of_week_type
& dow
) const
236 //if (d.is_special()) {
237 // return do_put_special(next, a_ios, fill_char, d.as_special());
239 //The following line of code required the date to support a to_tm function
243 return do_put_tm(next
, a_ios
, fill_char
, dtm
, m_weekday_format
);
247 OutItrT
put(OutItrT next
,
248 std::ios_base
& a_ios
,
250 const period_type
& p
) const
252 return m_period_formatter
.put_period(next
, a_ios
, fill_char
, p
, *this);
255 OutItrT
put(OutItrT next
,
256 std::ios_base
& a_ios
,
258 const partial_date_type
& pd
) const
260 return m_date_gen_formatter
.put_partial_date(next
, a_ios
, fill_char
, pd
, *this);
263 OutItrT
put(OutItrT next
,
264 std::ios_base
& a_ios
,
266 const nth_kday_type
& nkd
) const
268 return m_date_gen_formatter
.put_nth_kday(next
, a_ios
, fill_char
, nkd
, *this);
271 OutItrT
put(OutItrT next
,
272 std::ios_base
& a_ios
,
274 const first_kday_type
& fkd
) const
276 return m_date_gen_formatter
.put_first_kday(next
, a_ios
, fill_char
, fkd
, *this);
279 OutItrT
put(OutItrT next
,
280 std::ios_base
& a_ios
,
282 const last_kday_type
& lkd
) const
284 return m_date_gen_formatter
.put_last_kday(next
, a_ios
, fill_char
, lkd
, *this);
287 OutItrT
put(OutItrT next
,
288 std::ios_base
& a_ios
,
290 const kday_before_type
& fkb
) const
292 return m_date_gen_formatter
.put_kday_before(next
, a_ios
, fill_char
, fkb
, *this);
295 OutItrT
put(OutItrT next
,
296 std::ios_base
& a_ios
,
298 const kday_after_type
& fka
) const
300 return m_date_gen_formatter
.put_kday_after(next
, a_ios
, fill_char
, fka
, *this);
304 //! Helper function to initialize all fields in a tm struct
305 tm
init_tm(tm
& tm_value
) const
307 tm_value
.tm_sec
= 0; /* seconds */
308 tm_value
.tm_min
= 0; /* minutes */
309 tm_value
.tm_hour
= 0; /* hours */
310 tm_value
.tm_mday
= 0; /* day of the month */
311 tm_value
.tm_mon
= 0; /* month */
312 tm_value
.tm_year
= 0; /* year */
313 tm_value
.tm_wday
= 0; /* day of the week */
314 tm_value
.tm_yday
= 0; /* day in the year */
315 tm_value
.tm_isdst
= 0; /* daylight saving time */
318 virtual OutItrT
do_put_special(OutItrT next
,
319 std::ios_base
& /*a_ios*/,
320 char_type
/*fill_char*/,
321 const boost::date_time::special_values sv
) const
323 m_special_values_formatter
.put_special(next
, sv
);
326 virtual OutItrT
do_put_tm(OutItrT next
,
327 std::ios_base
& a_ios
,
330 string_type a_format
) const
332 // update format string with custom names
333 if (m_weekday_long_names
.size()) {
334 boost::algorithm::replace_all(a_format
,
336 m_weekday_long_names
[tm_value
.tm_wday
]);
338 if (m_weekday_short_names
.size()) {
339 boost::algorithm::replace_all(a_format
,
340 short_weekday_format
,
341 m_weekday_short_names
[tm_value
.tm_wday
]);
344 if (m_month_long_names
.size()) {
345 boost::algorithm::replace_all(a_format
,
347 m_month_long_names
[tm_value
.tm_mon
]);
349 if (m_month_short_names
.size()) {
350 boost::algorithm::replace_all(a_format
,
352 m_month_short_names
[tm_value
.tm_mon
]);
354 // use time_put facet to create final string
355 const char_type
* p_format
= a_format
.c_str();
356 return std::use_facet
<std::time_put
<CharT
> >(a_ios
.getloc()).put(next
, a_ios
,
360 p_format
+ a_format
.size());
363 string_type m_format
;
364 string_type m_month_format
;
365 string_type m_weekday_format
;
366 period_formatter_type m_period_formatter
;
367 date_gen_formatter_type m_date_gen_formatter
;
368 special_values_formatter_type m_special_values_formatter
;
369 input_collection_type m_month_short_names
;
370 input_collection_type m_month_long_names
;
371 input_collection_type m_weekday_short_names
;
372 input_collection_type m_weekday_long_names
;
376 template <class date_type
, class CharT
, class OutItrT
>
377 std::locale::id date_facet
<date_type
, CharT
, OutItrT
>::id
;
379 template <class date_type
, class CharT
, class OutItrT
>
380 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
381 date_facet
<date_type
, CharT
, OutItrT
>::long_weekday_format
[3] = {'%','A'};
383 template <class date_type
, class CharT
, class OutItrT
>
384 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
385 date_facet
<date_type
, CharT
, OutItrT
>::short_weekday_format
[3] = {'%','a'};
387 template <class date_type
, class CharT
, class OutItrT
>
388 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
389 date_facet
<date_type
, CharT
, OutItrT
>::long_month_format
[3] = {'%','B'};
391 template <class date_type
, class CharT
, class OutItrT
>
392 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
393 date_facet
<date_type
, CharT
, OutItrT
>::short_month_format
[3] = {'%','b'};
395 template <class date_type
, class CharT
, class OutItrT
>
396 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
397 date_facet
<date_type
, CharT
, OutItrT
>::default_period_separator
[4] = { ' ', '/', ' '};
399 template <class date_type
, class CharT
, class OutItrT
>
400 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
401 date_facet
<date_type
, CharT
, OutItrT
>::standard_format_specifier
[3] =
404 template <class date_type
, class CharT
, class OutItrT
>
405 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
406 date_facet
<date_type
, CharT
, OutItrT
>::iso_format_specifier
[7] =
407 {'%', 'Y', '%', 'm', '%', 'd' };
409 template <class date_type
, class CharT
, class OutItrT
>
410 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
411 date_facet
<date_type
, CharT
, OutItrT
>::iso_format_extended_specifier
[9] =
412 {'%', 'Y', '-', '%', 'm', '-', '%', 'd' };
414 template <class date_type
, class CharT
, class OutItrT
>
415 const typename date_facet
<date_type
, CharT
, OutItrT
>::char_type
416 date_facet
<date_type
, CharT
, OutItrT
>::default_date_format
[9] =
417 {'%','Y','-','%','b','-','%','d'};
422 template <class date_type
,
424 class InItrT
= std::istreambuf_iterator
<CharT
, std::char_traits
<CharT
> > >
425 class date_input_facet
: public std::locale::facet
{
427 typedef typename
date_type::duration_type duration_type
;
428 // greg_weekday is gregorian_calendar::day_of_week_type
429 typedef typename
date_type::day_of_week_type day_of_week_type
;
430 typedef typename
date_type::day_type day_type
;
431 typedef typename
date_type::month_type month_type
;
432 typedef typename
date_type::year_type year_type
;
433 typedef boost::date_time::period
<date_type
,duration_type
> period_type
;
434 typedef std::basic_string
<CharT
> string_type
;
435 typedef CharT char_type
;
436 typedef boost::date_time::period_parser
<date_type
, CharT
> period_parser_type
;
437 typedef boost::date_time::special_values_parser
<date_type
,CharT
> special_values_parser_type
;
438 typedef std::vector
<std::basic_string
<CharT
> > input_collection_type
;
439 typedef format_date_parser
<date_type
, CharT
> format_date_parser_type
;
440 // date_generators stuff goes here
441 typedef date_generator_parser
<date_type
, CharT
> date_gen_parser_type
;
442 typedef partial_date
<date_type
> partial_date_type
;
443 typedef nth_kday_of_month
<date_type
> nth_kday_type
;
444 typedef first_kday_of_month
<date_type
> first_kday_type
;
445 typedef last_kday_of_month
<date_type
> last_kday_type
;
446 typedef first_kday_after
<date_type
> kday_after_type
;
447 typedef first_kday_before
<date_type
> kday_before_type
;
449 static const char_type long_weekday_format
[3];
450 static const char_type short_weekday_format
[3];
451 static const char_type long_month_format
[3];
452 static const char_type short_month_format
[3];
453 static const char_type four_digit_year_format
[3];
454 static const char_type two_digit_year_format
[3];
455 static const char_type default_period_separator
[4];
456 static const char_type standard_format_specifier
[3];
457 static const char_type iso_format_specifier
[7];
458 static const char_type iso_format_extended_specifier
[9];
459 static const char_type default_date_format
[9]; // YYYY-Mon-DD
460 static std::locale::id id
;
462 explicit date_input_facet(::size_t a_ref
= 0)
463 : std::locale::facet(a_ref
),
464 m_format(default_date_format
),
465 m_month_format(short_month_format
),
466 m_weekday_format(short_weekday_format
),
467 m_year_format(four_digit_year_format
),
468 m_parser(m_format
, std::locale::classic())
469 // default period_parser & special_values_parser used
472 explicit date_input_facet(const string_type
& format_str
,
474 : std::locale::facet(a_ref
),
475 m_format(format_str
),
476 m_month_format(short_month_format
),
477 m_weekday_format(short_weekday_format
),
478 m_year_format(four_digit_year_format
),
479 m_parser(m_format
, std::locale::classic())
480 // default period_parser & special_values_parser used
483 explicit date_input_facet(const string_type
& format_str
,
484 const format_date_parser_type
& date_parser
,
485 const special_values_parser_type
& sv_parser
,
486 const period_parser_type
& per_parser
,
487 const date_gen_parser_type
& date_gen_parser
,
488 ::size_t ref_count
= 0)
489 : std::locale::facet(ref_count
),
490 m_format(format_str
),
491 m_month_format(short_month_format
),
492 m_weekday_format(short_weekday_format
),
493 m_year_format(four_digit_year_format
),
494 m_parser(date_parser
),
495 m_date_gen_parser(date_gen_parser
),
496 m_period_parser(per_parser
),
497 m_sv_parser(sv_parser
)
501 void format(const char_type
* const format_str
) {
502 m_format
= format_str
;
504 virtual void set_iso_format()
506 m_format
= iso_format_specifier
;
508 virtual void set_iso_extended_format()
510 m_format
= iso_format_extended_specifier
;
512 void month_format(const char_type
* const format_str
) {
513 m_month_format
= format_str
;
515 void weekday_format(const char_type
* const format_str
) {
516 m_weekday_format
= format_str
;
518 void year_format(const char_type
* const format_str
) {
519 m_year_format
= format_str
;
522 void period_parser(period_parser_type per_parser
) {
523 m_period_parser
= per_parser
;
525 void short_weekday_names(const input_collection_type
& weekday_names
)
527 m_parser
.short_weekday_names(weekday_names
);
529 void long_weekday_names(const input_collection_type
& weekday_names
)
531 m_parser
.long_weekday_names(weekday_names
);
534 void short_month_names(const input_collection_type
& month_names
)
536 m_parser
.short_month_names(month_names
);
539 void long_month_names(const input_collection_type
& month_names
)
541 m_parser
.long_month_names(month_names
);
544 void date_gen_element_strings(const input_collection_type
& col
)
546 m_date_gen_parser
.element_strings(col
);
548 void date_gen_element_strings(const string_type
& first
,
549 const string_type
& second
,
550 const string_type
& third
,
551 const string_type
& fourth
,
552 const string_type
& fifth
,
553 const string_type
& last
,
554 const string_type
& before
,
555 const string_type
& after
,
556 const string_type
& of
)
559 m_date_gen_parser
.element_strings(first
,second
,third
,fourth
,fifth
,last
,before
,after
,of
);
562 void special_values_parser(special_values_parser_type sv_parser
)
564 m_sv_parser
= sv_parser
;
567 InItrT
get(InItrT
& from
,
569 std::ios_base
& /*a_ios*/,
572 d
= m_parser
.parse_date(from
, to
, m_format
, m_sv_parser
);
575 InItrT
get(InItrT
& from
,
577 std::ios_base
& /*a_ios*/,
580 m
= m_parser
.parse_month(from
, to
, m_month_format
);
583 InItrT
get(InItrT
& from
,
585 std::ios_base
& /*a_ios*/,
586 day_of_week_type
& wd
) const
588 wd
= m_parser
.parse_weekday(from
, to
, m_weekday_format
);
591 //! Expects 1 or 2 digit day range: 1-31
592 InItrT
get(InItrT
& from
,
594 std::ios_base
& /*a_ios*/,
597 d
= m_parser
.parse_var_day_of_month(from
, to
);
600 InItrT
get(InItrT
& from
,
602 std::ios_base
& /*a_ios*/,
605 y
= m_parser
.parse_year(from
, to
, m_year_format
);
608 InItrT
get(InItrT
& from
,
610 std::ios_base
& a_ios
,
611 duration_type
& dd
) const
613 // skip leading whitespace
614 while(std::isspace(*from
) && from
!= to
) { ++from
; }
616 /* num_get.get() will always consume the first character if it
617 * is a sign indicator (+/-). Special value strings may begin
618 * with one of these signs so we'll need a copy of it
619 * in case num_get.get() fails. */
621 // TODO Are these characters somewhere in the locale?
622 if(*from
== '-' || *from
== '+') {
625 typedef std::num_get
<CharT
, InItrT
> num_get
;
626 typename
duration_type::duration_rep_type val
= 0;
627 std::ios_base::iostate err
= std::ios_base::goodbit
;
629 if (std::has_facet
<num_get
>(a_ios
.getloc())) {
630 from
= std::use_facet
<num_get
>(a_ios
.getloc()).get(from
, to
, a_ios
, err
, val
);
633 num_get
* ng
= new num_get();
634 std::locale l
= std::locale(a_ios
.getloc(), ng
);
636 from
= ng
->get(from
, to
, a_ios
, err
, val
);
638 if(err
& std::ios_base::failbit
){
639 typedef typename
special_values_parser_type::match_results match_results
;
641 if(c
== '-' || c
== '+') { // was the first character consumed?
644 m_sv_parser
.match(from
, to
, mr
);
645 if(mr
.current_match
== match_results::PARSE_ERROR
) {
646 boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr
.cache
+ "'"));
647 BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return from
); // should never reach
649 dd
= duration_type(static_cast<special_values
>(mr
.current_match
));
652 dd
= duration_type(val
);
656 InItrT
get(InItrT
& from
,
658 std::ios_base
& a_ios
,
659 period_type
& p
) const
661 p
= m_period_parser
.get_period(from
, to
, a_ios
, p
, duration_type::unit(), *this);
664 InItrT
get(InItrT
& from
,
666 std::ios_base
& a_ios
,
667 nth_kday_type
& nkd
) const
669 nkd
= m_date_gen_parser
.get_nth_kday_type(from
, to
, a_ios
, *this);
672 InItrT
get(InItrT
& from
,
674 std::ios_base
& a_ios
,
675 partial_date_type
& pd
) const
678 pd
= m_date_gen_parser
.get_partial_date_type(from
, to
, a_ios
, *this);
681 InItrT
get(InItrT
& from
,
683 std::ios_base
& a_ios
,
684 first_kday_type
& fkd
) const
686 fkd
= m_date_gen_parser
.get_first_kday_type(from
, to
, a_ios
, *this);
689 InItrT
get(InItrT
& from
,
691 std::ios_base
& a_ios
,
692 last_kday_type
& lkd
) const
694 lkd
= m_date_gen_parser
.get_last_kday_type(from
, to
, a_ios
, *this);
697 InItrT
get(InItrT
& from
,
699 std::ios_base
& a_ios
,
700 kday_before_type
& fkb
) const
702 fkb
= m_date_gen_parser
.get_kday_before_type(from
, to
, a_ios
, *this);
705 InItrT
get(InItrT
& from
,
707 std::ios_base
& a_ios
,
708 kday_after_type
& fka
) const
710 fka
= m_date_gen_parser
.get_kday_after_type(from
, to
, a_ios
, *this);
715 string_type m_format
;
716 string_type m_month_format
;
717 string_type m_weekday_format
;
718 string_type m_year_format
;
719 format_date_parser_type m_parser
;
720 date_gen_parser_type m_date_gen_parser
;
721 period_parser_type m_period_parser
;
722 special_values_parser_type m_sv_parser
;
727 template <class date_type
, class CharT
, class OutItrT
>
728 std::locale::id date_input_facet
<date_type
, CharT
, OutItrT
>::id
;
730 template <class date_type
, class CharT
, class OutItrT
>
731 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
732 date_input_facet
<date_type
, CharT
, OutItrT
>::long_weekday_format
[3] = {'%','A'};
734 template <class date_type
, class CharT
, class OutItrT
>
735 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
736 date_input_facet
<date_type
, CharT
, OutItrT
>::short_weekday_format
[3] = {'%','a'};
738 template <class date_type
, class CharT
, class OutItrT
>
739 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
740 date_input_facet
<date_type
, CharT
, OutItrT
>::long_month_format
[3] = {'%','B'};
742 template <class date_type
, class CharT
, class OutItrT
>
743 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
744 date_input_facet
<date_type
, CharT
, OutItrT
>::short_month_format
[3] = {'%','b'};
746 template <class date_type
, class CharT
, class OutItrT
>
747 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
748 date_input_facet
<date_type
, CharT
, OutItrT
>::four_digit_year_format
[3] = {'%','Y'};
750 template <class date_type
, class CharT
, class OutItrT
>
751 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
752 date_input_facet
<date_type
, CharT
, OutItrT
>::two_digit_year_format
[3] = {'%','y'};
754 template <class date_type
, class CharT
, class OutItrT
>
755 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
756 date_input_facet
<date_type
, CharT
, OutItrT
>::default_period_separator
[4] = { ' ', '/', ' '};
758 template <class date_type
, class CharT
, class OutItrT
>
759 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
760 date_input_facet
<date_type
, CharT
, OutItrT
>::standard_format_specifier
[3] =
763 template <class date_type
, class CharT
, class OutItrT
>
764 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
765 date_input_facet
<date_type
, CharT
, OutItrT
>::iso_format_specifier
[7] =
766 {'%', 'Y', '%', 'm', '%', 'd' };
768 template <class date_type
, class CharT
, class OutItrT
>
769 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
770 date_input_facet
<date_type
, CharT
, OutItrT
>::iso_format_extended_specifier
[9] =
771 {'%', 'Y', '-', '%', 'm', '-', '%', 'd' };
773 template <class date_type
, class CharT
, class OutItrT
>
774 const typename date_input_facet
<date_type
, CharT
, OutItrT
>::char_type
775 date_input_facet
<date_type
, CharT
, OutItrT
>::default_date_format
[9] =
776 {'%','Y','-','%','b','-','%','d'};