1/* 2 * Copyright (c) 1999 3 * Silicon Graphics Computer Systems, Inc. 4 * 5 * Copyright (c) 1999 6 * Boris Fomitchev 7 * 8 * This material is provided "as is", with absolutely no warranty expressed 9 * or implied. Any use is at your own risk. 10 * 11 * Permission to use or copy this software for any purpose is hereby granted 12 * without fee, provided the above notices are retained on all copies. 13 * Permission to modify the code and to distribute modified code is granted, 14 * provided the above notices are retained, and a notice that the code was 15 * modified is included with the above copyright notice. 16 * 17 */ 18// WARNING: This is an internal header file, included by other C++ 19// standard library headers. You should not attempt to use this header 20// file directly. 21 22 23#ifndef _STLP_INTERNAL_NUMPUNCT_H 24#define _STLP_INTERNAL_NUMPUNCT_H 25 26#ifndef _STLP_IOS_BASE_H 27# include <stl/_ios_base.h> 28#endif 29 30# ifndef _STLP_C_LOCALE_H 31# include <stl/c_locale.h> 32# endif 33 34#ifndef _STLP_INTERNAL_STRING_H 35# include <stl/_string.h> 36#endif 37 38_STLP_BEGIN_NAMESPACE 39 40//---------------------------------------------------------------------- 41// numpunct facets 42 43template <class _CharT> class numpunct {}; 44template <class _CharT> class numpunct_byname {}; 45template <class _Ch, class _InIt> class num_get; 46 47_STLP_TEMPLATE_NULL 48class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet { 49public: 50 typedef char char_type; 51 typedef string string_type; 52 53 explicit numpunct(size_t __refs = 0) 54 : locale::facet(__refs) {} 55 56 char decimal_point() const { return do_decimal_point(); } 57 char thousands_sep() const { return do_thousands_sep(); } 58 string grouping() const { return do_grouping(); } 59 string truename() const { return do_truename(); } 60 string falsename() const { return do_falsename(); } 61 62 static _STLP_STATIC_DECLSPEC locale::id id; 63 64protected: 65 ~numpunct(); 66 67 virtual char do_decimal_point() const; 68 virtual char do_thousands_sep() const; 69 virtual string do_grouping() const; 70 virtual string do_truename() const; 71 virtual string do_falsename() const; 72}; 73 74# if ! defined (_STLP_NO_WCHAR_T) 75 76_STLP_TEMPLATE_NULL 77class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet { 78public: 79 typedef wchar_t char_type; 80 typedef wstring string_type; 81 82 explicit numpunct(size_t __refs = 0) 83 : locale::facet(__refs) {} 84 85 wchar_t decimal_point() const { return do_decimal_point(); } 86 wchar_t thousands_sep() const { return do_thousands_sep(); } 87 string grouping() const { return do_grouping(); } 88 wstring truename() const { return do_truename(); } 89 wstring falsename() const { return do_falsename(); } 90 91 static _STLP_STATIC_DECLSPEC locale::id id; 92 93protected: 94 ~numpunct(); 95 96 virtual wchar_t do_decimal_point() const; 97 virtual wchar_t do_thousands_sep() const; 98 virtual string do_grouping() const; 99 virtual wstring do_truename() const; 100 virtual wstring do_falsename() const; 101}; 102 103# endif /* WCHAR_T */ 104 105_STLP_TEMPLATE_NULL 106class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> { 107 friend class _Locale_impl; 108public: 109 typedef char char_type; 110 typedef string string_type; 111 112 explicit numpunct_byname(const char* __name, size_t __refs = 0); 113 114protected: 115 116 ~numpunct_byname(); 117 118 virtual char do_decimal_point() const; 119 virtual char do_thousands_sep() const; 120 virtual string do_grouping() const; 121 virtual string do_truename() const; 122 virtual string do_falsename() const; 123 124private: 125 numpunct_byname(_Locale_numeric *__numeric) 126 : _M_numeric(__numeric) {} 127 128 //explicitely defined as private to avoid warnings: 129 typedef numpunct_byname<char> _Self; 130 numpunct_byname(_Self const&); 131 _Self& operator = (_Self const&); 132 133 _Locale_numeric* _M_numeric; 134}; 135 136# ifndef _STLP_NO_WCHAR_T 137_STLP_TEMPLATE_NULL 138class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> { 139 friend class _Locale_impl; 140public: 141 typedef wchar_t char_type; 142 typedef wstring string_type; 143 144 explicit numpunct_byname(const char* __name, size_t __refs = 0); 145 146protected: 147 ~numpunct_byname(); 148 149 virtual wchar_t do_decimal_point() const; 150 virtual wchar_t do_thousands_sep() const; 151 virtual string do_grouping() const; 152 virtual wstring do_truename() const; 153 virtual wstring do_falsename() const; 154 155private: 156 numpunct_byname(_Locale_numeric *__numeric) 157 : _M_numeric(__numeric) {} 158 159 //explicitely defined as private to avoid warnings: 160 typedef numpunct_byname<wchar_t> _Self; 161 numpunct_byname(_Self const&); 162 _Self& operator = (_Self const&); 163 164 _Locale_numeric* _M_numeric; 165}; 166 167# endif /* WCHAR_T */ 168 169_STLP_END_NAMESPACE 170 171#endif /* _STLP_NUMPUNCT_H */ 172 173// Local Variables: 174// mode:C++ 175// End: 176 177