/home/ntakagi/work/STLport-5.1.5/stlport/stl/_numpunct.hGo to the documentation of this file.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_INTERNAL_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_impl; 00051 00052 #ifndef _STLP_NO_FRIEND_TEMPLATES 00053 template <class _Ch, class _InIt> friend class num_get; 00054 #endif 00055 public: 00056 typedef char char_type; 00057 typedef string string_type; 00058 00059 explicit numpunct(size_t __refs = 0) 00060 : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {} 00061 00062 char decimal_point() const { return do_decimal_point(); } 00063 char thousands_sep() const { return do_thousands_sep(); } 00064 string grouping() const { return do_grouping(); } 00065 string truename() const { return do_truename(); } 00066 string falsename() const { return do_falsename(); } 00067 00068 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; 00069 00070 #ifndef _STLP_NO_FRIEND_TEMPLATES 00071 protected: 00072 #endif 00073 ~numpunct(); 00074 00075 string _M_truename; 00076 string _M_falsename; 00077 string _M_grouping; 00078 00079 virtual char do_decimal_point() const; 00080 virtual char do_thousands_sep() const; 00081 virtual string do_grouping() const; 00082 virtual string do_truename() const; 00083 virtual string do_falsename() const; 00084 }; 00085 00086 # if ! defined (_STLP_NO_WCHAR_T) 00087 00088 _STLP_TEMPLATE_NULL 00089 class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet 00090 { 00091 friend class _Locale_impl; 00092 public: 00093 typedef wchar_t char_type; 00094 typedef wstring string_type; 00095 00096 explicit numpunct(size_t __refs = 0) 00097 : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {} 00098 00099 wchar_t decimal_point() const { return do_decimal_point(); } 00100 wchar_t thousands_sep() const { return do_thousands_sep(); } 00101 string grouping() const { return do_grouping(); } 00102 wstring truename() const { return do_truename(); } 00103 wstring falsename() const { return do_falsename(); } 00104 00105 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; 00106 00107 protected: 00108 wstring _M_truename; 00109 wstring _M_falsename; 00110 string _M_grouping; 00111 00112 ~numpunct(); 00113 00114 virtual wchar_t do_decimal_point() const; 00115 virtual wchar_t do_thousands_sep() const; 00116 virtual string do_grouping() const; 00117 virtual wstring do_truename() const; 00118 virtual wstring do_falsename() const; 00119 }; 00120 00121 # endif /* WCHAR_T */ 00122 00123 _STLP_TEMPLATE_NULL 00124 class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> { 00125 public: 00126 typedef char char_type; 00127 typedef string string_type; 00128 00129 explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); 00130 00131 protected: 00132 00133 ~numpunct_byname(); 00134 00135 virtual char do_decimal_point() const; 00136 virtual char do_thousands_sep() const; 00137 virtual string do_grouping() const; 00138 00139 private: 00140 _Locale_numeric* _M_numeric; 00141 00142 //explicitely defined as private to avoid warnings: 00143 typedef numpunct_byname<char> _Self; 00144 numpunct_byname(_Self const&); 00145 _Self& operator = (_Self const&); 00146 friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*); 00147 }; 00148 00149 # ifndef _STLP_NO_WCHAR_T 00150 _STLP_TEMPLATE_NULL 00151 class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> { 00152 public: 00153 typedef wchar_t char_type; 00154 typedef wstring string_type; 00155 00156 explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); 00157 00158 protected: 00159 00160 ~numpunct_byname(); 00161 00162 virtual wchar_t do_decimal_point() const; 00163 virtual wchar_t do_thousands_sep() const; 00164 virtual string do_grouping() const; 00165 00166 private: 00167 _Locale_numeric* _M_numeric; 00168 00169 //explicitely defined as private to avoid warnings: 00170 typedef numpunct_byname<wchar_t> _Self; 00171 numpunct_byname(_Self const&); 00172 _Self& operator = (_Self const&); 00173 }; 00174 00175 # endif /* WCHAR_T */ 00176 00177 _STLP_END_NAMESPACE 00178 00179 #endif /* _STLP_NUMPUNCT_H */ 00180 00181 // Local Variables: 00182 // mode:C++ 00183 // End: 00184
Generated on Mon Mar 10 15:32:32 2008 by ![]() |