williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
|
williamr@2
|
3 |
*
|
williamr@2
|
4 |
* Copyright (c) 1999
|
williamr@2
|
5 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@2
|
6 |
*
|
williamr@2
|
7 |
* Copyright (c) 1999
|
williamr@2
|
8 |
* Boris Fomitchev
|
williamr@2
|
9 |
*
|
williamr@2
|
10 |
* This material is provided "as is", with absolutely no warranty expressed
|
williamr@2
|
11 |
* or implied. Any use is at your own risk.
|
williamr@2
|
12 |
*
|
williamr@2
|
13 |
* Permission to use or copy this software for any purpose is hereby granted
|
williamr@2
|
14 |
* without fee, provided the above notices are retained on all copies.
|
williamr@2
|
15 |
* Permission to modify the code and to distribute modified code is granted,
|
williamr@2
|
16 |
* provided the above notices are retained, and a notice that the code was
|
williamr@2
|
17 |
* modified is included with the above copyright notice.
|
williamr@2
|
18 |
*
|
williamr@2
|
19 |
*/
|
williamr@2
|
20 |
// WARNING: This is an internal header file, included by other C++
|
williamr@2
|
21 |
// standard library headers. You should not attempt to use this header
|
williamr@2
|
22 |
// file directly.
|
williamr@2
|
23 |
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#ifndef _STLP_INTERNAL_NUMPUNCT_H
|
williamr@2
|
26 |
#define _STLP_INTERNAL_NUMPUNCT_H
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#ifndef _STLP_IOS_BASE_H
|
williamr@2
|
29 |
# include <stl/_ios_base.h>
|
williamr@2
|
30 |
#endif
|
williamr@2
|
31 |
|
williamr@2
|
32 |
# ifndef _STLP_C_LOCALE_H
|
williamr@2
|
33 |
# include <stl/c_locale.h>
|
williamr@2
|
34 |
# endif
|
williamr@2
|
35 |
|
williamr@2
|
36 |
#ifndef _STLP_STRING_H
|
williamr@2
|
37 |
# include <stl/_string.h>
|
williamr@2
|
38 |
#endif
|
williamr@2
|
39 |
|
williamr@2
|
40 |
_STLP_BEGIN_NAMESPACE
|
williamr@2
|
41 |
|
williamr@2
|
42 |
//----------------------------------------------------------------------
|
williamr@2
|
43 |
// numpunct facets
|
williamr@2
|
44 |
|
williamr@2
|
45 |
#ifdef __SYMBIAN32__
|
williamr@2
|
46 |
extern locale::id& Numpunct_charT_GetFacetLocaleId(const char* type);
|
williamr@2
|
47 |
|
williamr@2
|
48 |
template <class _CharT> class numpunct: public locale::facet
|
williamr@2
|
49 |
{
|
williamr@2
|
50 |
friend class _Locale;
|
williamr@2
|
51 |
public:
|
williamr@2
|
52 |
typedef char char_type;
|
williamr@2
|
53 |
typedef basic_string<_CharT> string_type;
|
williamr@2
|
54 |
explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {
|
williamr@2
|
55 |
_M_truename.append(1, (_CharT)'t');
|
williamr@2
|
56 |
_M_truename.append(1, (_CharT)'r');
|
williamr@2
|
57 |
_M_truename.append(1, (_CharT)'u');
|
williamr@2
|
58 |
_M_truename.append(1, (_CharT)'e');
|
williamr@2
|
59 |
|
williamr@2
|
60 |
_M_falsename.append(1, (_CharT)'f');
|
williamr@2
|
61 |
_M_falsename.append(1, (_CharT)'a');
|
williamr@2
|
62 |
_M_falsename.append(1, (_CharT)'l');
|
williamr@2
|
63 |
_M_falsename.append(1, (_CharT)'s');
|
williamr@2
|
64 |
_M_falsename.append(1, (_CharT)'e');
|
williamr@2
|
65 |
}
|
williamr@2
|
66 |
|
williamr@2
|
67 |
_CharT decimal_point() const { return do_decimal_point(); }
|
williamr@2
|
68 |
_CharT thousands_sep() const { return do_thousands_sep(); }
|
williamr@2
|
69 |
string grouping() const { return do_grouping(); }
|
williamr@2
|
70 |
string_type truename() const { return do_truename(); }
|
williamr@2
|
71 |
string_type falsename() const { return do_falsename(); }
|
williamr@2
|
72 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
73 |
static locale::id& GetFacetLocaleId(){return Numpunct_charT_GetFacetLocaleId(typeid(_CharT).name()); }
|
williamr@2
|
74 |
#else
|
williamr@2
|
75 |
static locale::id id;
|
williamr@2
|
76 |
#endif
|
williamr@2
|
77 |
|
williamr@2
|
78 |
# ifndef _STLP_NO_FRIEND_TEMPLATES
|
williamr@2
|
79 |
protected:
|
williamr@2
|
80 |
# endif
|
williamr@2
|
81 |
~numpunct();
|
williamr@2
|
82 |
|
williamr@2
|
83 |
protected:
|
williamr@2
|
84 |
static string_type _M_truename;
|
williamr@2
|
85 |
static string_type _M_falsename;
|
williamr@2
|
86 |
static string _M_grouping;
|
williamr@2
|
87 |
protected:
|
williamr@2
|
88 |
|
williamr@2
|
89 |
virtual _CharT do_decimal_point() const;
|
williamr@2
|
90 |
virtual _CharT do_thousands_sep() const;
|
williamr@2
|
91 |
virtual string do_grouping() const;
|
williamr@2
|
92 |
virtual string_type do_truename() const;
|
williamr@2
|
93 |
virtual string_type do_falsename() const;
|
williamr@2
|
94 |
};
|
williamr@2
|
95 |
|
williamr@2
|
96 |
template <class _CharT>
|
williamr@2
|
97 |
basic_string<_CharT> numpunct<_CharT>::_M_truename;
|
williamr@2
|
98 |
template <class _CharT>
|
williamr@2
|
99 |
basic_string<_CharT> numpunct<_CharT>::_M_falsename;
|
williamr@2
|
100 |
template <class _CharT>
|
williamr@2
|
101 |
string numpunct<_CharT>::_M_grouping ;
|
williamr@2
|
102 |
|
williamr@2
|
103 |
_STLP_DECLSPEC _Locale_numeric* __acquire_numericE(const char* );
|
williamr@2
|
104 |
_STLP_DECLSPEC void __release_numericE(_Locale_numeric* );
|
williamr@2
|
105 |
_STLP_DECLSPEC const char* _Locale_trueE(_Locale_numeric*);
|
williamr@2
|
106 |
_STLP_DECLSPEC const char* _Locale_falseE(_Locale_numeric*);
|
williamr@2
|
107 |
_STLP_DECLSPEC char _Locale_decimal_pointE(_Locale_numeric*);
|
williamr@2
|
108 |
_STLP_DECLSPEC char _Locale_thousands_sepE(_Locale_numeric*);
|
williamr@2
|
109 |
_STLP_DECLSPEC const char*_Locale_groupingE(_Locale_numeric*);
|
williamr@2
|
110 |
|
williamr@2
|
111 |
template <class _CharT>
|
williamr@2
|
112 |
class numpunct_byname : public numpunct<_CharT>{
|
williamr@2
|
113 |
public:
|
williamr@2
|
114 |
typedef _CharT char_type;
|
williamr@2
|
115 |
typedef basic_string<_CharT> string_type;
|
williamr@2
|
116 |
|
williamr@2
|
117 |
explicit numpunct_byname(const char* name, size_t refs = 0);
|
williamr@2
|
118 |
protected:
|
williamr@2
|
119 |
|
williamr@2
|
120 |
~numpunct_byname();
|
williamr@2
|
121 |
|
williamr@2
|
122 |
virtual _CharT do_decimal_point() const;
|
williamr@2
|
123 |
virtual _CharT do_thousands_sep() const;
|
williamr@2
|
124 |
virtual string do_grouping() const;
|
williamr@2
|
125 |
|
williamr@2
|
126 |
private:
|
williamr@2
|
127 |
_Locale_numeric* _M_numeric;
|
williamr@2
|
128 |
};
|
williamr@2
|
129 |
|
williamr@2
|
130 |
#else
|
williamr@2
|
131 |
template <class _CharT> class numpunct {};
|
williamr@2
|
132 |
template <class _CharT> class numpunct_byname {};
|
williamr@2
|
133 |
#endif
|
williamr@2
|
134 |
template <class _Ch, class _InIt> class num_get;
|
williamr@2
|
135 |
|
williamr@2
|
136 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
137 |
#ifdef __SYMBIAN32__
|
williamr@2
|
138 |
class numpunct <char> : public locale::facet
|
williamr@2
|
139 |
#else
|
williamr@2
|
140 |
class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
|
williamr@2
|
141 |
#endif
|
williamr@2
|
142 |
{
|
williamr@2
|
143 |
friend class _Locale;
|
williamr@2
|
144 |
# ifndef _STLP_NO_FRIEND_TEMPLATES
|
williamr@2
|
145 |
template <class _Ch, class _InIt> friend class num_get;
|
williamr@2
|
146 |
# endif
|
williamr@2
|
147 |
public:
|
williamr@2
|
148 |
typedef char char_type;
|
williamr@2
|
149 |
typedef string string_type;
|
williamr@2
|
150 |
|
williamr@2
|
151 |
explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
|
williamr@2
|
152 |
|
williamr@2
|
153 |
char decimal_point() const { return do_decimal_point(); }
|
williamr@2
|
154 |
char thousands_sep() const { return do_thousands_sep(); }
|
williamr@2
|
155 |
string grouping() const { return do_grouping(); }
|
williamr@2
|
156 |
string truename() const { return do_truename(); }
|
williamr@2
|
157 |
string falsename() const { return do_falsename(); }
|
williamr@2
|
158 |
|
williamr@2
|
159 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
160 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
161 |
#else
|
williamr@2
|
162 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
163 |
#endif
|
williamr@2
|
164 |
|
williamr@2
|
165 |
# ifndef _STLP_NO_FRIEND_TEMPLATES
|
williamr@2
|
166 |
protected:
|
williamr@2
|
167 |
# endif
|
williamr@2
|
168 |
~numpunct(){};
|
williamr@2
|
169 |
|
williamr@2
|
170 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
171 |
public:
|
williamr@2
|
172 |
_STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_truename();
|
williamr@2
|
173 |
_STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_falsename();
|
williamr@2
|
174 |
_STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_grouping();
|
williamr@2
|
175 |
#else
|
williamr@2
|
176 |
protected:
|
williamr@2
|
177 |
_STLP_STATIC_MEMBER_DECLSPEC static string _M_truename;
|
williamr@2
|
178 |
_STLP_STATIC_MEMBER_DECLSPEC static string _M_falsename;
|
williamr@2
|
179 |
_STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
|
williamr@2
|
180 |
#endif
|
williamr@2
|
181 |
|
williamr@2
|
182 |
protected:
|
williamr@2
|
183 |
|
williamr@2
|
184 |
_STLP_DECLSPEC virtual char do_decimal_point() const;
|
williamr@2
|
185 |
_STLP_DECLSPEC virtual char do_thousands_sep() const;
|
williamr@2
|
186 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
187 |
_STLP_DECLSPEC virtual string do_truename() const;
|
williamr@2
|
188 |
_STLP_DECLSPEC virtual string do_falsename() const;
|
williamr@2
|
189 |
};
|
williamr@2
|
190 |
|
williamr@2
|
191 |
# if ! defined (_STLP_NO_WCHAR_T)
|
williamr@2
|
192 |
|
williamr@2
|
193 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
194 |
#ifdef __SYMBIAN32__
|
williamr@2
|
195 |
class numpunct<wchar_t> : public locale::facet
|
williamr@2
|
196 |
#else
|
williamr@2
|
197 |
class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
|
williamr@2
|
198 |
#endif
|
williamr@2
|
199 |
{
|
williamr@2
|
200 |
friend class _Locale;
|
williamr@2
|
201 |
public:
|
williamr@2
|
202 |
typedef wchar_t char_type;
|
williamr@2
|
203 |
typedef wstring string_type;
|
williamr@2
|
204 |
|
williamr@2
|
205 |
explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
|
williamr@2
|
206 |
|
williamr@2
|
207 |
wchar_t decimal_point() const { return do_decimal_point(); }
|
williamr@2
|
208 |
wchar_t thousands_sep() const { return do_thousands_sep(); }
|
williamr@2
|
209 |
string grouping() const { return do_grouping(); }
|
williamr@2
|
210 |
wstring truename() const { return do_truename(); }
|
williamr@2
|
211 |
wstring falsename() const { return do_falsename(); }
|
williamr@2
|
212 |
|
williamr@2
|
213 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
214 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
215 |
#else
|
williamr@2
|
216 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
217 |
#endif
|
williamr@2
|
218 |
|
williamr@2
|
219 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
220 |
public:
|
williamr@2
|
221 |
_STLP_STATIC_MEMBER_DECLSPEC static wstring& GetNumPunct_M_Wchar_truename();
|
williamr@2
|
222 |
_STLP_STATIC_MEMBER_DECLSPEC static wstring& GetNumPunct_M_Wchar_falsename();
|
williamr@2
|
223 |
_STLP_STATIC_MEMBER_DECLSPEC static string& GetNumPunct_M_Wchar_grouping();
|
williamr@2
|
224 |
#else
|
williamr@2
|
225 |
protected:
|
williamr@2
|
226 |
_STLP_STATIC_MEMBER_DECLSPEC static wstring _M_truename;
|
williamr@2
|
227 |
_STLP_STATIC_MEMBER_DECLSPEC static wstring _M_falsename;
|
williamr@2
|
228 |
_STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
|
williamr@2
|
229 |
#endif
|
williamr@2
|
230 |
protected:
|
williamr@2
|
231 |
~numpunct() {}
|
williamr@2
|
232 |
|
williamr@2
|
233 |
_STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
|
williamr@2
|
234 |
_STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
|
williamr@2
|
235 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
236 |
_STLP_DECLSPEC virtual wstring do_truename() const;
|
williamr@2
|
237 |
_STLP_DECLSPEC virtual wstring do_falsename() const;
|
williamr@2
|
238 |
};
|
williamr@2
|
239 |
|
williamr@2
|
240 |
# endif /* WCHAR_T */
|
williamr@2
|
241 |
|
williamr@2
|
242 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
243 |
class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
|
williamr@2
|
244 |
public:
|
williamr@2
|
245 |
typedef char char_type;
|
williamr@2
|
246 |
typedef string string_type;
|
williamr@2
|
247 |
|
williamr@2
|
248 |
explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
|
williamr@2
|
249 |
|
williamr@2
|
250 |
protected:
|
williamr@2
|
251 |
|
williamr@2
|
252 |
_STLP_DECLSPEC ~numpunct_byname();
|
williamr@2
|
253 |
|
williamr@2
|
254 |
_STLP_DECLSPEC virtual char do_decimal_point() const;
|
williamr@2
|
255 |
_STLP_DECLSPEC virtual char do_thousands_sep() const;
|
williamr@2
|
256 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
257 |
|
williamr@2
|
258 |
private:
|
williamr@2
|
259 |
_Locale_numeric* _M_numeric;
|
williamr@2
|
260 |
};
|
williamr@2
|
261 |
|
williamr@2
|
262 |
# ifndef _STLP_NO_WCHAR_T
|
williamr@2
|
263 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
264 |
class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
|
williamr@2
|
265 |
public:
|
williamr@2
|
266 |
typedef wchar_t char_type;
|
williamr@2
|
267 |
typedef wstring string_type;
|
williamr@2
|
268 |
|
williamr@2
|
269 |
explicit _STLP_DECLSPEC numpunct_byname(const char* __name, size_t __refs = 0);
|
williamr@2
|
270 |
|
williamr@2
|
271 |
protected:
|
williamr@2
|
272 |
|
williamr@2
|
273 |
_STLP_DECLSPEC ~numpunct_byname();
|
williamr@2
|
274 |
|
williamr@2
|
275 |
_STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
|
williamr@2
|
276 |
_STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
|
williamr@2
|
277 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
278 |
|
williamr@2
|
279 |
private:
|
williamr@2
|
280 |
_Locale_numeric* _M_numeric;
|
williamr@2
|
281 |
};
|
williamr@2
|
282 |
|
williamr@2
|
283 |
# endif /* WCHAR_T */
|
williamr@2
|
284 |
|
williamr@2
|
285 |
#ifdef __SYMBIAN32__
|
williamr@2
|
286 |
#include<stl/_numpunct.c>
|
williamr@2
|
287 |
#endif
|
williamr@2
|
288 |
_STLP_END_NAMESPACE
|
williamr@2
|
289 |
|
williamr@2
|
290 |
#endif /* _STLP_NUMPUNCT_H */
|
williamr@2
|
291 |
|
williamr@2
|
292 |
// Local Variables:
|
williamr@2
|
293 |
// mode:C++
|
williamr@2
|
294 |
// End:
|
williamr@2
|
295 |
|