OSDN Git Service

2003-10-17 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / locale-inst.cc
index a0a1d63..27a51f0 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 // ISO C++ 14882: 22.1  Locales
 //
 
-#include <bits/std_clocale.h>
-#include <bits/std_cstring.h>
-#include <bits/std_cassert.h>
-#include <bits/std_limits.h>
-#include <exception>
-#include <bits/std_stdexcept.h>
-#include <bits/std_locale.h>
-#include <bits/locale_facets.tcc>
-#include <bits/std_istream.h>
-#include <bits/std_ostream.h>
+#include <locale>
 
-namespace std {
-
-  typedef ostreambuf_iterator<char, char_traits<char> > obuf_iterator;
-  typedef istreambuf_iterator<char, char_traits<char> > ibuf_iterator;
-  typedef ostreambuf_iterator<wchar_t, char_traits<wchar_t> > wobuf_iterator;
-  typedef istreambuf_iterator<wchar_t, char_traits<wchar_t> > wibuf_iterator;
+// Instantiation configuration.
+#ifndef C
+# define C char
+#endif
 
+namespace std
+{
   // moneypunct, money_get, and money_put
-  template class moneypunct<char, false>;
-  template class moneypunct<char, true>;
-  template class moneypunct_byname<char, false>;
-  template class moneypunct_byname<char, true>;
-  template class _Moneypunct<char>;
-  template class money_get<char, obuf_iterator>;
-  template class money_put<char, obuf_iterator>;
-  template class money_get<char, ibuf_iterator>;
-  template class money_put<char, ibuf_iterator>;
-  template class _Format_cache<char>;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template class moneypunct<wchar_t, false>;
-  template class moneypunct<wchar_t, true>;
-  template class moneypunct_byname<wchar_t, false>;
-  template class moneypunct_byname<wchar_t, true>;
-  template class _Moneypunct<wchar_t>;
-  template class money_get<wchar_t, wobuf_iterator>;
-  template class money_put<wchar_t, wobuf_iterator>;
-  template class money_get<wchar_t, wibuf_iterator>;
-  template class money_put<wchar_t, wibuf_iterator>;
-  template class _Format_cache<wchar_t>;
-#endif
+  template class moneypunct<C, false>;
+  template class moneypunct<C, true>;
+  template struct __moneypunct_cache<C>;
+  template class moneypunct_byname<C, false>;
+  template class moneypunct_byname<C, true>;
+  template class money_get<C, istreambuf_iterator<C> >;
+  template class money_put<C, ostreambuf_iterator<C> >;
 
   // numpunct, numpunct_byname, num_get, and num_put
-  template class numpunct<char>;
-  template class numpunct_byname<char>;
-  template class _Numpunct<char>;
-  template class num_get<char, ibuf_iterator>;
-  template class num_put<char, obuf_iterator>;
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template class numpunct<wchar_t>;
-  template class numpunct_byname<wchar_t>;
-  template class _Numpunct<wchar_t>;
-  template class num_get<wchar_t, wibuf_iterator>;
-  template class num_put<wchar_t, wobuf_iterator>;
-#endif
+  template class numpunct<C>;
+  template struct __numpunct_cache<C>;
+  template class numpunct_byname<C>;
+  template class num_get<C, istreambuf_iterator<C> >;
+  template class num_put<C, ostreambuf_iterator<C> >; 
+  template
+    ostreambuf_iterator<C>
+    num_put<C, ostreambuf_iterator<C> >::
+    _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
+                 long) const;
 
-  // _Punct
-  template class _Punct<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template class _Punct<wchar_t>;
+  template
+    ostreambuf_iterator<C>
+    num_put<C, ostreambuf_iterator<C> >::
+    _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
+                 unsigned long) const;
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+  template
+    ostreambuf_iterator<C>
+    num_put<C, ostreambuf_iterator<C> >::
+    _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
+                 long long) const;
+
+  template
+    ostreambuf_iterator<C>
+    num_put<C, ostreambuf_iterator<C> >::
+    _M_insert_int(ostreambuf_iterator<C>, ios_base&, C, 
+                 unsigned long long) const;
 #endif
+
+  template
+    ostreambuf_iterator<C>
+    num_put<C, ostreambuf_iterator<C> >::
+    _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, 
+                   double) const;
+
+  template
+    ostreambuf_iterator<C>
+    num_put<C, ostreambuf_iterator<C> >::
+    _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, 
+                   long double) const;
   
   // time_get and time_put
-  template class time_put<char, obuf_iterator>;
-  template class time_put_byname<char, obuf_iterator>;
-  template class time_get<char, ibuf_iterator>;
-  template class time_get_byname<char, ibuf_iterator>;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template class time_put<wchar_t, wobuf_iterator>;
-  template class time_put_byname<wchar_t, wobuf_iterator>;
-  template class time_get<wchar_t, wibuf_iterator>;
-  template class time_get_byname<wchar_t, wibuf_iterator>;
-#endif
+  template class __timepunct<C>;
+  template struct __timepunct_cache<C>;
+  template class time_put<C, ostreambuf_iterator<C> >;
+  template class time_put_byname<C, ostreambuf_iterator<C> >;
+  template class time_get<C, istreambuf_iterator<C> >;
+  template class time_get_byname<C, istreambuf_iterator<C> >;
 
   // messages
