# locale_facets_nonio.h

Go to the documentation of this file.

    00001 // Locale support -*- C++ -*-
    00002
    00003 // Copyright (C) 2007 Free Software Foundation, Inc.
    00004 //
    00005 // This file is part of the GNU ISO C++ Library.  This library is free
    00006 // software; you can redistribute it and/or modify it under the
    00007 // terms of the GNU General Public License as published by the
    00008 // Free Software Foundation; either version 2, or (at your option)
    00009 // any later version.
    00010
    00011 // This library is distributed in the hope that it will be useful,
    00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014 // GNU General Public License for more details.
    00015
    00016 // You should have received a copy of the GNU General Public License along
    00017 // with this library; see the file COPYING.  If not, write to the Free
    00018 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    00019 // USA.
    00020
    00021 // As a special exception, you may use this file as part of a free software
    00022 // library without restriction.  Specifically, if other files instantiate
    00023 // templates or use macros or inline functions from this file, or you compile
    00024 // this file and link it with other files to produce an executable, this
    00025 // file does not by itself cause the resulting executable to be covered by
    00026 // the GNU General Public License.  This exception does not however
    00027 // invalidate any other reasons why the executable file might be covered by
    00028 // the GNU General Public License.
    00029
    00030 /** @file locale_facets_nonio.h
    00031  *  This is an internal header file, included by other library headers.
    00032  *  You should not attempt to use it directly.
    00033  */
    00034
    00035 //
    00036 // ISO C++ 14882: 22.1  Locales
    00037 //
    00038
    00039 #ifndef _LOCALE_FACETS_NONIO_H
    00040 #define _LOCALE_FACETS_NONIO_H 1
    00041
    00042 #pragma GCC system_header
    00043
    00044 #include <ctime>    // For struct tm
    00045
    00046 _GLIBCXX_BEGIN_NAMESPACE(std)
    00047
    00048   /**
    00049    *  @brief  Time format ordering data.
    00050    *
    00051    *  This class provides an enum representing different orderings of day,
    00052    *  month, and year.
    00053   */
    00054   class time_base
    00055   {
    00056   public:
    00057     enum dateorder { no_order, dmy, mdy, ymd, ydm };
    00058   };
    00059
    00060   template<typename _CharT>
    00061     struct __timepunct_cache : public locale::facet
    00062     {
    00063       // List of all known timezones, with GMT first.
    00064       static const _CharT*      _S_timezones[14];
    00065
    00066       const _CharT*         _M_date_format;
    00067       const _CharT*         _M_date_era_format;
    00068       const _CharT*         _M_time_format;
    00069       const _CharT*         _M_time_era_format;
    00070       const _CharT*         _M_date_time_format;
    00071       const _CharT*         _M_date_time_era_format;
    00072       const _CharT*         _M_am;
    00073       const _CharT*         _M_pm;
    00074       const _CharT*         _M_am_pm_format;
    00075
    00076       // Day names, starting with "C"'s Sunday.
    00077       const _CharT*         _M_day1;
    00078       const _CharT*         _M_day2;
    00079       const _CharT*         _M_day3;
    00080       const _CharT*         _M_day4;
    00081       const _CharT*         _M_day5;
    00082       const _CharT*         _M_day6;
    00083       const _CharT*         _M_day7;
    00084
    00085       // Abbreviated day names, starting with "C"'s Sun.
    00086       const _CharT*         _M_aday1;
    00087       const _CharT*         _M_aday2;
    00088       const _CharT*         _M_aday3;
    00089       const _CharT*         _M_aday4;
    00090       const _CharT*         _M_aday5;
    00091       const _CharT*         _M_aday6;
    00092       const _CharT*         _M_aday7;
    00093
    00094       // Month names, starting with "C"'s January.
    00095       const _CharT*         _M_month01;
    00096       const _CharT*         _M_month02;
    00097       const _CharT*         _M_month03;
    00098       const _CharT*         _M_month04;
    00099       const _CharT*         _M_month05;
    00100       const _CharT*         _M_month06;
    00101       const _CharT*         _M_month07;
    00102       const _CharT*         _M_month08;
    00103       const _CharT*         _M_month09;
    00104       const _CharT*         _M_month10;
    00105       const _CharT*         _M_month11;
    00106       const _CharT*         _M_month12;
    00107
    00108       // Abbreviated month names, starting with "C"'s Jan.
    00109       const _CharT*         _M_amonth01;
    00110       const _CharT*         _M_amonth02;
    00111       const _CharT*         _M_amonth03;
    00112       const _CharT*         _M_amonth04;
    00113       const _CharT*         _M_amonth05;
    00114       const _CharT*         _M_amonth06;
    00115       const _CharT*         _M_amonth07;
    00116       const _CharT*         _M_amonth08;
    00117       const _CharT*         _M_amonth09;
    00118       const _CharT*         _M_amonth10;
    00119       const _CharT*         _M_amonth11;
    00120       const _CharT*         _M_amonth12;
    00121
    00122       bool              _M_allocated;
    00123
    00124       __timepunct_cache(size_t __refs = 0) : facet(__refs),
    00125       _M_date_format(NULL), _M_date_era_format(NULL), _M_time_format(NULL),
    00126       _M_time_era_format(NULL), _M_date_time_format(NULL),
    00127       _M_date_time_era_format(NULL), _M_am(NULL), _M_pm(NULL),
    00128       _M_am_pm_format(NULL), _M_day1(NULL), _M_day2(NULL), _M_day3(NULL),
    00129       _M_day4(NULL), _M_day5(NULL), _M_day6(NULL), _M_day7(NULL),
    00130       _M_aday1(NULL), _M_aday2(NULL), _M_aday3(NULL), _M_aday4(NULL),
    00131       _M_aday5(NULL), _M_aday6(NULL), _M_aday7(NULL), _M_month01(NULL),
    00132       _M_month02(NULL), _M_month03(NULL), _M_month04(NULL), _M_month05(NULL),
    00133       _M_month06(NULL), _M_month07(NULL), _M_month08(NULL), _M_month09(NULL),
    00134       _M_month10(NULL), _M_month11(NULL), _M_month12(NULL), _M_amonth01(NULL),
    00135       _M_amonth02(NULL), _M_amonth03(NULL), _M_amonth04(NULL),
    00136       _M_amonth05(NULL), _M_amonth06(NULL), _M_amonth07(NULL),
    00137       _M_amonth08(NULL), _M_amonth09(NULL), _M_amonth10(NULL),
    00138       _M_amonth11(NULL), _M_amonth12(NULL), _M_allocated(false)
    00139       { }
    00140
    00141       ~__timepunct_cache();
    00142
    00143       void
    00144       _M_cache(const locale& __loc);
    00145
    00146     private:
    00147       __timepunct_cache&
    00148       operator=(const __timepunct_cache&);
    00149
    00150       explicit
    00151       __timepunct_cache(const __timepunct_cache&);
    00152     };
    00153
    00154   template<typename _CharT>
    00155     __timepunct_cache<_CharT>::~__timepunct_cache()
    00156     {
    00157       if (_M_allocated)
    00158     {
    00159       // Unused.
    00160     }
    00161     }
    00162
    00163   // Specializations.
    00164   template<>
    00165     const char*
    00166     __timepunct_cache<char>::_S_timezones[14];
    00167
    00168 #ifdef _GLIBCXX_USE_WCHAR_T
    00169   template<>
    00170     const wchar_t*
    00171     __timepunct_cache<wchar_t>::_S_timezones[14];
    00172 #endif
    00173
    00174   // Generic.
    00175   template<typename _CharT>
    00176     const _CharT* __timepunct_cache<_CharT>::_S_timezones[14];
    00177
    00178   template<typename _CharT>
    00179     class __timepunct : public locale::facet
    00180     {
    00181     public:
    00182       // Types:
    00183       typedef _CharT            __char_type;
    00184       typedef basic_string<_CharT>  __string_type;
    00185       typedef __timepunct_cache<_CharT> __cache_type;
    00186
    00187     protected:
    00188       __cache_type*         _M_data;
    00189       __c_locale            _M_c_locale_timepunct;
    00190       const char*           _M_name_timepunct;
    00191
    00192     public:
    00193       /// Numpunct facet id.
    00194       static locale::id         id;
    00195
    00196       explicit
    00197       __timepunct(size_t __refs = 0);
    00198
    00199       explicit
    00200       __timepunct(__cache_type* __cache, size_t __refs = 0);
    00201
    00202       /**
    00203        *  @brief  Internal constructor. Not for general use.
    00204        *
    00205        *  This is a constructor for use by the library itself to set up new
    00206        *  locales.
    00207        *
    00208        *  @param cloc  The "C" locale.
    00209        *  @param s  The name of a locale.
    00210        *  @param refs  Passed to the base facet class.
    00211       */
    00212       explicit
    00213       __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0);
    00214
    00215       // FIXME: for error checking purposes _M_put should return the return
    00216       // value of strftime/wcsftime.
    00217       void
    00218       _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format,
    00219          const tm* __tm) const;
    00220
    00221       void
    00222       _M_date_formats(const _CharT** __date) const
    00223       {
    00224     // Always have default first.
    00225     __date[0] = _M_data->_M_date_format;
    00226     __date[1] = _M_data->_M_date_era_format;
    00227       }
    00228
    00229       void
    00230       _M_time_formats(const _CharT** __time) const
    00231       {
    00232     // Always have default first.
    00233     __time[0] = _M_data->_M_time_format;
    00234     __time[1] = _M_data->_M_time_era_format;
    00235       }
    00236
    00237       void
    00238       _M_date_time_formats(const _CharT** __dt) const
    00239       {
    00240     // Always have default first.
    00241     __dt[0] = _M_data->_M_date_time_format;
    00242     __dt[1] = _M_data->_M_date_time_era_format;
    00243       }
    00244
    00245       void
    00246       _M_am_pm_format(const _CharT* __ampm) const
    00247       { __ampm = _M_data->_M_am_pm_format; }
    00248
    00249       void
    00250       _M_am_pm(const _CharT** __ampm) const
    00251       {
    00252     __ampm[0] = _M_data->_M_am;
    00253     __ampm[1] = _M_data->_M_pm;
    00254       }
    00255
    00256       void
    00257       _M_days(const _CharT** __days) const
    00258       {
    00259     __days[0] = _M_data->_M_day1;
    00260     __days[1] = _M_data->_M_day2;
    00261     __days[2] = _M_data->_M_day3;
    00262     __days[3] = _M_data->_M_day4;
    00263     __days[4] = _M_data->_M_day5;
    00264     __days[5] = _M_data->_M_day6;
    00265     __days[6] = _M_data->_M_day7;
    00266       }
    00267
    00268       void
    00269       _M_days_abbreviated(const _CharT** __days) const
    00270       {
    00271     __days[0] = _M_data->_M_aday1;
    00272     __days[1] = _M_data->_M_aday2;
    00273     __days[2] = _M_data->_M_aday3;
    00274     __days[3] = _M_data->_M_aday4;
    00275     __days[4] = _M_data->_M_aday5;
    00276     __days[5] = _M_data->_M_aday6;
    00277     __days[6] = _M_data->_M_aday7;
    00278       }
    00279
    00280       void
    00281       _M_months(const _CharT** __months) const
    00282       {
    00283     __months[0] = _M_data->_M_month01;
    00284     __months[1] = _M_data->_M_month02;
    00285     __months[2] = _M_data->_M_month03;
    00286     __months[3] = _M_data->_M_month04;
    00287     __months[4] = _M_data->_M_month05;
    00288     __months[5] = _M_data->_M_month06;
    00289     __months[6] = _M_data->_M_month07;
    00290     __months[7] = _M_data->_M_month08;
    00291     __months[8] = _M_data->_M_month09;
    00292     __months[9] = _M_data->_M_month10;
    00293     __months[10] = _M_data->_M_month11;
    00294     __months[11] = _M_data->_M_month12;
    00295       }
    00296
    00297       void
    00298       _M_months_abbreviated(const _CharT** __months) const
    00299       {
    00300     __months[0] = _M_data->_M_amonth01;
    00301     __months[1] = _M_data->_M_amonth02;
    00302     __months[2] = _M_data->_M_amonth03;
    00303     __months[3] = _M_data->_M_amonth04;
    00304     __months[4] = _M_data->_M_amonth05;
    00305     __months[5] = _M_data->_M_amonth06;
    00306     __months[6] = _M_data->_M_amonth07;
    00307     __months[7] = _M_data->_M_amonth08;
    00308     __months[8] = _M_data->_M_amonth09;
    00309     __months[9] = _M_data->_M_amonth10;
    00310     __months[10] = _M_data->_M_amonth11;
    00311     __months[11] = _M_data->_M_amonth12;
    00312       }
    00313
    00314     protected:
    00315       virtual
    00316       ~__timepunct();
    00317
    00318       // For use at construction time only.
    00319       void
    00320       _M_initialize_timepunct(__c_locale __cloc = NULL);
    00321     };
    00322
    00323   template<typename _CharT>
    00324     locale::id __timepunct<_CharT>::id;
    00325
    00326   // Specializations.
    00327   template<>
    00328     void
    00329     __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc);
    00330
    00331   template<>
    00332     void
    00333     __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const;
    00334
    00335 #ifdef _GLIBCXX_USE_WCHAR_T
    00336   template<>
    00337     void
    00338     __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc);
    00339
    00340   template<>
    00341     void
    00342     __timepunct<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*,
    00343                  const tm*) const;
    00344 #endif
    00345
    00346 _GLIBCXX_END_NAMESPACE
    00347
    00348   // Include host and configuration specific timepunct functions.
    00349   #include <bits/time_members.h>
    00350
    00351 _GLIBCXX_BEGIN_NAMESPACE(std)
    00352
    00353   /**
    00354    *  @brief  Facet for parsing dates and times.
    00355    *
    00356    *  This facet encapsulates the code to parse and return a date or
    00357    *  time from a string.  It is used by the istream numeric
    00358    *  extraction operators.
    00359    *
    00360    *  The time_get template uses protected virtual functions to provide the
    00361    *  actual results.  The public accessors forward the call to the virtual
    00362    *  functions.  These virtual functions are hooks for developers to
    00363    *  implement the behavior they require from the time_get facet.
    00364   */
    00365   template<typename _CharT, typename _InIter>
    00366     class time_get : public locale::facet, public time_base
    00367     {
    00368     public:
    00369       // Types:
    00370       //@{
    00371       /// Public typedefs
    00372       typedef _CharT            char_type;
    00373       typedef _InIter           iter_type;
    00374       //@}
    00375       typedef basic_string<_CharT>  __string_type;
    00376
    00377       /// Numpunct facet id.
    00378       static locale::id         id;
    00379
    00380       /**
    00381        *  @brief  Constructor performs initialization.
    00382        *
    00383        *  This is the constructor provided by the standard.
    00384        *
    00385        *  @param refs  Passed to the base facet class.
    00386       */
    00387       explicit
    00388       time_get(size_t __refs = 0)
    00389       : facet (__refs) { }
    00390
    00391       /**
    00392        *  @brief  Return preferred order of month, day, and year.
    00393        *
    00394        *  This function returns an enum from timebase::dateorder giving the
    00395        *  preferred ordering if the format "x" given to time_put::put() only
    00396        *  uses month, day, and year.  If the format "x" for the associated
    00397        *  locale uses other fields, this function returns
    00398        *  timebase::dateorder::noorder.
    00399        *
    00400        *  NOTE: The library always returns noorder at the moment.
    00401        *
    00402        *  @return  A member of timebase::dateorder.
    00403       */
    00404       dateorder
    00405       date_order()  const
    00406       { return this->do_date_order(); }
    00407
    00408       /**
    00409        *  @brief  Parse input time string.
    00410        *
    00411        *  This function parses a time according to the format "x" and puts the
    00412        *  results into a user-supplied struct tm.  The result is returned by
    00413        *  calling time_get::do_get_time().
    00414        *
    00415        *  If there is a valid time string according to format "x", @a tm will
    00416        *  be filled in accordingly and the returned iterator will point to the
    00417        *  first character beyond the time string.  If an error occurs before
    00418        *  the end, err |= ios_base::failbit.  If parsing reads all the
    00419        *  characters, err |= ios_base::eofbit.
    00420        *
    00421        *  @param  beg  Start of string to parse.
    00422        *  @param  end  End of string to parse.
    00423        *  @param  io  Source of the locale.
    00424        *  @param  err  Error flags to set.
    00425        *  @param  tm  Pointer to struct tm to fill in.
    00426        *  @return  Iterator to first char beyond time string.
    00427       */
    00428       iter_type
    00429       get_time(iter_type __beg, iter_type __end, ios_base& __io,
    00430            ios_base::iostate& __err, tm* __tm)  const
    00431       { return this->do_get_time(__beg, __end, __io, __err, __tm); }
    00432
    00433       /**
    00434        *  @brief  Parse input date string.
    00435        *
    00436        *  This function parses a date according to the format "X" and puts the
    00437        *  results into a user-supplied struct tm.  The result is returned by
    00438        *  calling time_get::do_get_date().
    00439        *
    00440        *  If there is a valid date string according to format "X", @a tm will
    00441        *  be filled in accordingly and the returned iterator will point to the
    00442        *  first character beyond the date string.  If an error occurs before
    00443        *  the end, err |= ios_base::failbit.  If parsing reads all the
    00444        *  characters, err |= ios_base::eofbit.
    00445        *
    00446        *  @param  beg  Start of string to parse.
    00447        *  @param  end  End of string to parse.
    00448        *  @param  io  Source of the locale.
    00449        *  @param  err  Error flags to set.
    00450        *  @param  tm  Pointer to struct tm to fill in.
    00451        *  @return  Iterator to first char beyond date string.
    00452       */
    00453       iter_type
    00454       get_date(iter_type __beg, iter_type __end, ios_base& __io,
    00455            ios_base::iostate& __err, tm* __tm)  const
    00456       { return this->do_get_date(__beg, __end, __io, __err, __tm); }
    00457
    00458       /**
    00459        *  @brief  Parse input weekday string.
    00460        *
    00461        *  This function parses a weekday name and puts the results into a
    00462        *  user-supplied struct tm.  The result is returned by calling
    00463        *  time_get::do_get_weekday().
    00464        *
    00465        *  Parsing starts by parsing an abbreviated weekday name.  If a valid
    00466        *  abbreviation is followed by a character that would lead to the full
    00467        *  weekday name, parsing continues until the full name is found or an
    00468        *  error occurs.  Otherwise parsing finishes at the end of the
    00469        *  abbreviated name.
    00470        *
    00471        *  If an error occurs before the end, err |= ios_base::failbit.  If
    00472        *  parsing reads all the characters, err |= ios_base::eofbit.
    00473        *
    00474        *  @param  beg  Start of string to parse.
    00475        *  @param  end  End of string to parse.
    00476        *  @param  io  Source of the locale.
    00477        *  @param  err  Error flags to set.
    00478        *  @param  tm  Pointer to struct tm to fill in.
    00479        *  @return  Iterator to first char beyond weekday name.
    00480       */
    00481       iter_type
    00482       get_weekday(iter_type __beg, iter_type __end, ios_base& __io,
    00483           ios_base::iostate& __err, tm* __tm) const
    00484       { return this->do_get_weekday(__beg, __end, __io, __err, __tm); }
    00485
    00486       /**
    00487        *  @brief  Parse input month string.
    00488        *
    00489        *  This function parses a month name and puts the results into a
    00490        *  user-supplied struct tm.  The result is returned by calling
    00491        *  time_get::do_get_monthname().
    00492        *
    00493        *  Parsing starts by parsing an abbreviated month name.  If a valid
    00494        *  abbreviation is followed by a character that would lead to the full
    00495        *  month name, parsing continues until the full name is found or an
    00496        *  error occurs.  Otherwise parsing finishes at the end of the
    00497        *  abbreviated name.
    00498        *
    00499        *  If an error occurs before the end, err |= ios_base::failbit.  If
    00500        *  parsing reads all the characters, err |=
    00501        *  ios_base::eofbit.
    00502        *
    00503        *  @param  beg  Start of string to parse.
    00504        *  @param  end  End of string to parse.
    00505        *  @param  io  Source of the locale.
    00506        *  @param  err  Error flags to set.
    00507        *  @param  tm  Pointer to struct tm to fill in.
    00508        *  @return  Iterator to first char beyond month name.
    00509       */
    00510       iter_type
    00511       get_monthname(iter_type __beg, iter_type __end, ios_base& __io,
    00512             ios_base::iostate& __err, tm* __tm) const
    00513       { return this->do_get_monthname(__beg, __end, __io, __err, __tm); }
    00514
    00515       /**
    00516        *  @brief  Parse input year string.
    00517        *
    00518        *  This function reads up to 4 characters to parse a year string and
    00519        *  puts the results into a user-supplied struct tm.  The result is
    00520        *  returned by calling time_get::do_get_year().
    00521        *
    00522        *  4 consecutive digits are interpreted as a full year.  If there are
    00523        *  exactly 2 consecutive digits, the library interprets this as the
    00524        *  number of years since 1900.
    00525        *
    00526        *  If an error occurs before the end, err |= ios_base::failbit.  If
    00527        *  parsing reads all the characters, err |= ios_base::eofbit.
    00528        *
    00529        *  @param  beg  Start of string to parse.
    00530        *  @param  end  End of string to parse.
    00531        *  @param  io  Source of the locale.
    00532        *  @param  err  Error flags to set.
    00533        *  @param  tm  Pointer to struct tm to fill in.
    00534        *  @return  Iterator to first char beyond year.
    00535       */
    00536       iter_type
    00537       get_year(iter_type __beg, iter_type __end, ios_base& __io,
    00538            ios_base::iostate& __err, tm* __tm) const
    00539       { return this->do_get_year(__beg, __end, __io, __err, __tm); }
    00540
    00541     protected:
    00542       /// Destructor.
    00543       virtual
    00544       ~time_get() { }
    00545
    00546       /**
    00547        *  @brief  Return preferred order of month, day, and year.
    00548        *
    00549        *  This function returns an enum from timebase::dateorder giving the
    00550        *  preferred ordering if the format "x" given to time_put::put() only
    00551        *  uses month, day, and year.  This function is a hook for derived
    00552        *  classes to change the value returned.
    00553        *
    00554        *  @return  A member of timebase::dateorder.
    00555       */
    00556       virtual dateorder
    00557       do_date_order() const;
    00558
    00559       /**
    00560        *  @brief  Parse input time string.
    00561        *
    00562        *  This function parses a time according to the format "x" and puts the
    00563        *  results into a user-supplied struct tm.  This function is a hook for
    00564        *  derived classes to change the value returned.  @see get_time() for
    00565        *  details.
    00566        *
    00567        *  @param  beg  Start of string to parse.
    00568        *  @param  end  End of string to parse.
    00569        *  @param  io  Source of the locale.
    00570        *  @param  err  Error flags to set.
    00571        *  @param  tm  Pointer to struct tm to fill in.
    00572        *  @return  Iterator to first char beyond time string.
    00573       */
    00574       virtual iter_type
    00575       do_get_time(iter_type __beg, iter_type __end, ios_base& __io,
    00576           ios_base::iostate& __err, tm* __tm) const;
    00577
    00578       /**
    00579        *  @brief  Parse input date string.
    00580        *
    00581        *  This function parses a date according to the format "X" and puts the
    00582        *  results into a user-supplied struct tm.  This function is a hook for
    00583        *  derived classes to change the value returned.  @see get_date() for
    00584        *  details.
    00585        *
    00586        *  @param  beg  Start of string to parse.
    00587        *  @param  end  End of string to parse.
    00588        *  @param  io  Source of the locale.
    00589        *  @param  err  Error flags to set.
    00590        *  @param  tm  Pointer to struct tm to fill in.
    00591        *  @return  Iterator to first char beyond date string.
    00592       */
    00593       virtual iter_type
    00594       do_get_date(iter_type __beg, iter_type __end, ios_base& __io,
    00595           ios_base::iostate& __err, tm* __tm) const;
    00596
    00597       /**
    00598        *  @brief  Parse input weekday string.
    00599        *
    00600        *  This function parses a weekday name and puts the results into a
    00601        *  user-supplied struct tm.  This function is a hook for derived
    00602        *  classes to change the value returned.  @see get_weekday() for
    00603        *  details.
    00604        *
    00605        *  @param  beg  Start of string to parse.
    00606        *  @param  end  End of string to parse.
    00607        *  @param  io  Source of the locale.
    00608        *  @param  err  Error flags to set.
    00609        *  @param  tm  Pointer to struct tm to fill in.
    00610        *  @return  Iterator to first char beyond weekday name.
    00611       */
    00612       virtual iter_type
    00613       do_get_weekday(iter_type __beg, iter_type __end, ios_base&,
    00614              ios_base::iostate& __err, tm* __tm) const;
    00615
    00616       /**
    00617        *  @brief  Parse input month string.
    00618        *
    00619        *  This function parses a month name and puts the results into a
    00620        *  user-supplied struct tm.  This function is a hook for derived
    00621        *  classes to change the value returned.  @see get_monthname() for
    00622        *  details.
    00623        *
    00624        *  @param  beg  Start of string to parse.
    00625        *  @param  end  End of string to parse.
    00626        *  @param  io  Source of the locale.
    00627        *  @param  err  Error flags to set.
    00628        *  @param  tm  Pointer to struct tm to fill in.
    00629        *  @return  Iterator to first char beyond month name.
    00630       */
    00631       virtual iter_type
    00632       do_get_monthname(iter_type __beg, iter_type __end, ios_base&,
    00633                ios_base::iostate& __err, tm* __tm) const;
    00634
    00635       /**
    00636        *  @brief  Parse input year string.
    00637        *
    00638        *  This function reads up to 4 characters to parse a year string and
    00639        *  puts the results into a user-supplied struct tm.  This function is a
    00640        *  hook for derived classes to change the value returned.  @see
    00641        *  get_year() for details.
    00642        *
    00643        *  @param  beg  Start of string to parse.
    00644        *  @param  end  End of string to parse.
    00645        *  @param  io  Source of the locale.
    00646        *  @param  err  Error flags to set.
    00647        *  @param  tm  Pointer to struct tm to fill in.
    00648        *  @return  Iterator to first char beyond year.
    00649       */
    00650       virtual iter_type
    00651       do_get_year(iter_type __beg, iter_type __end, ios_base& __io,
    00652           ios_base::iostate& __err, tm* __tm) const;
    00653
    00654       // Extract numeric component of length __len.
    00655       iter_type
    00656       _M_extract_num(iter_type __beg, iter_type __end, int& __member,
    00657              int __min, int __max, size_t __len,
    00658              ios_base& __io, ios_base::iostate& __err) const;
    00659
    00660       // Extract day or month name, or any unique array of string
    00661       // literals in a const _CharT* array.
    00662       iter_type
    00663       _M_extract_name(iter_type __beg, iter_type __end, int& __member,
    00664               const _CharT** __names, size_t __indexlen,
    00665               ios_base& __io, ios_base::iostate& __err) const;
    00666
    00667       // Extract on a component-by-component basis, via __format argument.
    00668       iter_type
    00669       _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,
    00670                 ios_base::iostate& __err, tm* __tm,
    00671                 const _CharT* __format) const;
    00672     };
    00673
    00674   template<typename _CharT, typename _InIter>
    00675     locale::id time_get<_CharT, _InIter>::id;
    00676
    00677   /// class time_get_byname [22.2.5.2].
    00678   template<typename _CharT, typename _InIter>
    00679     class time_get_byname : public time_get<_CharT, _InIter>
    00680     {
    00681     public:
    00682       // Types:
    00683       typedef _CharT            char_type;
    00684       typedef _InIter           iter_type;
    00685
    00686       explicit
    00687       time_get_byname(const char*, size_t __refs = 0)
    00688       : time_get<_CharT, _InIter>(__refs) { }
    00689
    00690     protected:
    00691       virtual
    00692       ~time_get_byname() { }
    00693     };
    00694
    00695   /**
    00696    *  @brief  Facet for outputting dates and times.
    00697    *
    00698    *  This facet encapsulates the code to format and output dates and times
    00699    *  according to formats used by strftime().
    00700    *
    00701    *  The time_put template uses protected virtual functions to provide the
    00702    *  actual results.  The public accessors forward the call to the virtual
    00703    *  functions.  These virtual functions are hooks for developers to
    00704    *  implement the behavior they require from the time_put facet.
    00705   */
    00706   template<typename _CharT, typename _OutIter>
    00707     class time_put : public locale::facet
    00708     {
    00709     public:
    00710       // Types:
    00711       //@{
    00712       /// Public typedefs
    00713       typedef _CharT            char_type;
    00714       typedef _OutIter          iter_type;
    00715       //@}
    00716
    00717       /// Numpunct facet id.
    00718       static locale::id         id;
    00719
    00720       /**
    00721        *  @brief  Constructor performs initialization.
    00722        *
    00723        *  This is the constructor provided by the standard.
    00724        *
    00725        *  @param refs  Passed to the base facet class.
    00726       */
    00727       explicit
    00728       time_put(size_t __refs = 0)
    00729       : facet(__refs) { }
    00730
    00731       /**
    00732        *  @brief  Format and output a time or date.
    00733        *
    00734        *  This function formats the data in struct tm according to the
    00735        *  provided format string.  The format string is interpreted as by
    00736        *  strftime().
    00737        *
    00738        *  @param  s  The stream to write to.
    00739        *  @param  io  Source of locale.
    00740        *  @param  fill  char_type to use for padding.
    00741        *  @param  tm  Struct tm with date and time info to format.
    00742        *  @param  beg  Start of format string.
    00743        *  @param  end  End of format string.
    00744        *  @return  Iterator after writing.
    00745        */
    00746       iter_type
    00747       put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
    00748       const _CharT* __beg, const _CharT* __end) const;
    00749
    00750       /**
    00751        *  @brief  Format and output a time or date.
    00752        *
    00753        *  This function formats the data in struct tm according to the
    00754        *  provided format char and optional modifier.  The format and modifier
    00755        *  are interpreted as by strftime().  It does so by returning
    00756        *  time_put::do_put().
    00757        *
    00758        *  @param  s  The stream to write to.
    00759        *  @param  io  Source of locale.
    00760        *  @param  fill  char_type to use for padding.
    00761        *  @param  tm  Struct tm with date and time info to format.
    00762        *  @param  format  Format char.
    00763        *  @param  mod  Optional modifier char.
    00764        *  @return  Iterator after writing.
    00765        */
    00766       iter_type
    00767       put(iter_type __s, ios_base& __io, char_type __fill,
    00768       const tm* __tm, char __format, char __mod = 0) const
    00769       { return this->do_put(__s, __io, __fill, __tm, __format, __mod); }
    00770
    00771     protected:
    00772       /// Destructor.
    00773       virtual
    00774       ~time_put()
    00775       { }
    00776
    00777       /**
    00778        *  @brief  Format and output a time or date.
    00779        *
    00780        *  This function formats the data in struct tm according to the
    00781        *  provided format char and optional modifier.  This function is a hook
    00782        *  for derived classes to change the value returned.  @see put() for
    00783        *  more details.
    00784        *
    00785        *  @param  s  The stream to write to.
    00786        *  @param  io  Source of locale.
    00787        *  @param  fill  char_type to use for padding.
    00788        *  @param  tm  Struct tm with date and time info to format.
    00789        *  @param  format  Format char.
    00790        *  @param  mod  Optional modifier char.
    00791        *  @return  Iterator after writing.
    00792        */
    00793       virtual iter_type
    00794       do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
    00795          char __format, char __mod) const;
    00796     };
    00797
    00798   template<typename _CharT, typename _OutIter>
    00799     locale::id time_put<_CharT, _OutIter>::id;
    00800
    00801   /// class time_put_byname [22.2.5.4].
    00802   template<typename _CharT, typename _OutIter>
    00803     class time_put_byname : public time_put<_CharT, _OutIter>
    00804     {
    00805     public:
    00806       // Types:
    00807       typedef _CharT            char_type;
    00808       typedef _OutIter          iter_type;
    00809
    00810       explicit
    00811       time_put_byname(const char*, size_t __refs = 0)
    00812       : time_put<_CharT, _OutIter>(__refs)
    00813       { };
    00814
    00815     protected:
    00816       virtual
    00817       ~time_put_byname() { }
    00818     };
    00819
    00820
    00821   /**
    00822    *  @brief  Money format ordering data.
    00823    *
    00824    *  This class contains an ordered array of 4 fields to represent the
    00825    *  pattern for formatting a money amount.  Each field may contain one entry
    00826    *  from the part enum.  symbol, sign, and value must be present and the
    00827    *  remaining field must contain either none or space.  @see
    00828    *  moneypunct::pos_format() and moneypunct::neg_format() for details of how
    00829    *  these fields are interpreted.
    00830   */
    00831   class money_base
    00832   {
    00833   public:
    00834     enum part { none, space, symbol, sign, value };
    00835     struct pattern { char field[4]; };
    00836
    00837     static const pattern _S_default_pattern;
    00838
    00839     enum
    00840     {
    00841       _S_minus,
    00842       _S_zero,
    00843       _S_end = 11
    00844     };
    00845
    00846     // String literal of acceptable (narrow) input/output, for
    00847     // money_get/money_put. "-0123456789"
    00848     static const char* _S_atoms;
    00849
    00850     // Construct and return valid pattern consisting of some combination of:
    00851     // space none symbol sign value
    00852     static pattern
    00853     _S_construct_pattern(char __precedes, char __space, char __posn);
    00854   };
    00855
    00856   template<typename _CharT, bool _Intl>
    00857     struct __moneypunct_cache : public locale::facet
    00858     {
    00859       const char*           _M_grouping;
    00860       size_t                            _M_grouping_size;
    00861       bool              _M_use_grouping;
    00862       _CharT                _M_decimal_point;
    00863       _CharT                _M_thousands_sep;
    00864       const _CharT*         _M_curr_symbol;
    00865       size_t                            _M_curr_symbol_size;
    00866       const _CharT*         _M_positive_sign;
    00867       size_t                            _M_positive_sign_size;
    00868       const _CharT*         _M_negative_sign;
    00869       size_t                            _M_negative_sign_size;
    00870       int               _M_frac_digits;
    00871       money_base::pattern       _M_pos_format;
    00872       money_base::pattern           _M_neg_format;
    00873
    00874       // A list of valid numeric literals for input and output: in the standard
    00875       // "C" locale, this is "-0123456789". This array contains the chars after
    00876       // having been passed through the current locale's ctype<_CharT>.widen().
    00877       _CharT                _M_atoms[money_base::_S_end];
    00878
    00879       bool              _M_allocated;
    00880
    00881       __moneypunct_cache(size_t __refs = 0) : facet(__refs),
    00882       _M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),
    00883       _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()),
    00884       _M_curr_symbol(NULL), _M_curr_symbol_size(0),
    00885       _M_positive_sign(NULL), _M_positive_sign_size(0),
    00886       _M_negative_sign(NULL), _M_negative_sign_size(0),
    00887       _M_frac_digits(0),
    00888       _M_pos_format(money_base::pattern()),
    00889       _M_neg_format(money_base::pattern()), _M_allocated(false)
    00890       { }
    00891
    00892       ~__moneypunct_cache();
    00893
    00894       void
    00895       _M_cache(const locale& __loc);
    00896
    00897     private:
    00898       __moneypunct_cache&
    00899       operator=(const __moneypunct_cache&);
    00900
    00901       explicit
    00902       __moneypunct_cache(const __moneypunct_cache&);
    00903     };
    00904
    00905   template<typename _CharT, bool _Intl>
    00906     __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache()
    00907     {
    00908       if (_M_allocated)
    00909     {
    00910       delete [] _M_grouping;
    00911       delete [] _M_curr_symbol;
    00912       delete [] _M_positive_sign;
    00913       delete [] _M_negative_sign;
    00914     }
    00915     }
    00916
    00917   /**
    00918    *  @brief  Facet for formatting data for money amounts.
    00919    *
    00920    *  This facet encapsulates the punctuation, grouping and other formatting
    00921    *  features of money amount string representations.
    00922   */
    00923   template<typename _CharT, bool _Intl>
    00924     class moneypunct : public locale::facet, public money_base
    00925     {
    00926     public:
    00927       // Types:
    00928       //@{
    00929       /// Public typedefs
    00930       typedef _CharT            char_type;
    00931       typedef basic_string<_CharT>  string_type;
    00932       //@}
    00933       typedef __moneypunct_cache<_CharT, _Intl>     __cache_type;
    00934
    00935     private:
    00936       __cache_type*         _M_data;
    00937
    00938     public:
    00939       /// This value is provided by the standard, but no reason for its
    00940       /// existence.
    00941       static const bool         intl = _Intl;
    00942       /// Numpunct facet id.
    00943       static locale::id         id;
    00944
    00945       /**
    00946        *  @brief  Constructor performs initialization.
    00947        *
    00948        *  This is the constructor provided by the standard.
    00949        *
    00950        *  @param refs  Passed to the base facet class.
    00951       */
    00952       explicit
    00953       moneypunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
    00954       { _M_initialize_moneypunct(); }
    00955
    00956       /**
    00957        *  @brief  Constructor performs initialization.
    00958        *
    00959        *  This is an internal constructor.
    00960        *
    00961        *  @param cache  Cache for optimization.
    00962        *  @param refs  Passed to the base facet class.
    00963       */
    00964       explicit
    00965       moneypunct(__cache_type* __cache, size_t __refs = 0)
    00966       : facet(__refs), _M_data(__cache)
    00967       { _M_initialize_moneypunct(); }
    00968
    00969       /**
    00970        *  @brief  Internal constructor. Not for general use.
    00971        *
    00972        *  This is a constructor for use by the library itself to set up new
    00973        *  locales.
    00974        *
    00975        *  @param cloc  The "C" locale.
    00976        *  @param s  The name of a locale.
    00977        *  @param refs  Passed to the base facet class.
    00978       */
    00979       explicit
    00980       moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
    00981       : facet(__refs), _M_data(NULL)
    00982       { _M_initialize_moneypunct(__cloc, __s); }
    00983
    00984       /**
    00985        *  @brief  Return decimal point character.
    00986        *
    00987        *  This function returns a char_type to use as a decimal point.  It
    00988        *  does so by returning returning
    00989        *  moneypunct<char_type>::do_decimal_point().
    00990        *
    00991        *  @return  @a char_type representing a decimal point.
    00992       */
    00993       char_type
    00994       decimal_point() const
    00995       { return this->do_decimal_point(); }
    00996
    00997       /**
    00998        *  @brief  Return thousands separator character.
    00999        *
    01000        *  This function returns a char_type to use as a thousands
    01001        *  separator.  It does so by returning returning
    01002        *  moneypunct<char_type>::do_thousands_sep().
    01003        *
    01004        *  @return  char_type representing a thousands separator.
    01005       */
    01006       char_type
    01007       thousands_sep() const
    01008       { return this->do_thousands_sep(); }
    01009
    01010       /**
    01011        *  @brief  Return grouping specification.
    01012        *
    01013        *  This function returns a string representing groupings for the
    01014        *  integer part of an amount.  Groupings indicate where thousands
    01015        *  separators should be inserted.
    01016        *
    01017        *  Each char in the return string is interpret as an integer rather
    01018        *  than a character.  These numbers represent the number of digits in a
    01019        *  group.  The first char in the string represents the number of digits
    01020        *  in the least significant group.  If a char is negative, it indicates
    01021        *  an unlimited number of digits for the group.  If more chars from the
    01022        *  string are required to group a number, the last char is used
    01023        *  repeatedly.
    01024        *
    01025        *  For example, if the grouping() returns "\003\002" and is applied to
    01026        *  the number 123456789, this corresponds to 12,34,56,789.  Note that
    01027        *  if the string was "32", this would put more than 50 digits into the
    01028        *  least significant group if the character set is ASCII.
    01029        *
    01030        *  The string is returned by calling
    01031        *  moneypunct<char_type>::do_grouping().
    01032        *
    01033        *  @return  string representing grouping specification.
    01034       */
    01035       string
    01036       grouping() const
    01037       { return this->do_grouping(); }
    01038
    01039       /**
    01040        *  @brief  Return currency symbol string.
    01041        *
    01042        *  This function returns a string_type to use as a currency symbol.  It
    01043        *  does so by returning returning
    01044        *  moneypunct<char_type>::do_curr_symbol().
    01045        *
    01046        *  @return  @a string_type representing a currency symbol.
    01047       */
    01048       string_type
    01049       curr_symbol() const
    01050       { return this->do_curr_symbol(); }
    01051
    01052       /**
    01053        *  @brief  Return positive sign string.
    01054        *
    01055        *  This function returns a string_type to use as a sign for positive
    01056        *  amounts.  It does so by returning returning
    01057        *  moneypunct<char_type>::do_positive_sign().
    01058        *
    01059        *  If the return value contains more than one character, the first
    01060        *  character appears in the position indicated by pos_format() and the
    01061        *  remainder appear at the end of the formatted string.
    01062        *
    01063        *  @return  @a string_type representing a positive sign.
    01064       */
    01065       string_type
    01066       positive_sign() const
    01067       { return this->do_positive_sign(); }
    01068
    01069       /**
    01070        *  @brief  Return negative sign string.
    01071        *
    01072        *  This function returns a string_type to use as a sign for negative
    01073        *  amounts.  It does so by returning returning
    01074        *  moneypunct<char_type>::do_negative_sign().
    01075        *
    01076        *  If the return value contains more than one character, the first
    01077        *  character appears in the position indicated by neg_format() and the
    01078        *  remainder appear at the end of the formatted string.
    01079        *
    01080        *  @return  @a string_type representing a negative sign.
    01081       */
    01082       string_type
    01083       negative_sign() const
    01084       { return this->do_negative_sign(); }
    01085
    01086       /**
    01087        *  @brief  Return number of digits in fraction.
    01088        *
    01089        *  This function returns the exact number of digits that make up the
    01090        *  fractional part of a money amount.  It does so by returning
    01091        *  returning moneypunct<char_type>::do_frac_digits().
    01092        *
    01093        *  The fractional part of a money amount is optional.  But if it is
    01094        *  present, there must be frac_digits() digits.
    01095        *
    01096        *  @return  Number of digits in amount fraction.
    01097       */
    01098       int
    01099       frac_digits() const
    01100       { return this->do_frac_digits(); }
    01101
    01102       //@{
    01103       /**
    01104        *  @brief  Return pattern for money values.
    01105        *
    01106        *  This function returns a pattern describing the formatting of a
    01107        *  positive or negative valued money amount.  It does so by returning
    01108        *  returning moneypunct<char_type>::do_pos_format() or
    01109        *  moneypunct<char_type>::do_neg_format().
    01110        *
    01111        *  The pattern has 4 fields describing the ordering of symbol, sign,
    01112        *  value, and none or space.  There must be one of each in the pattern.
    01113        *  The none and space enums may not appear in the first field and space
    01114        *  may not appear in the final field.
    01115        *
    01116        *  The parts of a money string must appear in the order indicated by
    01117        *  the fields of the pattern.  The symbol field indicates that the
    01118        *  value of curr_symbol() may be present.  The sign field indicates
    01119        *  that the value of positive_sign() or negative_sign() must be
    01120        *  present.  The value field indicates that the absolute value of the
    01121        *  money amount is present.  none indicates 0 or more whitespace
    01122        *  characters, except at the end, where it permits no whitespace.
    01123        *  space indicates that 1 or more whitespace characters must be
    01124        *  present.
    01125        *
    01126        *  For example, for the US locale and pos_format() pattern
    01127        *  {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() ==
    01128        *  '+', and value 10.01, and options set to force the symbol, the
    01129        *  corresponding string is "$+10.01".
    01130        *
    01131        *  @return  Pattern for money values.
    01132       */
    01133       pattern
    01134       pos_format() const
    01135       { return this->do_pos_format(); }
    01136
    01137       pattern
    01138       neg_format() const
    01139       { return this->do_neg_format(); }
    01140       //@}
    01141
    01142     protected:
    01143       /// Destructor.
    01144       virtual
    01145       ~moneypunct();
    01146
    01147       /**
    01148        *  @brief  Return decimal point character.
    01149        *
    01150        *  Returns a char_type to use as a decimal point.  This function is a
    01151        *  hook for derived classes to change the value returned.
    01152        *
    01153        *  @return  @a char_type representing a decimal point.
    01154       */
    01155       virtual char_type
    01156       do_decimal_point() const
    01157       { return _M_data->_M_decimal_point; }
    01158
    01159       /**
    01160        *  @brief  Return thousands separator character.
    01161        *
    01162        *  Returns a char_type to use as a thousands separator.  This function
    01163        *  is a hook for derived classes to change the value returned.
    01164        *
    01165        *  @return  @a char_type representing a thousands separator.
    01166       */
    01167       virtual char_type
    01168       do_thousands_sep() const
    01169       { return _M_data->_M_thousands_sep; }
    01170
    01171       /**
    01172        *  @brief  Return grouping specification.
    01173        *
    01174        *  Returns a string representing groupings for the integer part of a
    01175        *  number.  This function is a hook for derived classes to change the
    01176        *  value returned.  @see grouping() for details.
    01177        *
    01178        *  @return  String representing grouping specification.
    01179       */
    01180       virtual string
    01181       do_grouping() const
    01182       { return _M_data->_M_grouping; }
    01183
    01184       /**
    01185        *  @brief  Return currency symbol string.
    01186        *
    01187        *  This function returns a string_type to use as a currency symbol.
    01188        *  This function is a hook for derived classes to change the value
    01189        *  returned.  @see curr_symbol() for details.
    01190        *
    01191        *  @return  @a string_type representing a currency symbol.
    01192       */
    01193       virtual string_type
    01194       do_curr_symbol()   const
    01195       { return _M_data->_M_curr_symbol; }
    01196
    01197       /**
    01198        *  @brief  Return positive sign string.
    01199        *
    01200        *  This function returns a string_type to use as a sign for positive
    01201        *  amounts.  This function is a hook for derived classes to change the
    01202        *  value returned.  @see positive_sign() for details.
    01203        *
    01204        *  @return  @a string_type representing a positive sign.
    01205       */
    01206       virtual string_type
    01207       do_positive_sign() const
    01208       { return _M_data->_M_positive_sign; }
    01209
    01210       /**
    01211        *  @brief  Return negative sign string.
    01212        *
    01213        *  This function returns a string_type to use as a sign for negative
    01214        *  amounts.  This function is a hook for derived classes to change the
    01215        *  value returned.  @see negative_sign() for details.
    01216        *
    01217        *  @return  @a string_type representing a negative sign.
    01218       */
    01219       virtual string_type
    01220       do_negative_sign() const
    01221       { return _M_data->_M_negative_sign; }
    01222
    01223       /**
    01224        *  @brief  Return number of digits in fraction.
    01225        *
    01226        *  This function returns the exact number of digits that make up the
    01227        *  fractional part of a money amount.  This function is a hook for
    01228        *  derived classes to change the value returned.  @see frac_digits()
    01229        *  for details.
    01230        *
    01231        *  @return  Number of digits in amount fraction.
    01232       */
    01233       virtual int
    01234       do_frac_digits() const
    01235       { return _M_data->_M_frac_digits; }
    01236
    01237       /**
    01238        *  @brief  Return pattern for money values.
    01239        *
    01240        *  This function returns a pattern describing the formatting of a
    01241        *  positive valued money amount.  This function is a hook for derived
    01242        *  classes to change the value returned.  @see pos_format() for
    01243        *  details.
    01244        *
    01245        *  @return  Pattern for money values.
    01246       */
    01247       virtual pattern
    01248       do_pos_format() const
    01249       { return _M_data->_M_pos_format; }
    01250
    01251       /**
    01252        *  @brief  Return pattern for money values.
    01253        *
    01254        *  This function returns a pattern describing the formatting of a
    01255        *  negative valued money amount.  This function is a hook for derived
    01256        *  classes to change the value returned.  @see neg_format() for
    01257        *  details.
    01258        *
    01259        *  @return  Pattern for money values.
    01260       */
    01261       virtual pattern
    01262       do_neg_format() const
    01263       { return _M_data->_M_neg_format; }
    01264
    01265       // For use at construction time only.
    01266        void
    01267        _M_initialize_moneypunct(__c_locale __cloc = NULL,
    01268                 const char* __name = NULL);
    01269     };
    01270
    01271   template<typename _CharT, bool _Intl>
    01272     locale::id moneypunct<_CharT, _Intl>::id;
    01273
    01274   template<typename _CharT, bool _Intl>
    01275     const bool moneypunct<_CharT, _Intl>::intl;
    01276
    01277   template<>
    01278     moneypunct<char, true>::~moneypunct();
    01279
    01280   template<>
    01281     moneypunct<char, false>::~moneypunct();
    01282
    01283   template<>
    01284     void
    01285     moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*);
    01286
    01287   template<>
    01288     void
    01289     moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*);
    01290
    01291 #ifdef _GLIBCXX_USE_WCHAR_T
    01292   template<>
    01293     moneypunct<wchar_t, true>::~moneypunct();
    01294
    01295   template<>
    01296     moneypunct<wchar_t, false>::~moneypunct();
    01297
    01298   template<>
    01299     void
    01300     moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
    01301                             const char*);
    01302
    01303   template<>
    01304     void
    01305     moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
    01306                              const char*);
    01307 #endif
    01308
    01309   /// class moneypunct_byname [22.2.6.4].
    01310   template<typename _CharT, bool _Intl>
    01311     class moneypunct_byname : public moneypunct<_CharT, _Intl>
    01312     {
    01313     public:
    01314       typedef _CharT            char_type;
    01315       typedef basic_string<_CharT>  string_type;
    01316
    01317       static const bool intl = _Intl;
    01318
    01319       explicit
    01320       moneypunct_byname(const char* __s, size_t __refs = 0)
    01321       : moneypunct<_CharT, _Intl>(__refs)
    01322       {
    01323     if (__builtin_strcmp(__s, "C") != 0
    01324         && __builtin_strcmp(__s, "POSIX") != 0)
    01325       {
    01326         __c_locale __tmp;
    01327         this->_S_create_c_locale(__tmp, __s);
    01328         this->_M_initialize_moneypunct(__tmp);
    01329         this->_S_destroy_c_locale(__tmp);
    01330       }
    01331       }
    01332
    01333     protected:
    01334       virtual
    01335       ~moneypunct_byname() { }
    01336     };
    01337
    01338   template<typename _CharT, bool _Intl>
    01339     const bool moneypunct_byname<_CharT, _Intl>::intl;
    01340
    01341 _GLIBCXX_BEGIN_LDBL_NAMESPACE
    01342
    01343   /**
    01344    *  @brief  Facet for parsing monetary amounts.
    01345    *
    01346    *  This facet encapsulates the code to parse and return a monetary
    01347    *  amount from a string.
    01348    *
    01349    *  The money_get template uses protected virtual functions to
    01350    *  provide the actual results.  The public accessors forward the
    01351    *  call to the virtual functions.  These virtual functions are
    01352    *  hooks for developers to implement the behavior they require from
    01353    *  the money_get facet.
    01354   */
    01355   template<typename _CharT, typename _InIter>
    01356     class money_get : public locale::facet
    01357     {
    01358     public:
    01359       // Types:
    01360       //@{
    01361       /// Public typedefs
    01362       typedef _CharT            char_type;
    01363       typedef _InIter           iter_type;
    01364       typedef basic_string<_CharT>  string_type;
    01365       //@}
    01366
    01367       /// Numpunct facet id.
    01368       static locale::id         id;
    01369
    01370       /**
    01371        *  @brief  Constructor performs initialization.
    01372        *
    01373        *  This is the constructor provided by the standard.
    01374        *
    01375        *  @param refs  Passed to the base facet class.
    01376       */
    01377       explicit
    01378       money_get(size_t __refs = 0) : facet(__refs) { }
    01379
    01380       /**
    01381        *  @brief  Read and parse a monetary value.
    01382        *
    01383        *  This function reads characters from @a s, interprets them as a
    01384        *  monetary value according to moneypunct and ctype facets retrieved
    01385        *  from io.getloc(), and returns the result in @a units as an integral
    01386        *  value moneypunct::frac_digits() * the actual amount.  For example,
    01387        *  the string $10.01 in a US locale would store 1001 in @a units.
    01388        *
    01389        *  Any characters not part of a valid money amount are not consumed.
    01390        *
    01391        *  If a money value cannot be parsed from the input stream, sets
    01392        *  err=(err|io.failbit).  If the stream is consumed before finishing
    01393        *  parsing,  sets err=(err|io.failbit|io.eofbit).  @a units is
    01394        *  unchanged if parsing fails.
    01395        *
    01396        *  This function works by returning the result of do_get().
    01397        *
    01398        *  @param  s  Start of characters to parse.
    01399        *  @param  end  End of characters to parse.
    01400        *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.
    01401        *  @param  io  Source of facets and io state.
    01402        *  @param  err  Error field to set if parsing fails.
    01403        *  @param  units  Place to store result of parsing.
    01404        *  @return  Iterator referencing first character beyond valid money
    01405        *       amount.
    01406        */
    01407       iter_type
    01408       get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
    01409       ios_base::iostate& __err, long double& __units) const
    01410       { return this->do_get(__s, __end, __intl, __io, __err, __units); }
    01411
    01412       /**
    01413        *  @brief  Read and parse a monetary value.
    01414        *
    01415        *  This function reads characters from @a s, interprets them as a
    01416        *  monetary value according to moneypunct and ctype facets retrieved
    01417        *  from io.getloc(), and returns the result in @a digits.  For example,
    01418        *  the string $10.01 in a US locale would store "1001" in @a digits.
    01419        *
    01420        *  Any characters not part of a valid money amount are not consumed.
    01421        *
    01422        *  If a money value cannot be parsed from the input stream, sets
    01423        *  err=(err|io.failbit).  If the stream is consumed before finishing
    01424        *  parsing,  sets err=(err|io.failbit|io.eofbit).
    01425        *
    01426        *  This function works by returning the result of do_get().
    01427        *
    01428        *  @param  s  Start of characters to parse.
    01429        *  @param  end  End of characters to parse.
    01430        *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.
    01431        *  @param  io  Source of facets and io state.
    01432        *  @param  err  Error field to set if parsing fails.
    01433        *  @param  digits  Place to store result of parsing.
    01434        *  @return  Iterator referencing first character beyond valid money
    01435        *       amount.
    01436        */
    01437       iter_type
    01438       get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
    01439       ios_base::iostate& __err, string_type& __digits) const
    01440       { return this->do_get(__s, __end, __intl, __io, __err, __digits); }
    01441
    01442     protected:
    01443       /// Destructor.
    01444       virtual
    01445       ~money_get() { }
    01446
    01447       /**
    01448        *  @brief  Read and parse a monetary value.
    01449        *
    01450        *  This function reads and parses characters representing a monetary
    01451        *  value.  This function is a hook for derived classes to change the
    01452        *  value returned.  @see get() for details.
    01453        */
    01454       // XXX GLIBCXX_ABI Deprecated
    01455 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
    01456       virtual iter_type
    01457       __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
    01458            ios_base::iostate& __err, double& __units) const;
    01459 #else
    01460       virtual iter_type
    01461       do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
    01462          ios_base::iostate& __err, long double& __units) const;
    01463 #endif
    01464
    01465       /**
    01466        *  @brief  Read and parse a monetary value.
    01467        *
    01468        *  This function reads and parses characters representing a monetary
    01469        *  value.  This function is a hook for derived classes to change the
    01470        *  value returned.  @see get() for details.
    01471        */
    01472       virtual iter_type
    01473       do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
    01474          ios_base::iostate& __err, string_type& __digits) const;
    01475
    01476       // XXX GLIBCXX_ABI Deprecated
    01477 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
    01478       virtual iter_type
    01479       do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
    01480          ios_base::iostate& __err, long double& __units) const;
    01481 #endif
    01482
    01483       template<bool _Intl>
    01484         iter_type
    01485         _M_extract(iter_type __s, iter_type __end, ios_base& __io,
    01486            ios_base::iostate& __err, string& __digits) const;
    01487     };
    01488
    01489   template<typename _CharT, typename _InIter>
    01490     locale::id money_get<_CharT, _InIter>::id;
    01491
    01492   /**
    01493    *  @brief  Facet for outputting monetary amounts.
    01494    *
    01495    *  This facet encapsulates the code to format and output a monetary
    01496    *  amount.
    01497    *
    01498    *  The money_put template uses protected virtual functions to
    01499    *  provide the actual results.  The public accessors forward the
    01500    *  call to the virtual functions.  These virtual functions are
    01501    *  hooks for developers to implement the behavior they require from
    01502    *  the money_put facet.
    01503   */
    01504   template<typename _CharT, typename _OutIter>
    01505     class money_put : public locale::facet
    01506     {
    01507     public:
    01508       //@{
    01509       /// Public typedefs
    01510       typedef _CharT            char_type;
    01511       typedef _OutIter          iter_type;
    01512       typedef basic_string<_CharT>  string_type;
    01513       //@}
    01514
    01515       /// Numpunct facet id.
    01516       static locale::id         id;
    01517
    01518       /**
    01519        *  @brief  Constructor performs initialization.
    01520        *
    01521        *  This is the constructor provided by the standard.
    01522        *
    01523        *  @param refs  Passed to the base facet class.
    01524       */
    01525       explicit
    01526       money_put(size_t __refs = 0) : facet(__refs) { }
    01527
    01528       /**
    01529        *  @brief  Format and output a monetary value.
    01530        *
    01531        *  This function formats @a units as a monetary value according to
    01532        *  moneypunct and ctype facets retrieved from io.getloc(), and writes
    01533        *  the resulting characters to @a s.  For example, the value 1001 in a
    01534        *  US locale would write "$10.01" to @a s.
    01535        *
    01536        *  This function works by returning the result of do_put().
    01537        *
    01538        *  @param  s  The stream to write to.
    01539        *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.
    01540        *  @param  io  Source of facets and io state.
    01541        *  @param  fill  char_type to use for padding.
    01542        *  @param  units  Place to store result of parsing.
    01543        *  @return  Iterator after writing.
    01544        */
    01545       iter_type
    01546       put(iter_type __s, bool __intl, ios_base& __io,
    01547       char_type __fill, long double __units) const
    01548       { return this->do_put(__s, __intl, __io, __fill, __units); }
    01549
    01550       /**
    01551        *  @brief  Format and output a monetary value.
    01552        *
    01553        *  This function formats @a digits as a monetary value according to
    01554        *  moneypunct and ctype facets retrieved from io.getloc(), and writes
    01555        *  the resulting characters to @a s.  For example, the string "1001" in
    01556        *  a US locale would write "$10.01" to @a s.
    01557        *
    01558        *  This function works by returning the result of do_put().
    01559        *
    01560        *  @param  s  The stream to write to.
    01561        *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.
    01562        *  @param  io  Source of facets and io state.
    01563        *  @param  fill  char_type to use for padding.
    01564        *  @param  units  Place to store result of parsing.
    01565        *  @return  Iterator after writing.
    01566        */
    01567       iter_type
    01568       put(iter_type __s, bool __intl, ios_base& __io,
    01569       char_type __fill, const string_type& __digits) const
    01570       { return this->do_put(__s, __intl, __io, __fill, __digits); }
    01571
    01572     protected:
    01573       /// Destructor.
    01574       virtual
    01575       ~money_put() { }
    01576
    01577       /**
    01578        *  @brief  Format and output a monetary value.
    01579        *
    01580        *  This function formats @a units as a monetary value according to
    01581        *  moneypunct and ctype facets retrieved from io.getloc(), and writes
    01582        *  the resulting characters to @a s.  For example, the value 1001 in a
    01583        *  US locale would write "$10.01" to @a s.
    01584        *
    01585        *  This function is a hook for derived classes to change the value
    01586        *  returned.  @see put().
    01587        *
    01588        *  @param  s  The stream to write to.
    01589        *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.
    01590        *  @param  io  Source of facets and io state.
    01591        *  @param  fill  char_type to use for padding.
    01592        *  @param  units  Place to store result of parsing.
    01593        *  @return  Iterator after writing.
    01594        */
    01595       // XXX GLIBCXX_ABI Deprecated
    01596 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
    01597       virtual iter_type
    01598       __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
    01599            double __units) const;
    01600 #else
    01601       virtual iter_type
    01602       do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
    01603          long double __units) const;
    01604 #endif
    01605
    01606       /**
    01607        *  @brief  Format and output a monetary value.
    01608        *
    01609        *  This function formats @a digits as a monetary value according to
    01610        *  moneypunct and ctype facets retrieved from io.getloc(), and writes
    01611        *  the resulting characters to @a s.  For example, the string "1001" in
    01612        *  a US locale would write "$10.01" to @a s.
    01613        *
    01614        *  This function is a hook for derived classes to change the value
    01615        *  returned.  @see put().
    01616        *
    01617        *  @param  s  The stream to write to.
    01618        *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.
    01619        *  @param  io  Source of facets and io state.
    01620        *  @param  fill  char_type to use for padding.
    01621        *  @param  units  Place to store result of parsing.
    01622        *  @return  Iterator after writing.
    01623        */
    01624       virtual iter_type
    01625       do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
    01626          const string_type& __digits) const;
    01627
    01628       // XXX GLIBCXX_ABI Deprecated
    01629 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
    01630       virtual iter_type
    01631       do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
    01632          long double __units) const;
    01633 #endif
    01634
    01635       template<bool _Intl>
    01636         iter_type
    01637         _M_insert(iter_type __s, ios_base& __io, char_type __fill,
    01638           const string_type& __digits) const;
    01639     };
    01640
    01641   template<typename _CharT, typename _OutIter>
    01642     locale::id money_put<_CharT, _OutIter>::id;
    01643
    01644 _GLIBCXX_END_LDBL_NAMESPACE
    01645
    01646   /**
    01647    *  @brief  Messages facet base class providing catalog typedef.
    01648    */
    01649   struct messages_base
    01650   {
    01651     typedef int catalog;
    01652   };
    01653
    01654   /**
    01655    *  @brief  Facet for handling message catalogs
    01656    *
    01657    *  This facet encapsulates the code to retrieve messages from
    01658    *  message catalogs.  The only thing defined by the standard for this facet
    01659    *  is the interface.  All underlying functionality is
    01660    *  implementation-defined.
    01661    *
    01662    *  This library currently implements 3 versions of the message facet.  The
    01663    *  first version (gnu) is a wrapper around gettext, provided by libintl.
    01664    *  The second version (ieee) is a wrapper around catgets.  The final
    01665    *  version (default) does no actual translation.  These implementations are
    01666    *  only provided for char and wchar_t instantiations.
    01667    *
    01668    *  The messages template uses protected virtual functions to
    01669    *  provide the actual results.  The public accessors forward the
    01670    *  call to the virtual functions.  These virtual functions are
    01671    *  hooks for developers to implement the behavior they require from
    01672    *  the messages facet.
    01673   */
    01674   template<typename _CharT>
    01675     class messages : public locale::facet, public messages_base
    01676     {
    01677     public:
    01678       // Types:
    01679       //@{
    01680       /// Public typedefs
    01681       typedef _CharT            char_type;
    01682       typedef basic_string<_CharT>  string_type;
    01683       //@}
    01684
    01685     protected:
    01686       // Underlying "C" library locale information saved from
    01687       // initialization, needed by messages_byname as well.
    01688       __c_locale            _M_c_locale_messages;
    01689       const char*           _M_name_messages;
    01690
    01691     public:
    01692       /// Numpunct facet id.
    01693       static locale::id         id;
    01694
    01695       /**
    01696        *  @brief  Constructor performs initialization.
    01697        *
    01698        *  This is the constructor provided by the standard.
    01699        *
    01700        *  @param refs  Passed to the base facet class.
    01701       */
    01702       explicit
    01703       messages(size_t __refs = 0);
    01704
    01705       // Non-standard.
    01706       /**
    01707        *  @brief  Internal constructor.  Not for general use.
    01708        *
    01709        *  This is a constructor for use by the library itself to set up new
    01710        *  locales.
    01711        *
    01712        *  @param  cloc  The "C" locale.
    01713        *  @param  s  The name of a locale.
    01714        *  @param  refs  Refcount to pass to the base class.
    01715        */
    01716       explicit
    01717       messages(__c_locale __cloc, const char* __s, size_t __refs = 0);
    01718
    01719       /*
    01720        *  @brief  Open a message catalog.
    01721        *
    01722        *  This function opens and returns a handle to a message catalog by
    01723        *  returning do_open(s, loc).
    01724        *
    01725        *  @param  s  The catalog to open.
    01726        *  @param  loc  Locale to use for character set conversions.
    01727        *  @return  Handle to the catalog or value < 0 if open fails.
    01728       */
    01729       catalog
    01730       open(const basic_string<char>& __s, const locale& __loc) const
    01731       { return this->do_open(__s, __loc); }
    01732
    01733       // Non-standard and unorthodox, yet effective.
    01734       /*
    01735        *  @brief  Open a message catalog.
    01736        *
    01737        *  This non-standard function opens and returns a handle to a message
    01738        *  catalog by returning do_open(s, loc).  The third argument provides a
    01739        *  message catalog root directory for gnu gettext and is ignored
    01740        *  otherwise.
    01741        *
    01742        *  @param  s  The catalog to open.
    01743        *  @param  loc  Locale to use for character set conversions.
    01744        *  @param  dir  Message catalog root directory.
    01745        *  @return  Handle to the catalog or value < 0 if open fails.
    01746       */
    01747       catalog
    01748       open(const basic_string<char>&, const locale&, const char*) const;
    01749
    01750       /*
    01751        *  @brief  Look up a string in a message catalog.
    01752        *
    01753        *  This function retrieves and returns a message from a catalog by
    01754        *  returning do_get(c, set, msgid, s).
    01755        *
    01756        *  For gnu, @a set and @a msgid are ignored.  Returns gettext(s).
    01757        *  For default, returns s. For ieee, returns catgets(c,set,msgid,s).
    01758        *
    01759        *  @param  c  The catalog to access.
    01760        *  @param  set  Implementation-defined.
    01761        *  @param  msgid  Implementation-defined.
    01762        *  @param  s  Default return value if retrieval fails.
    01763        *  @return  Retrieved message or @a s if get fails.
    01764       */
    01765       string_type
    01766       get(catalog __c, int __set, int __msgid, const string_type& __s) const
    01767       { return this->do_get(__c, __set, __msgid, __s); }
    01768
    01769       /*
    01770        *  @brief  Close a message catalog.
    01771        *
    01772        *  Closes catalog @a c by calling do_close(c).
    01773        *
    01774        *  @param  c  The catalog to close.
    01775       */
    01776       void
    01777       close(catalog __c) const
    01778       { return this->do_close(__c); }
    01779
    01780     protected:
    01781       /// Destructor.
    01782       virtual
    01783       ~messages();
    01784
    01785       /*
    01786        *  @brief  Open a message catalog.
    01787        *
    01788        *  This function opens and returns a handle to a message catalog in an
    01789        *  implementation-defined manner.  This function is a hook for derived
    01790        *  classes to change the value returned.
    01791        *
    01792        *  @param  s  The catalog to open.
    01793        *  @param  loc  Locale to use for character set conversions.
    01794        *  @return  Handle to the opened catalog, value < 0 if open failed.
    01795       */
    01796       virtual catalog
    01797       do_open(const basic_string<char>&, const locale&) const;
    01798
    01799       /*
    01800        *  @brief  Look up a string in a message catalog.
    01801        *
    01802        *  This function retrieves and returns a message from a catalog in an
    01803        *  implementation-defined manner.  This function is a hook for derived
    01804        *  classes to change the value returned.
    01805        *
    01806        *  For gnu, @a set and @a msgid are ignored.  Returns gettext(s).
    01807        *  For default, returns s. For ieee, returns catgets(c,set,msgid,s).
    01808        *
    01809        *  @param  c  The catalog to access.
    01810        *  @param  set  Implementation-defined.
    01811        *  @param  msgid  Implementation-defined.
    01812        *  @param  s  Default return value if retrieval fails.
    01813        *  @return  Retrieved message or @a s if get fails.
    01814       */
    01815       virtual string_type
    01816       do_get(catalog, int, int, const string_type& __dfault) const;
    01817
    01818       /*
    01819        *  @brief  Close a message catalog.
    01820        *
    01821        *  @param  c  The catalog to close.
    01822       */
    01823       virtual void
    01824       do_close(catalog) const;
    01825
    01826       // Returns a locale and codeset-converted string, given a char* message.
    01827       char*
    01828       _M_convert_to_char(const string_type& __msg) const
    01829       {
    01830     // XXX
    01831     return reinterpret_cast<char*>(const_cast<_CharT*>(__msg.c_str()));
    01832       }
    01833
    01834       // Returns a locale and codeset-converted string, given a char* message.
    01835       string_type
    01836       _M_convert_from_char(char*) const
    01837       {
    01838 #if 0
    01839     // Length of message string without terminating null.
    01840     size_t __len = char_traits<char>::length(__msg) - 1;
    01841
    01842     // "everybody can easily convert the string using
    01843     // mbsrtowcs/wcsrtombs or with iconv()"
    01844
    01845     // Convert char* to _CharT in locale used to open catalog.
    01846     // XXX need additional template parameter on messages class for this..
    01847     // typedef typename codecvt<char, _CharT, _StateT> __codecvt_type;
    01848     typedef typename codecvt<char, _CharT, mbstate_t> __codecvt_type;
    01849
    01850     __codecvt_type::state_type __state;
    01851     // XXX may need to initialize state.
    01852     //initialize_state(__state._M_init());
    01853
    01854     char* __from_next;
    01855     // XXX what size for this string?
    01856     _CharT* __to = static_cast<_CharT*>(__builtin_alloca(__len + 1));
    01857     const __codecvt_type& __cvt = use_facet<__codecvt_type>(_M_locale_conv);
    01858     __cvt.out(__state, __msg, __msg + __len, __from_next,
    01859           __to, __to + __len + 1, __to_next);
    01860     return string_type(__to);
    01861 #endif
    01862 #if 0
    01863     typedef ctype<_CharT> __ctype_type;
    01864     // const __ctype_type& __cvt = use_facet<__ctype_type>(_M_locale_msg);
    01865     const __ctype_type& __cvt = use_facet<__ctype_type>(locale());
    01866     // XXX Again, proper length of converted string an issue here.
    01867     // For now, assume the converted length is not larger.
    01868     _CharT* __dest = static_cast<_CharT*>(__builtin_alloca(__len + 1));
    01869     __cvt.widen(__msg, __msg + __len, __dest);
    01870     return basic_string<_CharT>(__dest);
    01871 #endif
    01872     return string_type();
    01873       }
    01874      };
    01875
    01876   template<typename _CharT>
    01877     locale::id messages<_CharT>::id;
    01878
    01879   // Specializations for required instantiations.
    01880   template<>
    01881     string
    01882     messages<char>::do_get(catalog, int, int, const string&) const;
    01883
    01884 #ifdef _GLIBCXX_USE_WCHAR_T
    01885   template<>
    01886     wstring
    01887     messages<wchar_t>::do_get(catalog, int, int, const wstring&) const;
    01888 #endif
    01889
    01890    /// class messages_byname [22.2.7.2].
    01891    template<typename _CharT>
    01892     class messages_byname : public messages<_CharT>
    01893     {
    01894     public:
    01895       typedef _CharT            char_type;
    01896       typedef basic_string<_CharT>  string_type;
    01897
    01898       explicit
    01899       messages_byname(const char* __s, size_t __refs = 0);
    01900
    01901     protected:
    01902       virtual
    01903       ~messages_byname()
    01904       { }
    01905     };
    01906
    01907 _GLIBCXX_END_NAMESPACE
    01908
    01909 // Include host and configuration specific messages functions.
    01910 #include <bits/messages_members.h>
    01911
    01912 // 22.2.1.5  Template class codecvt
    01913 #include <bits/codecvt.h>
    01914
    01915 #ifndef _GLIBCXX_EXPORT_TEMPLATE
    01916 # include <bits/locale_facets_nonio.tcc>
    01917 #endif
    01918
    01919 #endif