mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-22 13:44:52 +08:00
time_members_gnu.h (__timepunct::_M_get_helper): Add.
2001-09-28 Benjamin Kosnik <bkoz@redhat.com> * config/locale/time_members_gnu.h (__timepunct::_M_get_helper): Add. (__timepunct::_M_put_helper): Add. * config/locale/time_members_generic.h: Same. * include/bits/locale_facets.h (__match_parallel): Remove. Format. (__timepunct): Add data members. (__timepunct::_M_days): Add. (__timepunct::_M_days_abbreviated): Add. (__timepunct::_M_months): Add. (__timepunct::_M_months_abbreviated): Add. (__timepunct::_M_initialize_timepunct): Add. * include/bits/locale_facets.tcc: Same. * src/locale-inst.cc: Remove instantiations for __match_parallel. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add CTIME_CC. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/22_locale/time_put_members_char.cc: Mark XFAIL. * testsuite/22_locale/time_put_members_char.cc (test01): New file. * testsuite/22_locale/time_get.cc: New file. From-SVN: r45868
This commit is contained in:
parent
5bc1087737
commit
1ab656771a
@ -1,3 +1,24 @@
|
||||
2001-09-28 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* config/locale/time_members_gnu.h (__timepunct::_M_get_helper): Add.
|
||||
(__timepunct::_M_put_helper): Add.
|
||||
* config/locale/time_members_generic.h: Same.
|
||||
* include/bits/locale_facets.h (__match_parallel): Remove. Format.
|
||||
(__timepunct): Add data members.
|
||||
(__timepunct::_M_days): Add.
|
||||
(__timepunct::_M_days_abbreviated): Add.
|
||||
(__timepunct::_M_months): Add.
|
||||
(__timepunct::_M_months_abbreviated): Add.
|
||||
(__timepunct::_M_initialize_timepunct): Add.
|
||||
* include/bits/locale_facets.tcc: Same.
|
||||
* src/locale-inst.cc: Remove instantiations for __match_parallel.
|
||||
* acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add CTIME_CC.
|
||||
* aclocal.m4: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* testsuite/22_locale/time_put_members_char.cc: Mark XFAIL.
|
||||
* testsuite/22_locale/time_put_members_char.cc (test01): New file.
|
||||
* testsuite/22_locale/time_get.cc: New file.
|
||||
|
||||
2001-09-28 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
|
||||
|
||||
* testsuite/lib/libstdc++-v3-dg.exp (libstdc++-v3-init): Use
|
||||
|
@ -1064,6 +1064,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
|
||||
CTIME_H=config/locale/time_members_generic.h
|
||||
CTIME_CC=config/locale/time_members_generic.cc
|
||||
;;
|
||||
xgnu)
|
||||
AC_MSG_RESULT(gnu)
|
||||
@ -1093,6 +1094,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
|
||||
CNUMERIC_CC=config/locale/numpunct_members_gnu.cc
|
||||
CTIME_H=config/locale/time_members_gnu.h
|
||||
CTIME_CC=config/locale/time_members_gnu.cc
|
||||
;;
|
||||
xieee_1003.1)
|
||||
AC_MSG_RESULT(generic)
|
||||
@ -1109,6 +1111,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
|
||||
CTIME_H=config/locale/time_members_generic.h
|
||||
CTIME_CC=config/locale/time_members_generic.cc
|
||||
;;
|
||||
*)
|
||||
echo "$enable_clocale is an unknown locale package" 1>&2
|
||||
@ -1131,6 +1134,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
|
||||
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
|
||||
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
|
||||
AC_LINK_FILES($CTIME_CC, src/time.cc)
|
||||
])
|
||||
|
||||
|
||||
|
4
libstdc++-v3/aclocal.m4
vendored
4
libstdc++-v3/aclocal.m4
vendored
@ -1076,6 +1076,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
|
||||
CTIME_H=config/locale/time_members_generic.h
|
||||
CTIME_CC=config/locale/time_members_generic.cc
|
||||
;;
|
||||
xgnu)
|
||||
AC_MSG_RESULT(gnu)
|
||||
@ -1105,6 +1106,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
|
||||
CNUMERIC_CC=config/locale/numpunct_members_gnu.cc
|
||||
CTIME_H=config/locale/time_members_gnu.h
|
||||
CTIME_CC=config/locale/time_members_gnu.cc
|
||||
;;
|
||||
xieee_1003.1)
|
||||
AC_MSG_RESULT(generic)
|
||||
@ -1121,6 +1123,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||
CNUMERIC_CC=config/locale/numpunct_members_generic.cc
|
||||
CTIME_H=config/locale/time_members_generic.h
|
||||
CTIME_CC=config/locale/time_members_generic.cc
|
||||
;;
|
||||
*)
|
||||
echo "$enable_clocale is an unknown locale package" 1>&2
|
||||
@ -1143,6 +1146,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
||||
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
|
||||
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
|
||||
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
|
||||
AC_LINK_FILES($CTIME_CC, src/time.cc)
|
||||
])
|
||||
|
||||
|
||||
|
106
libstdc++-v3/config/locale/time_members_generic.cc
Normal file
106
libstdc++-v3/config/locale/time_members_generic.cc
Normal file
@ -0,0 +1,106 @@
|
||||
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
|
||||
// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
|
||||
//
|
||||
|
||||
// Written by Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
#include <locale>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
void
|
||||
__timepunct<char>::_M_initialize_timepunct(__c_locale)
|
||||
{
|
||||
// "C" locale
|
||||
_M_date_format = "%m/%d/%Y";
|
||||
_M_date_era_format = "%m/%d/%Y";
|
||||
_M_time_format = "%H:%M:%S";
|
||||
_M_time_era_format = "%H:%M:%S";
|
||||
_M_am = "AM";
|
||||
_M_pm = "PM";
|
||||
|
||||
// Day names, starting with "C"'s Sunday.
|
||||
_M_day1 = "Sunday";
|
||||
_M_day2 = "Monday";
|
||||
_M_day3 = "Tuesday";
|
||||
_M_day4 = "Wednesday";
|
||||
_M_day5 = "Thursday";
|
||||
_M_day6 = "Friday";
|
||||
_M_day7 = "Saturday";
|
||||
|
||||
// Abbreviated day names, starting with "C"'s Sun.
|
||||
_M_day_a1 = "Sun";
|
||||
_M_day_a2 = "Mon";
|
||||
_M_day_a3 = "Tue";
|
||||
_M_day_a4 = "Wed";
|
||||
_M_day_a5 = "Thu";
|
||||
_M_day_a6 = "Fri";
|
||||
_M_day_a7 = "Sat";
|
||||
|
||||
// Month names, starting with "C"'s January.
|
||||
_M_month01 = "January";
|
||||
_M_month02 = "February";
|
||||
_M_month03 = "March";
|
||||
_M_month04 = "April";
|
||||
_M_month05 = "May";
|
||||
_M_month06 = "June";
|
||||
_M_month07 = "July";
|
||||
_M_month08 = "August";
|
||||
_M_month09 = "September";
|
||||
_M_month10 = "October";
|
||||
_M_month11 = "November";
|
||||
_M_month12 = "December";
|
||||
|
||||
// Abbreviated month names, starting with "C"'s Jan.
|
||||
_M_month_a01 = "Jan";
|
||||
_M_month_a02 = "Feb";
|
||||
_M_month_a03 = "Mar";
|
||||
_M_month_a04 = "Apr";
|
||||
_M_month_a05 = "May";
|
||||
_M_month_a06 = "Jun";
|
||||
_M_month_a07 = "July";
|
||||
_M_month_a08 = "Aug";
|
||||
_M_month_a09 = "Sep";
|
||||
_M_month_a10 = "Oct";
|
||||
_M_month_a11 = "Nov";
|
||||
_M_month_a12 = "Dec";
|
||||
}
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
void
|
||||
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale)
|
||||
{ }
|
||||
#endif
|
||||
}
|
@ -36,10 +36,19 @@
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
__timepunct<_CharT>::_M_put_helper(char* __s, size_t __maxlen,
|
||||
const char* __format,
|
||||
__timepunct<_CharT>::
|
||||
_M_put_helper(char* __s, size_t __maxlen, const char* __format,
|
||||
const tm* __tm) const
|
||||
{
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
strftime(__s, __maxlen, __format, __tm);
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
__timepunct<_CharT>::
|
||||
_M_get_helper(const char*, const char*, tm*) const
|
||||
{
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
// strptime(__s, __format, __tm);
|
||||
}
|
||||
|
176
libstdc++-v3/config/locale/time_members_gnu.cc
Normal file
176
libstdc++-v3/config/locale/time_members_gnu.cc
Normal file
@ -0,0 +1,176 @@
|
||||
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
|
||||
// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
|
||||
//
|
||||
|
||||
// Written by Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
#include <locale>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
void
|
||||
__timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
|
||||
{
|
||||
if (!__cloc)
|
||||
{
|
||||
// "C" locale
|
||||
_M_date_format = "%m/%d/%Y";
|
||||
_M_date_era_format = "%m/%d/%Y";
|
||||
_M_time_format = "%H:%M:%S";
|
||||
_M_time_era_format = "%H:%M:%S";
|
||||
_M_am = "AM";
|
||||
_M_pm = "PM";
|
||||
|
||||
// Day names, starting with "C"'s Sunday.
|
||||
_M_day1 = "Sunday";
|
||||
_M_day2 = "Monday";
|
||||
_M_day3 = "Tuesday";
|
||||
_M_day4 = "Wednesday";
|
||||
_M_day5 = "Thursday";
|
||||
_M_day6 = "Friday";
|
||||
_M_day7 = "Saturday";
|
||||
|
||||
// Abbreviated day names, starting with "C"'s Sun.
|
||||
_M_day_a1 = "Sun";
|
||||
_M_day_a2 = "Mon";
|
||||
_M_day_a3 = "Tue";
|
||||
_M_day_a4 = "Wed";
|
||||
_M_day_a5 = "Thu";
|
||||
_M_day_a6 = "Fri";
|
||||
_M_day_a7 = "Sat";
|
||||
|
||||
// Month names, starting with "C"'s January.
|
||||
_M_month01 = "January";
|
||||
_M_month02 = "February";
|
||||
_M_month03 = "March";
|
||||
_M_month04 = "April";
|
||||
_M_month05 = "May";
|
||||
_M_month06 = "June";
|
||||
_M_month07 = "July";
|
||||
_M_month08 = "August";
|
||||
_M_month09 = "September";
|
||||
_M_month10 = "October";
|
||||
_M_month11 = "November";
|
||||
_M_month12 = "December";
|
||||
|
||||
// Abbreviated month names, starting with "C"'s Jan.
|
||||
_M_month_a01 = "Jan";
|
||||
_M_month_a02 = "Feb";
|
||||
_M_month_a03 = "Mar";
|
||||
_M_month_a04 = "Apr";
|
||||
_M_month_a05 = "May";
|
||||
_M_month_a06 = "Jun";
|
||||
_M_month_a07 = "July";
|
||||
_M_month_a08 = "Aug";
|
||||
_M_month_a09 = "Sep";
|
||||
_M_month_a10 = "Oct";
|
||||
_M_month_a11 = "Nov";
|
||||
_M_month_a12 = "Dec";
|
||||
}
|
||||
else
|
||||
{
|
||||
_M_c_locale_timepunct = _S_clone_c_locale(__cloc);
|
||||
|
||||
_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
|
||||
_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
|
||||
_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
|
||||
_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
|
||||
_M_am = __nl_langinfo_l(AM_STR, __cloc);
|
||||
_M_pm = __nl_langinfo_l(PM_STR, __cloc);
|
||||
|
||||
// Day names, starting with "C"'s Sunday.
|
||||
_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
|
||||
_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
|
||||
_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
|
||||
_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
|
||||
_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
|
||||
_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
|
||||
_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
|
||||
|
||||
// Abbreviated day names, starting with "C"'s Sun.
|
||||
_M_day_a1 = __nl_langinfo_l(ABDAY_1, __cloc);
|
||||
_M_day_a2 = __nl_langinfo_l(ABDAY_2, __cloc);
|
||||
_M_day_a3 = __nl_langinfo_l(ABDAY_3, __cloc);
|
||||
_M_day_a4 = __nl_langinfo_l(ABDAY_4, __cloc);
|
||||
_M_day_a5 = __nl_langinfo_l(ABDAY_5, __cloc);
|
||||
_M_day_a6 = __nl_langinfo_l(ABDAY_6, __cloc);
|
||||
_M_day_a7 = __nl_langinfo_l(ABDAY_7, __cloc);
|
||||
|
||||
// Month names, starting with "C"'s January.
|
||||
_M_month01 = __nl_langinfo_l(MON_1, __cloc);
|
||||
_M_month02 = __nl_langinfo_l(MON_2, __cloc);
|
||||
_M_month03 = __nl_langinfo_l(MON_3, __cloc);
|
||||
_M_month04 = __nl_langinfo_l(MON_4, __cloc);
|
||||
_M_month05 = __nl_langinfo_l(MON_5, __cloc);
|
||||
_M_month06 = __nl_langinfo_l(MON_6, __cloc);
|
||||
_M_month07 = __nl_langinfo_l(MON_7, __cloc);
|
||||
_M_month08 = __nl_langinfo_l(MON_8, __cloc);
|
||||
_M_month09 = __nl_langinfo_l(MON_9, __cloc);
|
||||
_M_month10 = __nl_langinfo_l(MON_10, __cloc);
|
||||
_M_month11 = __nl_langinfo_l(MON_11, __cloc);
|
||||
_M_month12 = __nl_langinfo_l(MON_12, __cloc);
|
||||
|
||||
// Abbreviated month names, starting with "C"'s Jan.
|
||||
_M_month_a01 = __nl_langinfo_l(ABMON_1, __cloc);
|
||||
_M_month_a02 = __nl_langinfo_l(ABMON_2, __cloc);
|
||||
_M_month_a03 = __nl_langinfo_l(ABMON_3, __cloc);
|
||||
_M_month_a04 = __nl_langinfo_l(ABMON_4, __cloc);
|
||||
_M_month_a05 = __nl_langinfo_l(ABMON_5, __cloc);
|
||||
_M_month_a06 = __nl_langinfo_l(ABMON_6, __cloc);
|
||||
_M_month_a07 = __nl_langinfo_l(ABMON_7, __cloc);
|
||||
_M_month_a08 = __nl_langinfo_l(ABMON_8, __cloc);
|
||||
_M_month_a09 = __nl_langinfo_l(ABMON_9, __cloc);
|
||||
_M_month_a10 = __nl_langinfo_l(ABMON_10, __cloc);
|
||||
_M_month_a11 = __nl_langinfo_l(ABMON_11, __cloc);
|
||||
_M_month_a12 = __nl_langinfo_l(ABMON_12, __cloc);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
void
|
||||
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
|
||||
{
|
||||
if (!__cloc)
|
||||
{
|
||||
// "C" locale
|
||||
}
|
||||
else
|
||||
{
|
||||
_M_c_locale_timepunct = _S_clone_c_locale(__cloc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -36,8 +36,8 @@
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
__timepunct<_CharT>::_M_put_helper(char* __s, size_t __maxlen,
|
||||
const char* __format,
|
||||
__timepunct<_CharT>::
|
||||
_M_put_helper(char* __s, size_t __maxlen, const char* __format,
|
||||
const tm* __tm) const
|
||||
{
|
||||
#if 0
|
||||
@ -49,5 +49,22 @@
|
||||
#else
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
strftime(__s, __maxlen, __format, __tm);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
__timepunct<_CharT>::
|
||||
_M_get_helper(const char* __s, const char* __format, tm* __tm) const
|
||||
{
|
||||
#if 0
|
||||
// Requires glibc 2.3
|
||||
if (_M_c_locale_timepunct)
|
||||
__strptime_l(__s, _M_c_locale_timepunct, __format, __tm);
|
||||
else
|
||||
strptime(__s, __format, __tm);
|
||||
#else
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
strptime(__s, __format, __tm);
|
||||
#endif
|
||||
}
|
||||
|
1676
libstdc++-v3/configure
vendored
1676
libstdc++-v3/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -900,12 +900,11 @@ namespace std
|
||||
template<typename _CharT>
|
||||
locale::id numpunct<_CharT>::id;
|
||||
|
||||
// NB: Cannot be made generic.
|
||||
template<typename _CharT>
|
||||
void
|
||||
numpunct<_CharT>::_M_initialize_numpunct(__c_locale /*__cloc*/)
|
||||
{
|
||||
// NB: Cannot be made generic.
|
||||
}
|
||||
numpunct<_CharT>::_M_initialize_numpunct(__c_locale)
|
||||
{ }
|
||||
|
||||
template<>
|
||||
void
|
||||
@ -1064,40 +1063,155 @@ namespace std
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<_CharT> string_type;
|
||||
typedef _CharT __char_type;
|
||||
typedef basic_string<_CharT> __string_type;
|
||||
|
||||
static locale::id id;
|
||||
|
||||
// List of all known timezones, with GMT first.
|
||||
static const _CharT* _S_timezones[14];
|
||||
|
||||
protected:
|
||||
__c_locale _M_c_locale_timepunct;
|
||||
#if 1
|
||||
// Only needed if glibc < 2.3
|
||||
const char* _M_name_timepunct;
|
||||
#endif
|
||||
const _CharT* _M_date_format;
|
||||
const _CharT* _M_date_era_format;
|
||||
const _CharT* _M_time_format;
|
||||
const _CharT* _M_time_era_format;
|
||||
const _CharT* _M_am;
|
||||
const _CharT* _M_pm;
|
||||
|
||||
// Day names, starting with "C"'s Sunday.
|
||||
const _CharT* _M_day1;
|
||||
const _CharT* _M_day2;
|
||||
const _CharT* _M_day3;
|
||||
const _CharT* _M_day4;
|
||||
const _CharT* _M_day5;
|
||||
const _CharT* _M_day6;
|
||||
const _CharT* _M_day7;
|
||||
|
||||
// Abbreviated day names, starting with "C"'s Sun.
|
||||
const _CharT* _M_day_a1;
|
||||
const _CharT* _M_day_a2;
|
||||
const _CharT* _M_day_a3;
|
||||
const _CharT* _M_day_a4;
|
||||
const _CharT* _M_day_a5;
|
||||
const _CharT* _M_day_a6;
|
||||
const _CharT* _M_day_a7;
|
||||
|
||||
// Month names, starting with "C"'s January.
|
||||
const _CharT* _M_month01;
|
||||
const _CharT* _M_month02;
|
||||
const _CharT* _M_month03;
|
||||
const _CharT* _M_month04;
|
||||
const _CharT* _M_month05;
|
||||
const _CharT* _M_month06;
|
||||
const _CharT* _M_month07;
|
||||
const _CharT* _M_month08;
|
||||
const _CharT* _M_month09;
|
||||
const _CharT* _M_month10;
|
||||
const _CharT* _M_month11;
|
||||
const _CharT* _M_month12;
|
||||
|
||||
// Abbreviated month names, starting with "C"'s Jan.
|
||||
const _CharT* _M_month_a01;
|
||||
const _CharT* _M_month_a02;
|
||||
const _CharT* _M_month_a03;
|
||||
const _CharT* _M_month_a04;
|
||||
const _CharT* _M_month_a05;
|
||||
const _CharT* _M_month_a06;
|
||||
const _CharT* _M_month_a07;
|
||||
const _CharT* _M_month_a08;
|
||||
const _CharT* _M_month_a09;
|
||||
const _CharT* _M_month_a10;
|
||||
const _CharT* _M_month_a11;
|
||||
const _CharT* _M_month_a12;
|
||||
|
||||
public:
|
||||
explicit
|
||||
__timepunct(size_t __refs = 0)
|
||||
: locale::facet(__refs), _M_c_locale_timepunct(NULL),
|
||||
_M_name_timepunct("C")
|
||||
{
|
||||
// _M_initialize_numpunct();
|
||||
}
|
||||
: locale::facet(__refs), _M_name_timepunct("C")
|
||||
{ _M_initialize_timepunct(); }
|
||||
|
||||
explicit
|
||||
__timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
|
||||
: locale::facet(__refs)
|
||||
{
|
||||
_M_name_timepunct = __s;
|
||||
if (__cloc)
|
||||
_M_c_locale_timepunct = _S_clone_c_locale(__cloc);
|
||||
}
|
||||
: locale::facet(__refs), _M_name_timepunct(__s)
|
||||
{ _M_initialize_timepunct(__cloc); }
|
||||
|
||||
void
|
||||
_M_put_helper(char* __s, size_t __maxlen, const char* __format,
|
||||
const tm* __tm) const;
|
||||
|
||||
// Not used, at the moment. Likely to be strptime-ish.
|
||||
void
|
||||
_M_get_helper(const char* __s, const char* __format, tm* __tm) const;
|
||||
|
||||
const _CharT*
|
||||
_M_date_formats() const
|
||||
{ return _M_date_format; }
|
||||
|
||||
const _CharT*
|
||||
_M_time_formats() const
|
||||
{ return _M_time_format; }
|
||||
|
||||
void
|
||||
_M_days(const _CharT** __days) const
|
||||
{
|
||||
__days[0] = _M_day1;
|
||||
__days[1] = _M_day2;
|
||||
__days[2] = _M_day3;
|
||||
__days[3] = _M_day4;
|
||||
__days[4] = _M_day5;
|
||||
__days[5] = _M_day6;
|
||||
__days[6] = _M_day7;
|
||||
}
|
||||
|
||||
void
|
||||
_M_days_abbreviated(const _CharT** __days) const
|
||||
{
|
||||
__days[0] = _M_day_a1;
|
||||
__days[1] = _M_day_a2;
|
||||
__days[2] = _M_day_a3;
|
||||
__days[3] = _M_day_a4;
|
||||
__days[4] = _M_day_a5;
|
||||
__days[5] = _M_day_a6;
|
||||
__days[6] = _M_day_a7;
|
||||
}
|
||||
|
||||
void
|
||||
_M_months(const _CharT** __months) const
|
||||
{
|
||||
__months[0] = _M_month01;
|
||||
__months[1] = _M_month02;
|
||||
__months[2] = _M_month03;
|
||||
__months[3] = _M_month04;
|
||||
__months[4] = _M_month05;
|
||||
__months[5] = _M_month06;
|
||||
__months[6] = _M_month07;
|
||||
__months[7] = _M_month08;
|
||||
__months[8] = _M_month09;
|
||||
__months[9] = _M_month10;
|
||||
__months[10] = _M_month11;
|
||||
__months[11] = _M_month12;
|
||||
}
|
||||
|
||||
void
|
||||
_M_months_abbreviated(const _CharT** __months) const
|
||||
{
|
||||
__months[0] = _M_month_a01;
|
||||
__months[1] = _M_month_a02;
|
||||
__months[2] = _M_month_a03;
|
||||
__months[3] = _M_month_a04;
|
||||
__months[4] = _M_month_a05;
|
||||
__months[5] = _M_month_a06;
|
||||
__months[6] = _M_month_a07;
|
||||
__months[7] = _M_month_a08;
|
||||
__months[8] = _M_month_a09;
|
||||
__months[9] = _M_month_a10;
|
||||
__months[10] = _M_month_a11;
|
||||
__months[11] = _M_month_a12;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual
|
||||
~__timepunct()
|
||||
@ -1105,11 +1219,43 @@ namespace std
|
||||
if (_M_c_locale_timepunct)
|
||||
_S_destroy_c_locale(_M_c_locale_timepunct);
|
||||
}
|
||||
|
||||
// For use at construction time only.
|
||||
void
|
||||
_M_initialize_timepunct(__c_locale __cloc = NULL);
|
||||
};
|
||||
|
||||
template<typename _CharT>
|
||||
locale::id __timepunct<_CharT>::id;
|
||||
|
||||
template<>
|
||||
const char*
|
||||
__timepunct<char>::_S_timezones[14];
|
||||
|
||||
// Generic.
|
||||
template<typename _CharT>
|
||||
const _CharT* __timepunct<_CharT>::_S_timezones[14];
|
||||
|
||||
// NB: Cannot be made generic.
|
||||
template<typename _CharT>
|
||||
void
|
||||
__timepunct<_CharT>::_M_initialize_timepunct(__c_locale)
|
||||
{ }
|
||||
|
||||
template<>
|
||||
void
|
||||
__timepunct<char>::_M_initialize_timepunct(__c_locale __cloc);
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
const wchar_t*
|
||||
__timepunct<wchar_t>::_S_timezones[14];
|
||||
|
||||
template<>
|
||||
void
|
||||
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc);
|
||||
#endif
|
||||
|
||||
template<typename _CharT, typename _InIter>
|
||||
class time_get : public locale::facet, public time_base
|
||||
{
|
||||
@ -1117,81 +1263,85 @@ namespace std
|
||||
// Types:
|
||||
typedef _CharT char_type;
|
||||
typedef _InIter iter_type;
|
||||
typedef basic_string<_CharT> __string_type;
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
mutable basic_string<_CharT>* _M_daynames;
|
||||
mutable basic_string<_CharT>* _M_monthnames;
|
||||
|
||||
public:
|
||||
explicit
|
||||
time_get(size_t __refs = 0)
|
||||
: locale::facet (__refs), _M_daynames(0), _M_monthnames(0) { }
|
||||
: locale::facet (__refs) { }
|
||||
|
||||
dateorder
|
||||
date_order() const
|
||||
{ return do_date_order(); }
|
||||
{ return this->do_date_order(); }
|
||||
|
||||
iter_type
|
||||
get_time(iter_type __s, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __t) const
|
||||
{ return do_get_time(__s, __end, __io, __err, __t); }
|
||||
get_time(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const
|
||||
{ return this->do_get_time(__beg, __end, __io, __err, __tm); }
|
||||
|
||||
iter_type
|
||||
get_date(iter_type __s, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __t) const
|
||||
{ return do_get_date(__s, __end, __io, __err, __t); }
|
||||
get_date(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const
|
||||
{ return this->do_get_date(__beg, __end, __io, __err, __tm); }
|
||||
|
||||
iter_type
|
||||
get_weekday(iter_type __s, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __t) const
|
||||
{ return this->do_get_weekday(__s, __end, __io, __err, __t); }
|
||||
get_weekday(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const
|
||||
{ return this->do_get_weekday(__beg, __end, __io, __err, __tm); }
|
||||
|
||||
iter_type
|
||||
get_monthname(iter_type __s, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __t) const
|
||||
{ return this->do_get_monthname(__s, __end, __io, __err, __t); }
|
||||
get_monthname(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const
|
||||
{ return this->do_get_monthname(__beg, __end, __io, __err, __tm); }
|
||||
|
||||
iter_type
|
||||
get_year(iter_type __s, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __t) const
|
||||
{ return this->do_get_year(__s, __end, __io, __err, __t); }
|
||||
get_year(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const
|
||||
{ return this->do_get_year(__beg, __end, __io, __err, __tm); }
|
||||
|
||||
protected:
|
||||
virtual
|
||||
~time_get()
|
||||
{
|
||||
delete [] _M_monthnames;
|
||||
delete [] _M_daynames;
|
||||
}
|
||||
~time_get() { }
|
||||
|
||||
virtual dateorder
|
||||
do_date_order() const
|
||||
{ return time_base::ymd; }
|
||||
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
|
||||
{ return __s; }
|
||||
do_get_time(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const;
|
||||
|
||||
virtual iter_type
|
||||
do_get_date(iter_type __s, iter_type /*__end*/, ios_base&,
|
||||
ios_base::iostate& /*__err*/, tm* /*__t*/) const
|
||||
{ return __s; }
|
||||
do_get_date(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const;
|
||||
|
||||
virtual iter_type
|
||||
do_get_weekday(iter_type __s, iter_type __end, ios_base&,
|
||||
ios_base::iostate& __err, tm* __t) const;
|
||||
do_get_weekday(iter_type __beg, iter_type __end, ios_base&,
|
||||
ios_base::iostate& __err, tm* __tm) const;
|
||||
|
||||
virtual iter_type
|
||||
do_get_monthname(iter_type __s, iter_type __end, ios_base&,
|
||||
ios_base::iostate& __err, tm* __t) const;
|
||||
do_get_monthname(iter_type __beg, iter_type __end, ios_base&,
|
||||
ios_base::iostate& __err, tm* __tm) const;
|
||||
|
||||
virtual iter_type
|
||||
do_get_year(iter_type __s, iter_type /*__end*/, ios_base&,
|
||||
ios_base::iostate& /*__err*/, tm* /*__t*/) const
|
||||
{ return __s; }
|
||||
do_get_year(iter_type __beg, iter_type __end, ios_base& __io,
|
||||
ios_base::iostate& __err, tm* __tm) const;
|
||||
|
||||
// Extract time component in the form of
|
||||
// [digitdigit][separator], with a maximum of two digits per
|
||||
// separator. Used by do_get_time.
|
||||
void
|
||||
_M_extract_time(iter_type& __beg, iter_type& __end, int& __member,
|
||||
int __min, int __max, const char_type __sep,
|
||||
bool __extract, const ctype<_CharT>& __ctype,
|
||||
ios_base::iostate& __err) const;
|
||||
|
||||
// Extract day or month name, or any unique array of string
|
||||
// literals in a const _CharT* array.
|
||||
void
|
||||
_M_extract_name(iter_type& __beg, iter_type& __end, int& __member,
|
||||
const _CharT** __names, size_t __indexlen,
|
||||
ios_base::iostate& __err) const;
|
||||
};
|
||||
|
||||
template<typename _CharT, typename _InIter>
|
||||
@ -1201,12 +1351,14 @@ namespace std
|
||||
class time_get_byname : public time_get<_CharT, _InIter>
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
typedef _CharT char_type;
|
||||
typedef _InIter iter_type;
|
||||
|
||||
explicit
|
||||
time_get_byname(const char*, size_t __refs = 0)
|
||||
: time_get<_CharT, _InIter>(__refs) { }
|
||||
|
||||
protected:
|
||||
virtual
|
||||
~time_get_byname() { }
|
||||
@ -1457,6 +1609,7 @@ namespace std
|
||||
class money_get : public locale::facet
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
typedef _CharT char_type;
|
||||
typedef _InIter iter_type;
|
||||
typedef basic_string<_CharT> string_type;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -63,7 +63,7 @@ sources = \
|
||||
basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc \
|
||||
complex_io.cc functexcept.cc globals.cc ios.cc limits.cc \
|
||||
locale.cc locale-inst.cc localename.cc \
|
||||
collate.cc messages.cc moneypunct.cc numpunct.cc \
|
||||
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
|
||||
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
|
||||
valarray-inst.cc wstring-inst.cc
|
||||
|
||||
|
@ -189,7 +189,7 @@ sources = \
|
||||
basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc \
|
||||
complex_io.cc functexcept.cc globals.cc ios.cc limits.cc \
|
||||
locale.cc locale-inst.cc localename.cc \
|
||||
collate.cc messages.cc moneypunct.cc numpunct.cc \
|
||||
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
|
||||
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
|
||||
valarray-inst.cc wstring-inst.cc
|
||||
|
||||
@ -271,7 +271,7 @@ LIBS = @LIBS@
|
||||
libstdc___la_OBJECTS = basic_file.lo bitset.lo c++locale.lo cmath.lo \
|
||||
codecvt.lo complex_io.lo functexcept.lo globals.lo ios.lo limits.lo \
|
||||
locale.lo locale-inst.lo localename.lo collate.lo messages.lo \
|
||||
moneypunct.lo numpunct.lo misc-inst.lo stdexcept.lo stl-inst.lo \
|
||||
moneypunct.lo numpunct.lo time.lo misc-inst.lo stdexcept.lo stl-inst.lo \
|
||||
string-inst.lo strstream.lo valarray-inst.lo wstring-inst.lo
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
|
@ -122,13 +122,9 @@ namespace std
|
||||
// collate
|
||||
template class collate<char>;
|
||||
template class collate_byname<char>;
|
||||
template class _Weekdaynames<char, int>;
|
||||
template class _Monthnames<char, int>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template class collate<wchar_t>;
|
||||
template class collate_byname<wchar_t>;
|
||||
template class _Weekdaynames<wchar_t, int>;
|
||||
template class _Monthnames<wchar_t, int>;
|
||||
#endif
|
||||
|
||||
// use_facet
|
||||
@ -243,30 +239,17 @@ namespace std
|
||||
const vec_pfacet::value_type&);
|
||||
|
||||
|
||||
//
|
||||
// locale
|
||||
//
|
||||
typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
|
||||
typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
|
||||
|
||||
|
||||
template
|
||||
istreambuf_iter
|
||||
__match_parallel<istreambuf_iter, char>
|
||||
(istreambuf_iter, istreambuf_iter, int, const string*, int*, int&, bool&);
|
||||
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
typedef istreambuf_iterator<wchar_t,char_traits<wchar_t> > wistreambuf_iter;
|
||||
typedef ostreambuf_iterator<wchar_t,char_traits<wchar_t> > wostreambuf_iter;
|
||||
|
||||
template
|
||||
wistreambuf_iter
|
||||
__match_parallel<wistreambuf_iter, wchar_t>
|
||||
(wistreambuf_iter, wistreambuf_iter, int, const wstring*, int*, int&, bool&);
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// locale
|
||||
//
|
||||
template
|
||||
bool
|
||||
locale::operator()(const string&, const string&) const;
|
||||
|
@ -434,6 +434,25 @@ namespace std
|
||||
: ctype<char>(new mask[table_size], true, __refs)
|
||||
{ }
|
||||
|
||||
// Definitions for static const data members of time_base
|
||||
template<>
|
||||
const char*
|
||||
__timepunct<char>::_S_timezones[14] =
|
||||
{
|
||||
"GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
|
||||
"IST", "EET", "CST", "JST"
|
||||
};
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
const wchar_t*
|
||||
__timepunct<wchar_t>::_S_timezones[14] =
|
||||
{
|
||||
L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
|
||||
L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
|
||||
};
|
||||
#endif
|
||||
|
||||
// Definitions for static const data members of money_base
|
||||
const money_base::pattern
|
||||
money_base::_S_default_pattern = {{symbol, sign, none, value}};
|
||||
|
54
libstdc++-v3/testsuite/22_locale/time_get.cc
Normal file
54
libstdc++-v3/testsuite/22_locale/time_get.cc
Normal file
@ -0,0 +1,54 @@
|
||||
// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 22.2.5.1 Template class time_get
|
||||
|
||||
#include <locale>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Check for required base class.
|
||||
typedef std::time_get<char> test_type;
|
||||
typedef std::locale::facet base_type1;
|
||||
typedef std::time_base base_type2;
|
||||
const test_type& obj = std::use_facet<test_type>(std::locale());
|
||||
const base_type1* base1 = &obj;
|
||||
const base_type2* base2 = &obj;
|
||||
|
||||
// Check for required typedefs
|
||||
typedef test_type::char_type char_type;
|
||||
typedef test_type::iter_type iter_type;
|
||||
}
|
||||
|
||||
// Should be able to instantiate this for other types besides char, wchar_t
|
||||
class gnu_time_get: public std::time_get<unsigned char>
|
||||
{ };
|
||||
|
||||
void test02()
|
||||
{
|
||||
gnu_time_get facet01;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
test02();
|
||||
return 0;
|
||||
}
|
491
libstdc++-v3/testsuite/22_locale/time_get_members_char.cc
Normal file
491
libstdc++-v3/testsuite/22_locale/time_get_members_char.cc
Normal file
@ -0,0 +1,491 @@
|
||||
// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// 22.2.5.1.1 time_get members
|
||||
|
||||
#include <locale>
|
||||
#include <sstream>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// XXX This test is not working for non-glibc locale models.
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
void test01()
|
||||
{
|
||||
using namespace std;
|
||||
typedef time_base::dateorder dateorder;
|
||||
typedef istreambuf_iterator<char> iterator_type;
|
||||
|
||||
bool test = true;
|
||||
|
||||
// basic construction and sanity checks.
|
||||
locale loc_c = locale::classic();
|
||||
locale loc_hk("en_HK");
|
||||
locale loc_fr("fr_FR@euro");
|
||||
locale loc_de("de_DE");
|
||||
VERIFY( loc_hk != loc_c );
|
||||
VERIFY( loc_hk != loc_fr );
|
||||
VERIFY( loc_hk != loc_de );
|
||||
VERIFY( loc_de != loc_fr );
|
||||
|
||||
// cache the __timepunct facets, for quicker gdb inspection
|
||||
const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
|
||||
const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
|
||||
const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
|
||||
const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
|
||||
|
||||
const string empty;
|
||||
|
||||
// create an ostream-derived object, cache the time_get facet
|
||||
iterator_type end;
|
||||
|
||||
istringstream iss;
|
||||
const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
|
||||
|
||||
const ios_base::iostate good = ios_base::goodbit;
|
||||
ios_base::iostate errorstate = good;
|
||||
|
||||
// create "C" time objects
|
||||
const tm time_bday = { 0, 0, 12, 4, 3, 71 };
|
||||
const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
|
||||
"%w %W %x %X %y %Y %Z %%";
|
||||
const char* date = "%A, the second of %B";
|
||||
const char* date_ex = "%Ex";
|
||||
|
||||
// 1
|
||||
// dateorder date_order() const
|
||||
iss.imbue(loc_c);
|
||||
dateorder do1 = tim_get.date_order();
|
||||
// VERIFY( do1 == time_base::mdy );
|
||||
VERIFY( do1 == time_base::no_order );
|
||||
|
||||
// 2
|
||||
// iter_type
|
||||
// get_time(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
|
||||
|
||||
// sanity checks for "C" locale
|
||||
iss.str("12:00:00");
|
||||
iterator_type is_it01(iss);
|
||||
tm time01;
|
||||
errorstate = good;
|
||||
tim_get.get_time(is_it01, end, iss, errorstate, &time01);
|
||||
VERIFY( time01.tm_sec == time_bday.tm_sec );
|
||||
VERIFY( time01.tm_min == time_bday.tm_min );
|
||||
VERIFY( time01.tm_hour == time_bday.tm_hour );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
iss.str("12:00:00 ");
|
||||
iterator_type is_it02(iss);
|
||||
tm time02;
|
||||
errorstate = good;
|
||||
tim_get.get_time(is_it02, end, iss, errorstate, &time02);
|
||||
VERIFY( time01.tm_sec == time_bday.tm_sec );
|
||||
VERIFY( time01.tm_min == time_bday.tm_min );
|
||||
VERIFY( time01.tm_hour == time_bday.tm_hour );
|
||||
VERIFY( errorstate == good );
|
||||
|
||||
iss.str("12:61:00 ");
|
||||
iterator_type is_it03(iss);
|
||||
tm time03;
|
||||
errorstate = good;
|
||||
tim_get.get_time(is_it03, end, iss, errorstate, &time03);
|
||||
VERIFY( time01.tm_hour == time_bday.tm_hour );
|
||||
VERIFY( errorstate == ios_base::failbit );
|
||||
|
||||
iss.str("12:a:00 ");
|
||||
iterator_type is_it04(iss);
|
||||
tm time04;
|
||||
errorstate = good;
|
||||
tim_get.get_time(is_it04, end, iss, errorstate, &time04);
|
||||
VERIFY( time01.tm_hour == time_bday.tm_hour );
|
||||
VERIFY( *is_it04 == 'a');
|
||||
VERIFY( errorstate == ios_base::failbit );
|
||||
|
||||
// inspection of named locales, de_DE
|
||||
iss.imbue(loc_de);
|
||||
iss.str("12:00:00");
|
||||
iterator_type is_it10(iss);
|
||||
tm time10;
|
||||
errorstate = good;
|
||||
tim_get.get_time(is_it10, end, iss, errorstate, &time10);
|
||||
VERIFY( time10.tm_sec == time_bday.tm_sec );
|
||||
VERIFY( time10.tm_min == time_bday.tm_min );
|
||||
VERIFY( time10.tm_hour == time_bday.tm_hour );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
// inspection of named locales, en_HK
|
||||
iss.imbue(loc_hk);
|
||||
iss.str("12:00:00 PST");
|
||||
// Hong Kong in California! Well, they have Paris in Vegas... this
|
||||
// is all a little disney-esque anyway. Besides, you can get decent
|
||||
// Dim Sum in San Francisco.
|
||||
iterator_type is_it20(iss);
|
||||
tm time20;
|
||||
errorstate = good;
|
||||
tim_get.get_time(is_it20, end, iss, errorstate, &time20);
|
||||
VERIFY( time10.tm_sec == time_bday.tm_sec );
|
||||
VERIFY( time10.tm_min == time_bday.tm_min );
|
||||
VERIFY( time10.tm_hour == time_bday.tm_hour );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
}
|
||||
|
||||
void test02()
|
||||
{
|
||||
using namespace std;
|
||||
typedef time_base::dateorder dateorder;
|
||||
typedef istreambuf_iterator<char> iterator_type;
|
||||
|
||||
bool test = true;
|
||||
|
||||
// basic construction and sanity checks.
|
||||
locale loc_c = locale::classic();
|
||||
locale loc_hk("en_HK");
|
||||
locale loc_fr("fr_FR@euro");
|
||||
locale loc_de("de_DE");
|
||||
VERIFY( loc_hk != loc_c );
|
||||
VERIFY( loc_hk != loc_fr );
|
||||
VERIFY( loc_hk != loc_de );
|
||||
VERIFY( loc_de != loc_fr );
|
||||
|
||||
// cache the __timepunct facets, for quicker gdb inspection
|
||||
const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
|
||||
const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
|
||||
const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
|
||||
const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
|
||||
|
||||
const string empty;
|
||||
|
||||
// create an ostream-derived object, cache the time_get facet
|
||||
iterator_type end;
|
||||
|
||||
istringstream iss;
|
||||
const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
|
||||
|
||||
const ios_base::iostate good = ios_base::goodbit;
|
||||
ios_base::iostate errorstate = good;
|
||||
|
||||
// create "C" time objects
|
||||
const tm time_bday = { 0, 0, 12, 4, 3, 71 };
|
||||
const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
|
||||
"%w %W %x %X %y %Y %Z %%";
|
||||
const char* date = "%A, the second of %B";
|
||||
const char* date_ex = "%Ex";
|
||||
|
||||
// iter_type
|
||||
// get_weekday(iter_type, iter_type, ios_base&,
|
||||
// ios_base::iostate&, tm*) const
|
||||
|
||||
// sanity checks for "C" locale
|
||||
iss.str("Sunday");
|
||||
iterator_type is_it01(iss);
|
||||
tm time01;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
|
||||
VERIFY( time01.tm_wday == time_bday.tm_wday );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
iss.str("Sun");
|
||||
iterator_type is_it02(iss);
|
||||
tm time02;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
|
||||
VERIFY( time02.tm_wday == time_bday.tm_wday );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
iss.str("Sun ");
|
||||
iterator_type is_it03(iss);
|
||||
tm time03;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it03, end, iss, errorstate, &time03);
|
||||
VERIFY( time03.tm_wday == time_bday.tm_wday );
|
||||
VERIFY( errorstate == good );
|
||||
VERIFY( *is_it03 == ' ');
|
||||
|
||||
iss.str("San");
|
||||
iterator_type is_it04(iss);
|
||||
tm time04;
|
||||
time04.tm_wday = 4;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it04, end, iss, errorstate, &time04);
|
||||
VERIFY( time04.tm_wday == 4 );
|
||||
VERIFY( *is_it04 == 'n');
|
||||
VERIFY( errorstate == ios_base::failbit );
|
||||
|
||||
iss.str("Tuesday ");
|
||||
iterator_type is_it05(iss);
|
||||
tm time05;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it05, end, iss, errorstate, &time05);
|
||||
VERIFY( time05.tm_wday == 2 );
|
||||
VERIFY( errorstate == good );
|
||||
VERIFY( *is_it05 == ' ');
|
||||
|
||||
iss.str("Tuesducky "); // Kind of like Fryday, without the swirls.
|
||||
iterator_type is_it06(iss);
|
||||
tm time06;
|
||||
time06.tm_wday = 4;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
|
||||
VERIFY( time06.tm_wday == 4 );
|
||||
VERIFY( errorstate == ios_base::failbit );
|
||||
VERIFY( *is_it05 == 'u');
|
||||
|
||||
// inspection of named locales, de_DE
|
||||
iss.imbue(loc_de);
|
||||
iss.str("Sonntag");
|
||||
iterator_type is_it10(iss);
|
||||
tm time10;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it10, end, iss, errorstate, &time10);
|
||||
VERIFY( time10.tm_wday == time_bday.tm_wday );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
// inspection of named locales, en_HK
|
||||
iss.imbue(loc_hk);
|
||||
iss.str("Sunday");
|
||||
iterator_type is_it20(iss);
|
||||
tm time20;
|
||||
errorstate = good;
|
||||
tim_get.get_weekday(is_it20, end, iss, errorstate, &time20);
|
||||
VERIFY( time20.tm_wday == time_bday.tm_wday );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
}
|
||||
|
||||
void test03()
|
||||
{
|
||||
using namespace std;
|
||||
typedef time_base::dateorder dateorder;
|
||||
typedef istreambuf_iterator<char> iterator_type;
|
||||
|
||||
bool test = true;
|
||||
|
||||
// basic construction and sanity checks.
|
||||
locale loc_c = locale::classic();
|
||||
locale loc_hk("en_HK");
|
||||
locale loc_fr("fr_FR@euro");
|
||||
locale loc_de("de_DE");
|
||||
VERIFY( loc_hk != loc_c );
|
||||
VERIFY( loc_hk != loc_fr );
|
||||
VERIFY( loc_hk != loc_de );
|
||||
VERIFY( loc_de != loc_fr );
|
||||
|
||||
// cache the __timepunct facets, for quicker gdb inspection
|
||||
const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
|
||||
const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
|
||||
const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
|
||||
const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
|
||||
|
||||
const string empty;
|
||||
|
||||
// create an ostream-derived object, cache the time_get facet
|
||||
iterator_type end;
|
||||
|
||||
istringstream iss;
|
||||
const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
|
||||
|
||||
const ios_base::iostate good = ios_base::goodbit;
|
||||
ios_base::iostate errorstate = good;
|
||||
|
||||
// create "C" time objects
|
||||
const tm time_bday = { 0, 0, 12, 4, 3, 71 };
|
||||
const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
|
||||
"%w %W %x %X %y %Y %Z %%";
|
||||
const char* date = "%A, the second of %B";
|
||||
const char* date_ex = "%Ex";
|
||||
|
||||
// iter_type
|
||||
// get_monthname(iter_type, iter_type, ios_base&,
|
||||
// ios_base::iostate&, tm*) const
|
||||
|
||||
// sanity checks for "C" locale
|
||||
iss.str("April");
|
||||
iterator_type is_it01(iss);
|
||||
tm time01;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it01, end, iss, errorstate, &time01);
|
||||
VERIFY( time01.tm_wday == time_bday.tm_wday );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
iss.str("Apr");
|
||||
iterator_type is_it02(iss);
|
||||
tm time02;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it02, end, iss, errorstate, &time02);
|
||||
VERIFY( time02.tm_mon == time_bday.tm_mon );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
iss.str("Apr ");
|
||||
iterator_type is_it03(iss);
|
||||
tm time03;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it03, end, iss, errorstate, &time03);
|
||||
VERIFY( time03.tm_mon == time_bday.tm_mon );
|
||||
VERIFY( errorstate == good );
|
||||
VERIFY( *is_it03 == ' ');
|
||||
|
||||
iss.str("Aar");
|
||||
iterator_type is_it04(iss);
|
||||
tm time04;
|
||||
time04.tm_mon = 5;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it04, end, iss, errorstate, &time04);
|
||||
VERIFY( time04.tm_mon == 5 );
|
||||
VERIFY( *is_it04 == 'a');
|
||||
VERIFY( errorstate == ios_base::failbit );
|
||||
|
||||
iss.str("December ");
|
||||
iterator_type is_it05(iss);
|
||||
tm time05;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it05, end, iss, errorstate, &time05);
|
||||
VERIFY( time05.tm_mon == 11 );
|
||||
VERIFY( errorstate == good );
|
||||
VERIFY( *is_it05 == ' ');
|
||||
|
||||
iss.str("Decelember ");
|
||||
iterator_type is_it06(iss);
|
||||
tm time06;
|
||||
time06.tm_mon = 4;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
|
||||
VERIFY( time06.tm_mon == 4 );
|
||||
VERIFY( errorstate == ios_base::failbit );
|
||||
VERIFY( *is_it05 == 'l');
|
||||
|
||||
// inspection of named locales, de_DE
|
||||
iss.imbue(loc_de);
|
||||
iss.str("April");
|
||||
iterator_type is_it10(iss);
|
||||
tm time10;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it10, end, iss, errorstate, &time10);
|
||||
VERIFY( time10.tm_mon == time_bday.tm_mon );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
// inspection of named locales, en_HK
|
||||
iss.imbue(loc_hk);
|
||||
iss.str("April");
|
||||
iterator_type is_it20(iss);
|
||||
tm time20;
|
||||
errorstate = good;
|
||||
tim_get.get_monthname(is_it20, end, iss, errorstate, &time20);
|
||||
VERIFY( time20.tm_mon == time_bday.tm_mon );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
}
|
||||
|
||||
void test04()
|
||||
{
|
||||
using namespace std;
|
||||
typedef time_base::dateorder dateorder;
|
||||
typedef istreambuf_iterator<char> iterator_type;
|
||||
|
||||
bool test = true;
|
||||
|
||||
// basic construction and sanity checks.
|
||||
locale loc_c = locale::classic();
|
||||
locale loc_hk("en_HK");
|
||||
locale loc_fr("fr_FR@euro");
|
||||
locale loc_de("de_DE");
|
||||
VERIFY( loc_hk != loc_c );
|
||||
VERIFY( loc_hk != loc_fr );
|
||||
VERIFY( loc_hk != loc_de );
|
||||
VERIFY( loc_de != loc_fr );
|
||||
|
||||
// cache the __timepunct facets, for quicker gdb inspection
|
||||
const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
|
||||
const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
|
||||
const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
|
||||
const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
|
||||
|
||||
const string empty;
|
||||
|
||||
// create an ostream-derived object, cache the time_get facet
|
||||
iterator_type end;
|
||||
|
||||
istringstream iss;
|
||||
const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
|
||||
|
||||
const ios_base::iostate good = ios_base::goodbit;
|
||||
ios_base::iostate errorstate = good;
|
||||
|
||||
// create "C" time objects
|
||||
const tm time_bday = { 0, 0, 12, 4, 3, 71 };
|
||||
const char* all = "%a %A %b %B %c %d %H %I %j %m %M %p %s %U "
|
||||
"%w %W %x %X %y %Y %Z %%";
|
||||
const char* date = "%A, the second of %B";
|
||||
const char* date_ex = "%Ex";
|
||||
|
||||
// iter_type
|
||||
// get_year(iter_type, iter_type, ios_base&, ios_base::iostate&, tm*) const
|
||||
|
||||
// sanity checks for "C" locale
|
||||
iss.str("1971");
|
||||
iterator_type is_it01(iss);
|
||||
tm time01;
|
||||
errorstate = good;
|
||||
tim_get.get_year(is_it01, end, iss, errorstate, &time01);
|
||||
VERIFY( time01.tm_year == time_bday.tm_year );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
|
||||
iss.str("1971 ");
|
||||
iterator_type is_it02(iss);
|
||||
tm time02;
|
||||
errorstate = good;
|
||||
tim_get.get_year(is_it02, end, iss, errorstate, &time02);
|
||||
VERIFY( time02.tm_year == time_bday.tm_year );
|
||||
VERIFY( errorstate == good );
|
||||
VERIFY( *is_it02 == ' ');
|
||||
|
||||
iss.str("197d1 ");
|
||||
iterator_type is_it03(iss);
|
||||
tm time03;
|
||||
time03.tm_year = 3;
|
||||
errorstate = good;
|
||||
tim_get.get_year(is_it03, end, iss, errorstate, &time03);
|
||||
VERIFY( time03.tm_year == 3 );
|
||||
VERIFY( errorstate == ios_base::failbit );
|
||||
VERIFY( *is_it03 == 'd');
|
||||
|
||||
iss.str("71d71");
|
||||
iterator_type is_it04(iss);
|
||||
tm time04;
|
||||
errorstate = good;
|
||||
tim_get.get_year(is_it04, end, iss, errorstate, &time04);
|
||||
VERIFY( time04.tm_year == time_bday.tm_year );
|
||||
VERIFY( errorstate == good );
|
||||
VERIFY( *is_it03 == 'd');
|
||||
|
||||
iss.str("71");
|
||||
iterator_type is_it05(iss);
|
||||
tm time05;
|
||||
errorstate = good;
|
||||
tim_get.get_year(is_it05, end, iss, errorstate, &time05);
|
||||
VERIFY( time05.tm_year == time_bday.tm_year );
|
||||
VERIFY( errorstate == ios_base::eofbit );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
test02();
|
||||
test03();
|
||||
test04();
|
||||
return 0;
|
||||
}
|
@ -24,7 +24,9 @@
|
||||
#include <sstream>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// test string version
|
||||
// XXX This test is not working for non-glibc locale models.
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
void test01()
|
||||
{
|
||||
using namespace std;
|
||||
@ -42,11 +44,11 @@ void test01()
|
||||
VERIFY( loc_hk != loc_de );
|
||||
VERIFY( loc_de != loc_fr );
|
||||
|
||||
// cache the moneypunct facets, for quicker gdb inspection
|
||||
const time_put<char>& timp_c = use_facet<time_put<char> >(loc_c);
|
||||
const time_put<char>& timp_de = use_facet<time_put<char> >(loc_de);
|
||||
const time_put<char>& timp_hk = use_facet<time_put<char> >(loc_hk);
|
||||
const time_put<char>& timp_fr = use_facet<time_put<char> >(loc_fr);
|
||||
// cache the __timepunct facets, for quicker gdb inspection
|
||||
const __timepunct<char>& time_c = use_facet<__timepunct<char> >(loc_c);
|
||||
const __timepunct<char>& time_de = use_facet<__timepunct<char> >(loc_de);
|
||||
const __timepunct<char>& time_hk = use_facet<__timepunct<char> >(loc_hk);
|
||||
const __timepunct<char>& time_fr = use_facet<__timepunct<char> >(loc_fr);
|
||||
|
||||
// create an ostream-derived object, cache the time_put facet
|
||||
const string empty;
|
||||
@ -70,24 +72,76 @@ void test01()
|
||||
string result1 = oss.str();
|
||||
VERIFY( result1 == "Sun" );
|
||||
|
||||
oss.str(empty);
|
||||
iterator_type os_it21 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
|
||||
string result21 = oss.str(); // "04/04/71"
|
||||
oss.str(empty);
|
||||
iterator_type os_it22 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
|
||||
string result22 = oss.str(); // "12:00:00"
|
||||
oss.str(empty);
|
||||
iterator_type os_it31 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
|
||||
string result31 = oss.str(); // "04/04/71"
|
||||
oss.str(empty);
|
||||
iterator_type os_it32 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
|
||||
string result32 = oss.str(); // "12:00:00"
|
||||
|
||||
oss.str(empty);
|
||||
oss.imbue(loc_de);
|
||||
iterator_type os_it02 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
|
||||
string result2 = oss.str();
|
||||
VERIFY( result2 == "Son" );
|
||||
|
||||
oss.str(empty); // "%d.%m.%Y"
|
||||
iterator_type os_it23 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
|
||||
string result23 = oss.str(); // "04.04.1971"
|
||||
oss.str(empty); // "%T"
|
||||
iterator_type os_it24 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
|
||||
string result24 = oss.str(); // "12:00:00"
|
||||
oss.str(empty);
|
||||
iterator_type os_it33 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
|
||||
string result33 = oss.str(); // "04.04.1971"
|
||||
oss.str(empty);
|
||||
iterator_type os_it34 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
|
||||
string result34 = oss.str(); // "12:00:00"
|
||||
|
||||
oss.str(empty);
|
||||
oss.imbue(loc_hk);
|
||||
iterator_type os_it03 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
|
||||
string result3 = oss.str();
|
||||
VERIFY( result3 == "Sun" );
|
||||
|
||||
oss.str(empty); // "%A, %B %d, %Y"
|
||||
iterator_type os_it25 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
|
||||
string result25 = oss.str(); // "Sunday, April 04, 1971"
|
||||
oss.str(empty); // "%I:%M:%S %Z"
|
||||
iterator_type os_it26 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
|
||||
string result26 = oss.str(); // "12:00:00 PST"
|
||||
oss.str(empty);
|
||||
iterator_type os_it35 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
|
||||
string result35 = oss.str(); // "Sunday, April 04, 1971"
|
||||
oss.str(empty);
|
||||
iterator_type os_it36 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
|
||||
string result36 = oss.str(); // "12:00:00 PST"
|
||||
|
||||
oss.str(empty);
|
||||
oss.imbue(loc_fr);
|
||||
iterator_type os_it04 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
|
||||
string result4 = oss.str();
|
||||
VERIFY( result4 == "dim" );
|
||||
|
||||
oss.str(empty); // "%d.%m.%Y"
|
||||
iterator_type os_it27 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
|
||||
string result27 = oss.str(); // "04.04.1971"
|
||||
oss.str(empty); // "%T"
|
||||
iterator_type os_it28 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
|
||||
string result28 = oss.str(); // "12:00:00"
|
||||
oss.str(empty);
|
||||
iterator_type os_it37 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
|
||||
string result37 = oss.str(); // "04.04.1971"
|
||||
oss.str(empty);
|
||||
iterator_type os_it38 = tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
|
||||
string result38 = oss.str(); // "12:00:00"
|
||||
|
||||
// 2
|
||||
oss.str(empty);
|
||||
oss.imbue(loc_c);
|
||||
|
Loading…
Reference in New Issue
Block a user