19720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/*
29720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1999
39720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Silicon Graphics Computer Systems, Inc.
49720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
59720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1999
69720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Boris Fomitchev
79720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
89720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * This material is provided "as is", with absolutely no warranty expressed
99720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * or implied. Any use is at your own risk.
109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to use or copy this software for any purpose is hereby granted
129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * without fee, provided the above notices are retained on all copies.
139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to modify the code and to distribute modified code is granted,
149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * provided the above notices are retained, and a notice that the code was
159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * modified is included with the above copyright notice.
169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */
189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// WARNING: This is an internal header file, included by other C++
199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// standard library headers.  You should not attempt to use this header
209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// file directly.
219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_TIME_FACETS_H
249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_INTERNAL_TIME_FACETS_H
259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_CTIME
279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/_ctime.h>                // Needed (for struct tm) by time facets
289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_C_LOCALE_H
319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/c_locale.h>
329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_IOS_BASE_H
359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/_ios_base.h>
369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
38e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
39e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  include <stl/_iostream_string.h>
40e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
41e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
42e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#ifndef _STLP_FACETS_FWD_H
43e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  include <stl/_facets_fwd.h>
44e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
45e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_BEGIN_NAMESPACE
479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_PRIV_NAMESPACE
499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Template functions used by time_get
519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
52e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott/* Both time_get and time_put need a structure of type _Time_Info
53e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * to provide names and abbreviated names for months and days,
54e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * as well as the am/pm designator.  The month and weekday tables
55e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * have the all the abbreviated names before all the full names.
56e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * The _Time_Info tables are initialized using the non-template
57e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * time_base class, which has a default constructor and two protected.
58e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * The default one initialize _Time_Info with "C" time info. The
59e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * protected initialize _time_Info using a _Locale_time instance
60e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * or using a name( in fact the name is used to build a _Locale_time
61e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott * instance that is then used for initialization). */
62e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
63e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass _STLP_CLASS_DECLSPEC _Time_Info_Base {
649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  string _M_time_format;
669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  string _M_date_format;
679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  string _M_date_time_format;
689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  string _M_long_date_format;
699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  string _M_long_date_time_format;
709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
72e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass _STLP_CLASS_DECLSPEC _Time_Info : public _Time_Info_Base {
73e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottpublic:
74e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  string _M_dayname[14];
75e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  string _M_monthname[24];
76e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  string _M_am_pm[2];
77e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott};
78e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
79e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#ifndef _STLP_NO_WCHAR_T
80e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass _STLP_CLASS_DECLSPEC _WTime_Info : public _Time_Info_Base {
81e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottpublic:
82e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  wstring _M_dayname[14];
83e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  wstring _M_monthname[24];
84e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  wstring _M_am_pm[2];
85e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott};
86e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_STD_NAMESPACE
899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass _STLP_CLASS_DECLSPEC time_base {
919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  enum dateorder {no_order, dmy, mdy, ymd, ydm};
939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
95e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_MOVE_TO_PRIV_NAMESPACE
96e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
97e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scotttemplate <class _Ch>
98e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass time_init;
99e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
100e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_TEMPLATE_NULL
101e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass _STLP_CLASS_DECLSPEC time_init<char> {
102e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottprotected:
103e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_init();
104e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_init(const char *name);
105e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_init(_Locale_time*);
106e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (__BORLANDC__)
107e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  static
1089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
109e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  _Time_Info _M_timeinfo;
110e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_base::dateorder _M_dateorder;
111e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott};
112e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
113e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#ifndef _STLP_NO_WCHAR_T
114e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_TEMPLATE_NULL
115e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass _STLP_CLASS_DECLSPEC time_init<wchar_t> {
116e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottprotected:
117e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_init();
118e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_init(const char *name);
119e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_init(_Locale_time*);
120e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (__BORLANDC__)
121e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  static
122e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
123e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  _WTime_Info _M_timeinfo;
124e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_base::dateorder _M_dateorder;
125e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott};
126e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
127e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
128e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_MOVE_TO_STD_NAMESPACE
1299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
130e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scotttemplate <class _Ch, class _InIt>
131e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass time_get : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> {
1329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
1339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Ch   char_type;
1349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _InIt iter_type;
1359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  explicit time_get(size_t __refs = 0) : locale::facet(__refs)
137e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
138e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
1399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  dateorder date_order() const { return do_date_order(); }
1409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iter_type get_time(iter_type __s, iter_type  __end, ios_base&  __str,
1419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     ios_base::iostate&  __err, tm* __t) const
1429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return do_get_time(__s,  __end,  __str,  __err, __t); }
1439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iter_type get_date(iter_type __s, iter_type  __end, ios_base&  __str,
1449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     ios_base::iostate&  __err, tm* __t) const
1459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return do_get_date(__s,  __end,  __str,  __err, __t); }
1469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iter_type get_weekday(iter_type __s, iter_type  __end, ios_base&  __str,
1479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                        ios_base::iostate&  __err, tm* __t) const
1489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return do_get_weekday(__s,  __end,  __str,  __err, __t); }
1499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iter_type get_monthname(iter_type __s, iter_type  __end, ios_base&  __str,
1509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                          ios_base::iostate&  __err, tm* __t) const
1519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return do_get_monthname(__s,  __end,  __str,  __err, __t); }
1529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iter_type get_year(iter_type __s, iter_type  __end, ios_base&  __str,
1539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     ios_base::iostate&  __err, tm* __t) const
1549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return do_get_year(__s,  __end,  __str,  __err, __t); }
1559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
156e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  static locale::id id;
1579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprotected:
159e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_get(const char* __name, size_t __refs)
160e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name)
161e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
162e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_get(_Locale_time *__time)
163e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : _STLP_PRIV time_init<_Ch>(__time)
164e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
1659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  ~time_get() {}
1679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
168e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  virtual dateorder do_date_order() const { return this->_M_dateorder; }
1699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  virtual iter_type do_get_time(iter_type __s, iter_type  __end,
1719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                ios_base&, ios_base::iostate&  __err,
1729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                tm* __t) const;
1739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  virtual iter_type do_get_date(iter_type __s, iter_type  __end,
1759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                ios_base&, ios_base::iostate& __err,
1769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                tm* __t) const;
1779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  virtual iter_type do_get_weekday(iter_type __s, iter_type  __end,
1799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                   ios_base&,
1809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                   ios_base::iostate& __err,
1819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                   tm* __t) const;
1829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  virtual iter_type do_get_monthname(iter_type __s, iter_type  __end,
1839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                     ios_base&,
1849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                     ios_base::iostate& __err,
1859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                     tm* __t) const;
1869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  virtual iter_type do_get_year(iter_type __s, iter_type  __end,
1889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                ios_base&, ios_base::iostate& __err,
1899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                tm* __t) const;
1909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
1919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
1939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Ch, class _InIt>
1949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
1959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
1969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
1979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass time_get_byname : public time_get<_Ch, _InIt> {
198e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  friend class _Locale_impl;
1999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
2009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef  time_base::dateorder dateorder;
2019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _InIt                 iter_type;
2029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
203e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  explicit time_get_byname(const char* __name, size_t __refs = 0)
204e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : time_get<_Ch, _InIt>(__name, __refs) {}
2059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprotected:
207e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  ~time_get_byname() {}
208e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  dateorder do_date_order() const { return this->_M_dateorder; }
2099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
211e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_get_byname(_Locale_time *__time)
212e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : time_get<_Ch, _InIt>(__time)
213e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
2149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef time_get_byname<_Ch, _InIt> _Self;
2169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  //explicitely defined as private to avoid warnings:
2179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  time_get_byname(_Self const&);
2189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Self& operator = (_Self const&);
2199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
2209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// time_put facet
2229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// For the formats 'x, 'X', and 'c', do_put calls the first form of
2249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// put with the pattern obtained from _M_timeinfo._M_date_format or
2259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// _M_timeinfo._M_time_format.
2269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Helper function:  __  takes a single-character
2289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// format.  As indicated by the foregoing remark, this will never be
2299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// 'x', 'X', or 'c'.
2309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_PRIV_NAMESPACE
2329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
233e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_DECLSPEC void _STLP_CALL
234e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott__write_formatted_time(__iostring&, const ctype<char>& __ct,
235e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                       char __format, char __modifier,
2369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                       const _Time_Info& __table, const tm* __t);
2379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
238e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#ifndef _STLP_NO_WCHAR_T
239e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_DECLSPEC void _STLP_CALL
240e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott__write_formatted_time(__iowstring&, const ctype<wchar_t>& __ct,
241e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                       char __format, char __modifier,
242e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                       const _WTime_Info& __table, const tm* __t);
2439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
2449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_STD_NAMESPACE
2469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Ch, class _OutIt>
248e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass time_put : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> {
2499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
2509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Ch      char_type;
2519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _OutIt iter_type;
2529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  explicit time_put(size_t __refs = 0) : locale::facet(__refs)
254e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
2559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
2579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                  const tm* __tmb,
2589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                  const _Ch* __pat, const _Ch* __pat_end) const;
2599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _OutIt put(iter_type __s, ios_base& __f, _Ch  __fill,
2619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                  const tm* __tmb, char __format, char __modifier = 0) const
2629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return do_put(__s, __f,  __fill, __tmb, __format, __modifier); }
2639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
264e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  static locale::id id;
2659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprotected:
267e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_put(const char* __name, size_t __refs)
268e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name)
269e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
270e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_put(_Locale_time *__time)
271e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : _STLP_PRIV time_init<_Ch>(__time)
272e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
2739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  ~time_put() {}
2749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  virtual iter_type do_put(iter_type __s, ios_base& __f,
2759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                           char_type  /* __fill */, const tm* __tmb,
2769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                           char __format, char /* __modifier */) const;
2779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
2789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
2809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Ch, class _OutIt>
2819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
2829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
2839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
2849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass time_put_byname : public time_put<_Ch, _OutIt> {
2859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  friend class _Locale_impl;
2869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
2879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef time_base::dateorder dateorder;
2889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _OutIt iter_type;
2899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Ch   char_type;
2909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
291e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  explicit time_put_byname(const char * __name, size_t __refs = 0)
292e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : time_put<_Ch, _OutIt>(__name, __refs)
293e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
2949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprotected:
296e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  ~time_put_byname() {}
2979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
299e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  time_put_byname(_Locale_time *__time)
300e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    : time_put<_Ch, _OutIt>(__time)
301e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  {}
3029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef time_put_byname<_Ch, _OutIt> _Self;
3049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  //explicitely defined as private to avoid warnings:
3059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  time_put_byname(_Self const&);
3069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Self& operator = (_Self const&);
3079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
3089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_USE_TEMPLATE_EXPORT)
3109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_EXPORT_TEMPLATE_CLASS time_get<char, istreambuf_iterator<char, char_traits<char> > >;
3119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_EXPORT_TEMPLATE_CLASS time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
3129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  if !defined (_STLP_NO_WCHAR_T)
3139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_EXPORT_TEMPLATE_CLASS time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
3149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_EXPORT_TEMPLATE_CLASS time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
3159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  endif
3169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
3189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_END_NAMESPACE
3209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
3229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/_time_facets.c>
3239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
3249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /* _STLP_INTERNAL_TIME_FACETS_H */
3269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Local Variables:
3289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// mode:C++
3299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// End:
330