-  template class _Messages<char>;
-  template class messages<char>;
-  template class messages_byname<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template class _Messages<wchar_t>;
-  template class messages<wchar_t>;
-  template class messages_byname<wchar_t>;
-#endif
+  template class messages<C>;
+  template class messages_byname<C>;
   
   // ctype
-  //  template class ctype<unsigned char>; // No definitions avail.
-  //  template class ctype<signed char>; // No definitions avail.
-  template class _Ctype<char>;
-  template class _Ctype_nois<char>;
-  template class ctype_byname<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template class _Ctype<wchar_t>;
-  template class _Ctype_nois<wchar_t>;
-  template class ctype_byname<wchar_t>;
-#endif
+  inline template class __ctype_abstract_base<C>;
+  template class ctype_byname<C>;
   
   // codecvt
-  template class __codecvt_abstract_base<char, char, mbstate_t>;
-  template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
+  inline template class __codecvt_abstract_base<C, char, mbstate_t>;
+  template class codecvt_byname<C, char, mbstate_t>;
 
   // collate
-  template class _Collate<char>;
-  template class collate_byname<char>;
-  template class _Weekdaynames<char, int>;
-  template class _Monthnames<char, int>;
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template class _Collate<wchar_t>;
-  template class collate_byname<wchar_t>;
-  template class _Weekdaynames<wchar_t, int>;
-  template class _Monthnames<wchar_t, int>;
-#endif
+  template class collate<C>;
+  template class collate_byname<C>;
     
   // use_facet
-  template 
-    const num_put<char, obuf_iterator >& 
-    use_facet<num_put<char, obuf_iterator> >(const locale &);
-  template 
-    const num_get<char, ibuf_iterator >& 
-    use_facet<num_get<char, ibuf_iterator> >(const locale &);
-  template
-    const ctype<char>&
-    use_facet<ctype<char> >(const locale& __loc);
+  // NB: use_facet<ctype> is specialized
   template
-    const codecvt<char, char, mbstate_t>& 
-    use_facet<codecvt<char, char, mbstate_t> >(const locale&);
-   template 
-    const num_put<char, obuf_iterator>& 
-    _Use_facet_failure_handler<num_put<char, obuf_iterator> >
-    (const locale &);
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template 
-    const num_put<wchar_t, wobuf_iterator>& 
-    use_facet<num_put<wchar_t, wobuf_iterator> >(const locale &);
-  template 
-    const num_get<wchar_t, wibuf_iterator>& 
-    use_facet<num_get<wchar_t, wibuf_iterator> >(const locale &);
+    const codecvt<C, char, mbstate_t>& 
+    use_facet<codecvt<C, char, mbstate_t> >(const locale&);
+
   template
-    const ctype<wchar_t>&
-    use_facet<ctype<wchar_t> >(const locale& __loc);
+    const collate<C>& 
+    use_facet<collate<C> >(const locale&);
+
   template
-    const codecvt<wchar_t, char, mbstate_t>& 
-    use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const &);
-  template 
-    const num_put<wchar_t, wobuf_iterator>& 
-    _Use_facet_failure_handler<num_put<wchar_t, wobuf_iterator> >
-    (const locale &);
-#endif
+    const numpunct<C>& 
+    use_facet<numpunct<C> >(const locale&);
 
-  // has_facet
   template 
-    bool
-    has_facet<numpunct<char> >(const locale &);
-#ifdef _GLIBCPP_USE_WCHAR_T
-  template 
-    bool
-    has_facet<numpunct<wchar_t> >(const locale &);
-#endif
+    const num_put<C>& 
+    use_facet<num_put<C> >(const locale&);
 
-  //
-  // iterator
-  //
-  typedef vector<locale::facet*> vec_pfacet;
   template 
-    void 
-    vec_pfacet::
-    insert(vec_pfacet::iterator, vec_pfacet::size_type, 
-          const vec_pfacet::value_type&);
+    const num_get<C>& 
+    use_facet<num_get<C> >(const locale&);
 
-  typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
-  typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
+  template
+    const moneypunct<C, true>& 
+    use_facet<moneypunct<C, true> >(const locale&);
 
+  template
+    const moneypunct<C, false>& 
+    use_facet<moneypunct<C, false> >(const locale&);
 
   template 
-    istreambuf_iter 
-    __match_parallel<istreambuf_iter, char>
-    (istreambuf_iter, istreambuf_iter, int, const string*, int*, int&, bool&);
+    const money_put<C>& 
+    use_facet<money_put<C> >(const locale&);
 
+  template 
+    const money_get<C>& 
+    use_facet<money_get<C> >(const locale&);
 
