# locale_facets.cc

    00001 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    00002 // Free Software Foundation, Inc.
    00003 //
    00004 // This file is part of the GNU ISO C++ Library.  This library is free
    00005 // software; you can redistribute it and/or modify it under the
    00006 // terms of the GNU General Public License as published by the
    00007 // Free Software Foundation; either version 2, or (at your option)
    00008 // any later version.
    00009
    00010 // This library is distributed in the hope that it will be useful,
    00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013 // GNU General Public License for more details.
    00014
    00015 // You should have received a copy of the GNU General Public License along
    00016 // with this library; see the file COPYING.  If not, write to the Free
    00017 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    00018 // USA.
    00019
    00020 // As a special exception, you may use this file as part of a free software
    00021 // library without restriction.  Specifically, if other files instantiate
    00022 // templates or use macros or inline functions from this file, or you compile
    00023 // this file and link it with other files to produce an executable, this
    00024 // file does not by itself cause the resulting executable to be covered by
    00025 // the GNU General Public License.  This exception does not however
    00026 // invalidate any other reasons why the executable file might be covered by
    00027 // the GNU General Public License.
    00028
    00029 #include <locale>
    00030
    00031 namespace std
    00032 {
    00033   // Definitions for static const data members of time_base.
    00034   template<>
    00035     const char*
    00036     __timepunct_cache<char>::_S_timezones[14] =
    00037     {
    00038       "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
    00039       "IST", "EET", "CST", "JST"
    00040     };
    00041
    00042 #ifdef _GLIBCXX_USE_WCHAR_T
    00043   template<>
    00044     const wchar_t*
    00045     __timepunct_cache<wchar_t>::_S_timezones[14] =
    00046     {
    00047       L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
    00048       L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
    00049     };
    00050 #endif
    00051
    00052   // Definitions for static const data members of money_base.
    00053   const money_base::pattern
    00054   money_base::_S_default_pattern =  { {symbol, sign, none, value} };
    00055
    00056   const char* money_base::_S_atoms = "-0123456789";
    00057
    00058   const char* __num_base::_S_atoms_in = "-+xX0123456789abcdefABCDEF";
    00059   const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF";
    00060
    00061   // _GLIBCXX_RESOLVE_LIB_DEFECTS
    00062   // According to the resolution of DR 231, about 22.2.2.2.2, p11,
    00063   // "str.precision() is specified in the conversion specification".
    00064   void
    00065   __num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod)
    00066   {
    00067     ios_base::fmtflags __flags = __io.flags();
    00068     *__fptr++ = '%';
    00069     // [22.2.2.2.2] Table 60
    00070     if (__flags & ios_base::showpos)
    00071       *__fptr++ = '+';
    00072     if (__flags & ios_base::showpoint)
    00073       *__fptr++ = '#';
    00074
    00075     // As per DR 231: _always_, not only when
    00076     // __flags & ios_base::fixed || __prec > 0
    00077     *__fptr++ = '.';
    00078     *__fptr++ = '*';
    00079
    00080     if (__mod)
    00081       *__fptr++ = __mod;
    00082     ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
    00083     // [22.2.2.2.2] Table 58
    00084     if (__fltfield == ios_base::fixed)
    00085       *__fptr++ = 'f';
    00086     else if (__fltfield == ios_base::scientific)
    00087       *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e';
    00088     else
    00089       *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g';
    00090     *__fptr = '\0';
    00091   }
    00092 } // namespace std
    00093