2 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 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_INTERNAL_STRING_H
37 # include <stl/_string.h>
42 //----------------------------------------------------------------------
45 template <class _CharT> class numpunct {};
46 template <class _CharT> class numpunct_byname {};
47 template <class _Ch, class _InIt> class num_get;
50 class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
52 friend class _Locale_impl;
54 #ifndef _STLP_NO_FRIEND_TEMPLATES
55 template <class _Ch, class _InIt> friend class num_get;
58 typedef char char_type;
59 typedef string string_type;
61 explicit numpunct(size_t __refs = 0)
62 : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
64 char decimal_point() const { return do_decimal_point(); }
65 char thousands_sep() const { return do_thousands_sep(); }
66 string grouping() const { return do_grouping(); }
67 string truename() const { return do_truename(); }
68 string falsename() const { return do_falsename(); }
70 #if defined(__SYMBIAN32__WSD__)
71 _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
72 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
73 _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
76 // NOTE: Symbian doesn't support exporting static data.
77 // Users of this class should use GetFacetLocaleId() to access the data member id
78 _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
81 #ifndef _STLP_NO_FRIEND_TEMPLATES
85 _STLP_DECLSPEC ~numpunct();
91 _STLP_DECLSPEC virtual char do_decimal_point() const;
92 _STLP_DECLSPEC virtual char do_thousands_sep() const;
93 _STLP_DECLSPEC virtual string do_grouping() const;
94 _STLP_DECLSPEC virtual string do_truename() const;
95 _STLP_DECLSPEC virtual string do_falsename() const;
98 # if ! defined (_STLP_NO_WCHAR_T)
101 class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
103 friend class _Locale_impl;
105 typedef wchar_t char_type;
106 typedef wstring string_type;
108 explicit numpunct(size_t __refs = 0)
109 : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
111 wchar_t decimal_point() const { return do_decimal_point(); }
112 wchar_t thousands_sep() const { return do_thousands_sep(); }
113 string grouping() const { return do_grouping(); }
114 wstring truename() const { return do_truename(); }
115 wstring falsename() const { return do_falsename(); }
117 #if defined(__SYMBIAN32__WSD__)
118 _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
119 #elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__)
120 _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
121 static locale::id id;
123 // NOTE: Symbian doesn't support exporting static data.
124 // Users of this class should use GetFacetLocaleId() to access the data member id
125 _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
130 wstring _M_falsename;
133 _STLP_DECLSPEC ~numpunct();
135 _STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
136 _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
137 _STLP_DECLSPEC virtual string do_grouping() const;
138 _STLP_DECLSPEC virtual wstring do_truename() const;
139 _STLP_DECLSPEC virtual wstring do_falsename() const;
142 # endif /* WCHAR_T */
145 class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
147 typedef char char_type;
148 typedef string string_type;
150 _STLP_DECLSPEC explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
154 _STLP_DECLSPEC ~numpunct_byname();
156 _STLP_DECLSPEC virtual char do_decimal_point() const;
157 _STLP_DECLSPEC virtual char do_thousands_sep() const;
158 _STLP_DECLSPEC virtual string do_grouping() const;
161 _Locale_numeric* _M_numeric;
163 //explicitely defined as private to avoid warnings:
164 typedef numpunct_byname<char> _Self;
165 numpunct_byname(_Self const&);
166 _Self& operator = (_Self const&);
167 friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
170 # ifndef _STLP_NO_WCHAR_T
172 class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
174 typedef wchar_t char_type;
175 typedef wstring string_type;
177 _STLP_DECLSPEC explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
181 _STLP_DECLSPEC ~numpunct_byname();
183 _STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
184 _STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
185 _STLP_DECLSPEC virtual string do_grouping() const;
188 _Locale_numeric* _M_numeric;
190 //explicitely defined as private to avoid warnings:
191 typedef numpunct_byname<wchar_t> _Self;
192 numpunct_byname(_Self const&);
193 _Self& operator = (_Self const&);
196 # endif /* WCHAR_T */
200 #endif /* _STLP_NUMPUNCT_H */