3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
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.
18 // WARNING: This is an internal header file, included by other C++
19 // standard library headers. You should not attempt to use this header
23 #ifndef _STLP_INTERNAL_NUMPUNCT_H
24 #define _STLP_INTERNAL_NUMPUNCT_H
26 #ifndef _STLP_IOS_BASE_H
27 # include <stl/_ios_base.h>
30 # ifndef _STLP_C_LOCALE_H
31 # include <stl/c_locale.h>
34 #ifndef _STLP_INTERNAL_STRING_H
35 # include <stl/_string.h>
40 //----------------------------------------------------------------------
43 template <class _CharT> class numpunct {};
44 template <class _CharT> class numpunct_byname {};
45 template <class _Ch, class _InIt> class num_get;
48 class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
50 friend class _Locale_impl;
52 #ifndef _STLP_NO_FRIEND_TEMPLATES
53 template <class _Ch, class _InIt> friend class num_get;
56 typedef char char_type;
57 typedef string string_type;
59 explicit numpunct(size_t __refs = 0)
60 : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
62 char decimal_point() const { return do_decimal_point(); }
63 char thousands_sep() const { return do_thousands_sep(); }
64 string grouping() const { return do_grouping(); }
65 string truename() const { return do_truename(); }
66 string falsename() const { return do_falsename(); }
68 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
70 #ifndef _STLP_NO_FRIEND_TEMPLATES
79 virtual char do_decimal_point() const;
80 virtual char do_thousands_sep() const;
81 virtual string do_grouping() const;
82 virtual string do_truename() const;
83 virtual string do_falsename() const;
86 # if ! defined (_STLP_NO_WCHAR_T)
89 class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
91 friend class _Locale_impl;
93 typedef wchar_t char_type;
94 typedef wstring string_type;
96 explicit numpunct(size_t __refs = 0)
97 : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
99 wchar_t decimal_point() const { return do_decimal_point(); }
100 wchar_t thousands_sep() const { return do_thousands_sep(); }
101 string grouping() const { return do_grouping(); }
102 wstring truename() const { return do_truename(); }
103 wstring falsename() const { return do_falsename(); }
105 static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
109 wstring _M_falsename;
114 virtual wchar_t do_decimal_point() const;
115 virtual wchar_t do_thousands_sep() const;
116 virtual string do_grouping() const;
117 virtual wstring do_truename() const;
118 virtual wstring do_falsename() const;
121 # endif /* WCHAR_T */
124 class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
126 typedef char char_type;
127 typedef string string_type;
129 explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
135 virtual char do_decimal_point() const;
136 virtual char do_thousands_sep() const;
137 virtual string do_grouping() const;
140 _Locale_numeric* _M_numeric;
142 //explicitely defined as private to avoid warnings:
143 typedef numpunct_byname<char> _Self;
144 numpunct_byname(_Self const&);
145 _Self& operator = (_Self const&);
146 friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
149 # ifndef _STLP_NO_WCHAR_T
151 class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
153 typedef wchar_t char_type;
154 typedef wstring string_type;
156 explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
162 virtual wchar_t do_decimal_point() const;
163 virtual wchar_t do_thousands_sep() const;
164 virtual string do_grouping() const;
167 _Locale_numeric* _M_numeric;
169 //explicitely defined as private to avoid warnings:
170 typedef numpunct_byname<wchar_t> _Self;
171 numpunct_byname(_Self const&);
172 _Self& operator = (_Self const&);
175 # endif /* WCHAR_T */
179 #endif /* _STLP_NUMPUNCT_H */