_numpunct.h

00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999 
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted 
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */ 
00018 // WARNING: This is an internal header file, included by other C++
00019 // standard library headers.  You should not attempt to use this header
00020 // file directly.
00021 
00022 
00023 #ifndef _STLP_INTERNAL_NUMPUNCT_H
00024 #define _STLP_INTERNAL_NUMPUNCT_H
00025 
00026 #ifndef _STLP_IOS_BASE_H
00027 # include <stl/_ios_base.h>
00028 #endif
00029 
00030 # ifndef _STLP_C_LOCALE_H
00031 #  include <stl/c_locale.h>
00032 # endif
00033 
00034 #ifndef _STLP_STRING_H
00035 # include <stl/_string.h>
00036 #endif
00037 
00038 _STLP_BEGIN_NAMESPACE
00039 
00040 //----------------------------------------------------------------------
00041 // numpunct facets
00042 
00043 template <class _CharT> class numpunct {};
00044 template <class _CharT> class numpunct_byname {};
00045 template <class _Ch, class _InIt> class num_get;
00046 
00047 _STLP_TEMPLATE_NULL
00048 class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
00049 {
00050   friend class _Locale;
00051 # ifndef _STLP_NO_FRIEND_TEMPLATES
00052   template <class _Ch, class _InIt> friend class num_get;
00053 # endif
00054 public:
00055   typedef char               char_type;
00056   typedef string             string_type;
00057 
00058   explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
00059 
00060   char decimal_point() const { return do_decimal_point(); }
00061   char thousands_sep() const { return do_thousands_sep(); }
00062   string grouping() const { return do_grouping(); }
00063   string truename() const { return do_truename(); }
00064   string falsename() const { return do_falsename(); }
00065 
00066   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
00067 
00068 # ifndef _STLP_NO_FRIEND_TEMPLATES
00069 protected:
00070 # endif
00071   ~numpunct();
00072 
00073   _STLP_STATIC_MEMBER_DECLSPEC static string  _M_truename;
00074   _STLP_STATIC_MEMBER_DECLSPEC static string  _M_falsename;
00075   _STLP_STATIC_MEMBER_DECLSPEC static string  _M_grouping;
00076 
00077   virtual char do_decimal_point() const;
00078   virtual char do_thousands_sep() const;
00079   virtual string do_grouping() const;
00080   virtual string do_truename() const;
00081   virtual string do_falsename()  const;
00082 };
00083 
00084 # if ! defined (_STLP_NO_WCHAR_T)
00085 
00086 _STLP_TEMPLATE_NULL
00087 class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
00088 {
00089   friend class _Locale;
00090 public:
00091   typedef wchar_t               char_type;
00092   typedef wstring               string_type;
00093 
00094   explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
00095 
00096   wchar_t decimal_point() const { return do_decimal_point(); }
00097   wchar_t thousands_sep() const { return do_thousands_sep(); }
00098   string grouping() const { return do_grouping(); }
00099   wstring truename() const { return do_truename(); }
00100   wstring falsename() const { return do_falsename(); }
00101 
00102   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
00103 
00104 protected:
00105   _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_truename;
00106   _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_falsename;
00107   _STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
00108 
00109   ~numpunct();
00110 
00111   virtual wchar_t do_decimal_point() const;
00112   virtual wchar_t do_thousands_sep() const;
00113   virtual string do_grouping() const;
00114   virtual wstring do_truename() const;
00115   virtual wstring do_falsename()  const;
00116 };
00117 
00118 # endif /* WCHAR_T */
00119 
00120 _STLP_TEMPLATE_NULL
00121 class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
00122 public:
00123   typedef char                char_type;
00124   typedef string              string_type;
00125 
00126   explicit numpunct_byname(const char* __name, size_t __refs = 0);
00127 
00128 protected:
00129 
00130   ~numpunct_byname();
00131 
00132   virtual char   do_decimal_point() const;
00133   virtual char   do_thousands_sep() const;
00134   virtual string do_grouping()      const;
00135 
00136 private:
00137   _Locale_numeric* _M_numeric;
00138 };
00139 
00140 # ifndef _STLP_NO_WCHAR_T
00141 _STLP_TEMPLATE_NULL
00142 class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
00143 public:
00144   typedef wchar_t               char_type;
00145   typedef wstring               string_type;
00146 
00147   explicit numpunct_byname(const char* __name, size_t __refs = 0);
00148 
00149 protected:
00150 
00151   ~numpunct_byname();
00152 
00153   virtual wchar_t   do_decimal_point() const;
00154   virtual wchar_t   do_thousands_sep() const;
00155   virtual string do_grouping() const;
00156 
00157 private:
00158   _Locale_numeric* _M_numeric;
00159 };
00160 
00161 # endif /* WCHAR_T */
00162 
00163 _STLP_END_NAMESPACE
00164 
00165 #endif /* _STLP_NUMPUNCT_H */
00166 
00167 // Local Variables:
00168 // mode:C++
00169 // End:
00170 

Generated on Mon Jun 5 10:20:46 2006 for Intelligence.kdevelop by  doxygen 1.4.6