2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
5 * Silicon Graphics Computer Systems, Inc.
10 * This material is provided "as is", with absolutely no warranty expressed
11 * or implied. Any use is at your own risk.
13 * Permission to use or copy this software for any purpose is hereby granted
14 * without fee, provided the above notices are retained on all copies.
15 * Permission to modify the code and to distribute modified code is granted,
16 * provided the above notices are retained, and a notice that the code was
17 * modified is included with the above copyright notice.
20 // WARNING: This is an internal header file, included by other C++
21 // standard library headers. You should not attempt to use this header
25 #ifndef _STLP_INTERNAL_NUMPUNCT_H
26 #define _STLP_INTERNAL_NUMPUNCT_H
28 #ifndef _STLP_IOS_BASE_H
29 # include <stl/_ios_base.h>
32 # ifndef _STLP_C_LOCALE_H
33 # include <stl/c_locale.h>
36 #ifndef _STLP_STRING_H
37 # include <stl/_string.h>
42 //----------------------------------------------------------------------
46 extern locale::id& Numpunct_charT_GetFacetLocaleId(const char* type);
48 template <class _CharT> class numpunct: public locale::facet
52 typedef char char_type;
53 typedef basic_string<_CharT> string_type;
54 explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {
55 _M_truename.append(1, (_CharT)'t');
56 _M_truename.append(1, (_CharT)'r');
57 _M_truename.append(1, (_CharT)'u');
58 _M_truename.append(1, (_CharT)'e');
60 _M_falsename.append(1, (_CharT)'f');
61 _M_falsename.append(1, (_CharT)'a');
62 _M_falsename.append(1, (_CharT)'l');
63 _M_falsename.append(1, (_CharT)'s');
64 _M_falsename.append(1, (_CharT)'e');
67 _CharT decimal_point() const { return do_decimal_point(); }
68 _CharT thousands_sep() const { return do_thousands_sep(); }
69 string grouping() const { return do_grouping(); }
70 string_type truename() const { return do_truename(); }
71 string_type falsename() const { return do_falsename(); }
72 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
73 static locale::id& GetFacetLocaleId(){return Numpunct_charT_GetFacetLocaleId(typeid(_CharT).name()); }
78 # ifndef _STLP_NO_FRIEND_TEMPLATES
84 static string_type _M_truename;
85 static string_type _M_falsename;
86 static string _M_grouping;
89 virtual _CharT do_decimal_point() const;
90 virtual _CharT do_thousands_sep() const;
91 virtual string do_grouping() const;
92 virtual string_type do_truename() const;
93 virtual string_type do_falsename() const;
96 template <class _CharT>
97 basic_string<_CharT> numpunct<_CharT>::_M_truename;
98 template <class _CharT>
99 basic_string<_CharT> numpunct<_CharT>::_M_falsename;
100 template <class _CharT>
101 string numpunct<_CharT>::_M_grouping ;
103 _STLP_DECLSPEC _Locale_numeric* __acquire_numericE(const char* );
104 _STLP_DECLSPEC void __release_numericE(_Locale_numeric* );
105 _STLP_DECLSPEC const char* _Locale_trueE(_Locale_numeric*);
106 _STLP_DECLSPEC const char* _Locale_falseE(_Locale_numeric*);
107 _STLP_DECLSPEC char _Locale_decimal_pointE(_Locale_numeric*);
108 _STLP_DECLSPEC char _Locale_thousands_sepE(_Locale_numeric*);
109 _STLP_DECLSPEC const char*_Locale_groupingE(_Locale_numeric*);
111 template <class _CharT>
112 class numpunct_byname : public numpunct<_CharT>{
114 typedef _CharT char_type;
115 typedef basic_string<_CharT> string_type;
117 explicit numpunct_byname(const char* name, size_t refs = 0);
122 virtual _CharT do_decimal_point() const;
123 virtual _CharT do_thousands_sep() const;
124 virtual string do_grouping() const;
127 _Locale_numeric* _M_numeric;
131 template <class _CharT> class numpunct {};
132 template <class _CharT> class numpunct_byname {};
134 template <class _Ch, class _InIt> class num_get;
138 class numpunct <char> : public locale::facet
140 class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
143 friend class _Locale;
144 # ifndef _STLP_NO_FRIEND_TEMPLATES
145 template <class _Ch, class _InIt> friend class num_get;
148 typedef char char_type;
149 typedef string string_type;
151 explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
153 char decimal_point() const { return do_decimal_point(); }
154 char thousands_sep() const { return do_thousands_sep(); }
155 string grouping() const { return do_grouping(); }
156 string truename() const { return do_truename(); }
157 string falsename() const { return do_falsename(); }
159 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
160 _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
162 _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
165 # ifndef _STLP_NO_FRIEND_TEMPLATES
170 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
172 _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_truename();
173 _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_falsename();
174 _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_grouping();
177 _STLP_STATIC_MEMBER_DECLSPEC static string _M_truename;
178 _STLP_STATIC_MEMBER_DECLSPEC static string _M_falsename;
179 _STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
184 _STLP_DECLSPEC virtual char do_decimal_point() const;
185 _STLP_DECLSPEC virtual char do_thousands_sep() const;
186 _STLP_DECLSPEC virtual string do_grouping() const;
187 _STLP_DECLSPEC virtual string do_truename() const;
188 _STLP_DECLSPEC virtual string do_falsename() const;
191 # if ! defined (_STLP_NO_WCHAR_T)
195 class numpunct<wchar_t> : public locale::facet
197 class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
200 friend class _Locale;
202 typedef wchar_t char_type;
203 typedef wstring string_type;
205 explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
207 wchar_t decimal_point() const { return do_decimal_point(); }
208 wchar_t thousands_sep() const { return do_thousands_sep(); }
209 string grouping() const { return do_grouping(); }
210 wstring truename() const { return do_truename(); }
211 wstring falsename() const { return do_falsename(); }
213 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
214 _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
216 _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
219 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
221 _STLP_STATIC_MEMBER_DECLSPEC static wstring& GetNumPunct_M_Wchar_truename();
222 _STLP_STATIC_MEMBER_DECLSPEC static wstring& GetNumPunct_M_Wchar_falsename();
223 _STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_Wchar_grouping();
226 _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_truename;
227 _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_falsename;
228 _STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
233 _STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
234 _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
235 _STLP_DECLSPEC virtual string do_grouping() const;
236 _STLP_DECLSPEC virtual wstring do_truename() const;
237 _STLP_DECLSPEC virtual wstring do_falsename() const;
240 # endif /* WCHAR_T */
243 class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
245 typedef char char_type;
246 typedef string string_type;
248 explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
252 _STLP_DECLSPEC ~numpunct_byname();
254 _STLP_DECLSPEC virtual char do_decimal_point() const;
255 _STLP_DECLSPEC virtual char do_thousands_sep() const;
256 _STLP_DECLSPEC virtual string do_grouping() const;
259 _Locale_numeric* _M_numeric;
262 # ifndef _STLP_NO_WCHAR_T
264 class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
266 typedef wchar_t char_type;
267 typedef wstring string_type;
269 explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
273 _STLP_DECLSPEC ~numpunct_byname();
275 _STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
276 _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
277 _STLP_DECLSPEC virtual string do_grouping() const;
280 _Locale_numeric* _M_numeric;
283 # endif /* WCHAR_T */
286 #include<stl/_numpunct.c>
290 #endif /* _STLP_NUMPUNCT_H */