-#ifdef _GLIBCPP_USE_WCHAR_T
-  typedef istreambuf_iterator<wchar_t,char_traits<wchar_t> > wistreambuf_iter;
-  typedef ostreambuf_iterator<wchar_t,char_traits<wchar_t> > wostreambuf_iter;
+  template
+    const __timepunct<C>& 
+    use_facet<__timepunct<C> >(const locale&);
 
   template 
-    wistreambuf_iter 
-    __match_parallel<wistreambuf_iter, wchar_t>
-   (wistreambuf_iter, wistreambuf_iter, int, const wstring*, int*, int&, bool&);
-#endif
+    const time_put<C>& 
+    use_facet<time_put<C> >(const locale&);
 
-
-  //
-  // locale
-  //
   template 
-    bool
-    locale::operator()(const string&, const string&) const;
+    const time_get<C>& 
+    use_facet<time_get<C> >(const locale&);
 
-  template
-    ostreambuf_iter
-    _S_fill<char, ostreambuf_iter, output_iterator_tag>
-    (ostreambuf_iter, char, int, output_iterator_tag);
+  template 
+    const messages<C>& 
+    use_facet<messages<C> >(const locale&);
 
+  // has_facet
   template 
-    ostreambuf_iter
-    _S_pad_numeric<char, ostreambuf_iter>
-    (ostreambuf_iter, ios_base::fmtflags, char, int, char const*, char const*, 
-     char const*);
+    bool
+    has_facet<ctype<C> >(const locale&);
 
-  template
-    char*
-    _S_group_digits<char>(char*, char, char const*, char const*, 
-                         char const*, char const*);
+  template 
+    bool
+    has_facet<codecvt<C, char, mbstate_t> >(const locale&);
 
   template 
-    ostreambuf_iter
-    _S_format<char, ostreambuf_iter, unsigned long>
-    (ostreambuf_iter, ios_base &, char, bool, unsigned long);
+    bool
+    has_facet<collate<C> >(const locale&);
 
-#ifdef _GLIBCPP_USE_LONG_LONG
-  template
-    ostreambuf_iter
-    _S_format<char, ostreambuf_iter, unsigned long long>
-    (ostreambuf_iter, ios_base &, char, bool, unsigned long long);
-#endif
+  template 
+    bool
+    has_facet<numpunct<C> >(const locale&);
 
-#ifdef _GLIBCPP_USE_WCHAR_T
   template 
     bool
-    locale::operator()(const wstring&, const wstring&) const;
+    has_facet<num_put<C> >(const locale&);
 
-  typedef ostreambuf_iterator<wchar_t> wostreambuf_iter;
+  template 
+    bool
+    has_facet<num_get<C> >(const locale&);
 
-  template
-    wostreambuf_iter
-    _S_fill<wchar_t, wostreambuf_iter, output_iterator_tag>
-    (wostreambuf_iter, wchar_t, int, output_iterator_tag);
+  template 
+    bool
+    has_facet<moneypunct<C> >(const locale&);
 
   template 
-    wostreambuf_iter
-    _S_pad_numeric<wchar_t, wostreambuf_iter>
-    (wostreambuf_iter, ios_base::fmtflags, wchar_t __fill, int, wchar_t const*, 
-     wchar_t const*, wchar_t const*);
+    bool
+    has_facet<money_put<C> >(const locale&);
 
-  template
-    wchar_t*
-    _S_group_digits<wchar_t>(wchar_t*, wchar_t, char const*, char const*, 
-                            wchar_t const*, wchar_t const*);
+  template 
+    bool
+    has_facet<money_get<C> >(const locale&);
 
   template 
-    wostreambuf_iter
-    _S_format<wchar_t, wostreambuf_iter, unsigned long>
-    (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long);
+    bool
+    has_facet<__timepunct<C> >(const locale&);
 
-#ifdef _GLIBCPP_USE_LONG_LONG
-  template
-    wostreambuf_iter
-    _S_format<wchar_t, wostreambuf_iter, unsigned long long>
-    (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long long);
-#endif
-#endif // _GLIBCPP_USE_WCHAR_T
+  template 
+    bool
+    has_facet<time_put<C> >(const locale&);
 
   template 
-    locale::facet** 
-    fill_n<locale::facet**, unsigned int, locale::facet*>
-    (locale::facet**, unsigned int, locale::facet* const &);
+    bool
+    has_facet<time_get<C> >(const locale&);
 
-} //std
+  template 
+    bool
+    has_facet<messages<C> >(const locale&);
 
 
+  // locale functions.
+  template
+    C*
+    __add_grouping<C>(C*, C, char const*, char const*, 
+                        C const*, C const*);
 
+  template
+    bool
+    __verify_grouping<C>(const basic_string<C>&, basic_string<C>&);
 
+  template class __pad<C, char_traits<C> >;
 
+  template
+    int
+    __int_to_char(C*, const int, unsigned long, const C*, 
+                 ios_base::fmtflags, bool);
 
+#ifdef _GLIBCXX_USE_LONG_LONG
+  template
+    int
+    __int_to_char(C*, const int, unsigned long long, const C*, 
+                 ios_base::fmtflags, bool);
+#endif
+} // namespace std