18#ifndef _STLP_TIME_FACETS_C
19#define _STLP_TIME_FACETS_C
21#ifndef _STLP_INTERNAL_TIME_FACETS_H
25#ifndef _STLP_INTERNAL_NUM_PUT_H
29#ifndef _STLP_INTERNAL_NUM_GET_H
38template <
class _CharT,
class _InputIterator>
41template <
class _CharT,
class _OutputIterator>
76template <
class _InIt,
class _NameIt>
78__match(_InIt& __first, _InIt&
__last, _NameIt __name, _NameIt __name_end) {
80 difference_type
__n = __name_end - __name;
81 difference_type __i, __start = 0;
83 difference_type __check_count =
__n;
85 size_t __matching_name_index =
__n;
87 memset(__do_not_check, 0,
sizeof(__do_not_check));
89 while (__first !=
__last) {
90 difference_type __new_n =
__n;
91 for (__i = __start; __i <
__n; ++__i) {
92 if (!__do_not_check[__i]) {
93 if (*__first == __name[__i][__pos]) {
94 if (__pos == (__name[__i].
size() - 1)) {
95 __matching_name_index = __i;
96 __do_not_check[__i] =
true;
97 if (__i == __start) ++__start;
99 if (__check_count == 0) {
101 return __matching_name_index;
107 __do_not_check[__i] =
true;
108 if (__i == __start) ++__start;
110 if (__check_count == 0)
111 return __matching_name_index;
115 if (__i == __start) ++ __start;
123 return __matching_name_index;
147template <
class _InIt1,
class _Ch,
class _TimeInfo>
150 string::const_iterator __format, string::const_iterator __format_end,
151 _Ch*,
const _TimeInfo& __table,
157 while (__first !=
__last && __format != __format_end) {
159 if (*__format ==
'%') {
161 char __c = *__format;
172 __table._M_dayname +
offset, __table._M_dayname +
offset + 7);
183 __table._M_monthname +
offset, __table._M_monthname +
offset + 12);
193 __err |= ios_base::failbit;
199 case 'H':
case 'I': {
217 __err |= ios_base::failbit;
232 __table._M_am_pm + 0, __table._M_am_pm + 2);
236 if (__index == 1 && __t->
tm_hour != 12 )
238 if (__index == 0 && __t->
tm_hour == 12 )
270 if (*__first++ != __ct.widen(*__format))
break;
279template <
class _InIt,
class _TimeInfo>
282 size_t __index =
__match(__first,
__last, __table._M_dayname + 0, __table._M_dayname + 14);
290template <
class _InIt,
class _TimeInfo>
293 size_t __index =
__match(__first,
__last, __table._M_monthname + 0, __table._M_monthname + 24);
303template <
class _Ch,
class _InIt>
308 typedef string::const_iterator string_iterator;
310 string_iterator __format = this->_M_timeinfo._M_date_format.begin();
311 string_iterator __format_end = this->_M_timeinfo._M_date_format.end();
313 string_iterator __result
314 =
_STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
317 if (__result == __format_end)
318 __err = ios_base::goodbit;
320 __err = ios_base::failbit;
322 __err |= ios_base::eofbit;
327template <
class _Ch,
class _InIt>
332 typedef string::const_iterator string_iterator;
333 string_iterator __format = this->_M_timeinfo._M_time_format.begin();
334 string_iterator __format_end = this->_M_timeinfo._M_time_format.end();
336 string_iterator __result
337 =
_STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
340 __err = __result == __format_end ? ios_base::goodbit
343 __err |= ios_base::eofbit;
347template <
class _Ch,
class _InIt>
353 __err = ios_base::failbit | ios_base::eofbit;
359 __err = __pr ? ios_base::goodbit : ios_base::failbit;
361 __err |= ios_base::eofbit;
366template <
class _Ch,
class _InIt>
374 __err = ios_base::goodbit;
376 __err = ios_base::failbit;
378 __err |= ios_base::eofbit;
383template <
class _Ch,
class _InIt>
391 __err = ios_base::goodbit;
393 __err = ios_base::failbit;
395 __err |= ios_base::eofbit;
400template<
class _Ch,
class _OutputIter>
403 const tm* __tmb,
const _Ch* __pat,
404 const _Ch* __pat_end)
const {
406 while (__pat != __pat_end) {
407 char __c = _Ct.narrow(*__pat, 0);
411 __c = _Ct.narrow(*__pat++, 0);
414 __c = _Ct.narrow(*__pat++, 0);
416 __s = do_put(__s, __f,
__fill, __tmb,
__c, __mod);
424template<
class _Ch,
class _OutputIter>
427 const tm* __tmb,
char __format,
428 char __modifier )
const {
432 return copy(__buf.begin(), __buf.end(), __s);
_STLP_INLINE_LOOP _InputIter __last
void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val, const input_iterator_tag &, _Distance *)
#define _STLP_BASIC_IOSTRING(_CharT)
bool _STLP_CALL __get_decimal_integer(_InputIter &__first, _InputIter &__last, _Integer &__val, _CharT *)
bool _STLP_CALL __get_short_or_long_dayname(_InIt &__first, _InIt &__last, const _TimeInfo &__table, tm *__t)
size_t _STLP_CALL __match(_InIt &__first, _InIt &__last, _NameIt __name, _NameIt __name_end)
bool _STLP_CALL __get_short_or_long_monthname(_InIt &__first, _InIt &__last, const _TimeInfo &__table, tm *__t)
_STLP_MOVE_TO_PRIV_NAMESPACE _STLP_DECLSPEC void _STLP_CALL __write_formatted_time(__iostring &, const ctype< char > &__ct, char __format, char __modifier, const _Time_Info &__table, const tm *__t)
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
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_year(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_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_put(iter_type __s, ios_base &__f, char_type, const tm *__tmb, char __format, char) const
_OutIt put(iter_type __s, ios_base &__f, _Ch __fill, const tm *__tmb, const _Ch *__pat, const _Ch *__pat_end) const
__kernel_ptrdiff_t ptrdiff_t
#define _STLP_MOVE_TO_STD_NAMESPACE
#define __STATIC_CAST(__x, __y)
#define _STLP_BEGIN_NAMESPACE
#define _STLP_END_NAMESPACE
#define _STLP_MOVE_TO_PRIV_NAMESPACE
_Check_return_ wchar_t _Ch