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_MONETARY_H
|
williamr@2
|
26 |
#define _STLP_INTERNAL_MONETARY_H
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#ifndef _STLP_INTERNAL_CTYPE_H
|
williamr@2
|
29 |
# include <stl/_ctype.h>
|
williamr@2
|
30 |
#endif
|
williamr@2
|
31 |
|
williamr@2
|
32 |
#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
|
williamr@2
|
33 |
# include <stl/_ostreambuf_iterator.h>
|
williamr@2
|
34 |
#endif
|
williamr@2
|
35 |
|
williamr@2
|
36 |
#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
|
williamr@2
|
37 |
# include <stl/_istreambuf_iterator.h>
|
williamr@2
|
38 |
#endif
|
williamr@2
|
39 |
|
williamr@2
|
40 |
_STLP_BEGIN_NAMESPACE
|
williamr@2
|
41 |
|
williamr@2
|
42 |
class money_base {
|
williamr@2
|
43 |
public:
|
williamr@2
|
44 |
enum part {none, space, symbol, sign, value};
|
williamr@2
|
45 |
struct pattern {
|
williamr@2
|
46 |
char field[4];
|
williamr@2
|
47 |
};
|
williamr@2
|
48 |
};
|
williamr@2
|
49 |
|
williamr@2
|
50 |
|
williamr@2
|
51 |
#ifdef __SYMBIAN32__
|
williamr@2
|
52 |
|
williamr@2
|
53 |
extern locale::id& Moneypunct_charT_GetFacetLocaleId(const char* type);
|
williamr@2
|
54 |
_STLP_DECLSPEC void _Init_monetary_formatsE(money_base::pattern& pos_format,
|
williamr@2
|
55 |
money_base::pattern& neg_format);
|
williamr@2
|
56 |
|
williamr@2
|
57 |
template <class _CharT, __DFL_NON_TYPE_PARAM(bool, _International, false) >
|
williamr@2
|
58 |
class moneypunct : public locale::facet , public money_base
|
williamr@2
|
59 |
{
|
williamr@2
|
60 |
public:
|
williamr@2
|
61 |
typedef _CharT char_type;
|
williamr@2
|
62 |
typedef basic_string<_CharT> string_type;
|
williamr@2
|
63 |
explicit moneypunct _STLP_PSPEC2(_CharT, _International) (size_t __refs = 0)
|
williamr@2
|
64 |
{
|
williamr@2
|
65 |
_Init_monetary_formatsE(_M_pos_format, _M_neg_format);
|
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 curr_symbol() const { return do_curr_symbol(); }
|
williamr@2
|
71 |
string_type positive_sign() const { return do_positive_sign(); }
|
williamr@2
|
72 |
string_type negative_sign() const { return do_negative_sign(); }
|
williamr@2
|
73 |
int frac_digits() const { return do_frac_digits(); }
|
williamr@2
|
74 |
pattern pos_format() const { return do_pos_format(); }
|
williamr@2
|
75 |
pattern neg_format() const { return do_neg_format(); }
|
williamr@2
|
76 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
77 |
static locale::id& GetFacetLocaleId(){return Moneypunct_charT_GetFacetLocaleId(typeid(_CharT).name()); };
|
williamr@2
|
78 |
#else
|
williamr@2
|
79 |
static locale::id id;
|
williamr@2
|
80 |
#endif
|
williamr@2
|
81 |
# if defined (_STLP_STATIC_CONST_INIT_BUG)
|
williamr@2
|
82 |
enum _IntlVal { intl = _International } ;
|
williamr@2
|
83 |
# else
|
williamr@2
|
84 |
static const bool intl = _International;
|
williamr@2
|
85 |
# endif
|
williamr@2
|
86 |
|
williamr@2
|
87 |
protected:
|
williamr@2
|
88 |
pattern _M_pos_format;
|
williamr@2
|
89 |
pattern _M_neg_format;
|
williamr@2
|
90 |
|
williamr@2
|
91 |
static string_type _M_psign, _M_nsign, _M_currSym;
|
williamr@2
|
92 |
static string _M_group;
|
williamr@2
|
93 |
~moneypunct _STLP_PSPEC2(char, true) () { };
|
williamr@2
|
94 |
|
williamr@2
|
95 |
virtual _CharT do_decimal_point() const;
|
williamr@2
|
96 |
virtual _CharT do_thousands_sep() const;
|
williamr@2
|
97 |
virtual string do_grouping() const;
|
williamr@2
|
98 |
|
williamr@2
|
99 |
virtual basic_string<_CharT> do_curr_symbol() const;
|
williamr@2
|
100 |
|
williamr@2
|
101 |
virtual basic_string<_CharT> do_positive_sign() const;
|
williamr@2
|
102 |
virtual basic_string<_CharT> do_negative_sign() const;
|
williamr@2
|
103 |
virtual int do_frac_digits() const;
|
williamr@2
|
104 |
virtual pattern do_pos_format() const;
|
williamr@2
|
105 |
virtual pattern do_neg_format() const;
|
williamr@2
|
106 |
|
williamr@2
|
107 |
friend class _Locale;
|
williamr@2
|
108 |
|
williamr@2
|
109 |
};
|
williamr@2
|
110 |
template <class _CharT, bool _International>
|
williamr@2
|
111 |
string moneypunct<_CharT, _International>::_M_group;
|
williamr@2
|
112 |
template <class _CharT, bool _International>
|
williamr@2
|
113 |
basic_string<_CharT> moneypunct<_CharT, _International>::_M_psign;
|
williamr@2
|
114 |
template <class _CharT, bool _International>
|
williamr@2
|
115 |
basic_string<_CharT> moneypunct<_CharT, _International>::_M_nsign;
|
williamr@2
|
116 |
template <class _CharT, bool _International>
|
williamr@2
|
117 |
basic_string<_CharT> moneypunct<_CharT, _International>::_M_currSym;
|
williamr@2
|
118 |
|
williamr@2
|
119 |
|
williamr@2
|
120 |
#else
|
williamr@2
|
121 |
// moneypunct facets: forward declaration
|
williamr@2
|
122 |
template <class _charT, __DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
|
williamr@2
|
123 |
#endif
|
williamr@2
|
124 |
|
williamr@2
|
125 |
// money_get facets
|
williamr@2
|
126 |
|
williamr@2
|
127 |
template <class _CharT, __DFL_TMPL_PARAM(_InputIter , istreambuf_iterator<_CharT>) >
|
williamr@2
|
128 |
class money_get : public locale::facet
|
williamr@2
|
129 |
{
|
williamr@2
|
130 |
friend class _Locale;
|
williamr@2
|
131 |
public:
|
williamr@2
|
132 |
typedef _CharT char_type;
|
williamr@2
|
133 |
typedef _InputIter iter_type;
|
williamr@2
|
134 |
typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
|
williamr@2
|
135 |
|
williamr@2
|
136 |
money_get(size_t __refs = 0) : _BaseFacet(__refs) {}
|
williamr@2
|
137 |
# ifndef _STLP_NO_LONG_DOUBLE
|
williamr@2
|
138 |
iter_type get(iter_type __s, iter_type __end, bool __intl,
|
williamr@2
|
139 |
ios_base& __str, ios_base::iostate& __err,
|
williamr@2
|
140 |
long double& __units) const
|
williamr@2
|
141 |
{ return do_get(__s, __end, __intl, __str, __err, __units); }
|
williamr@2
|
142 |
# endif
|
williamr@2
|
143 |
iter_type get(iter_type __s, iter_type __end, bool __intl,
|
williamr@2
|
144 |
ios_base& __str, ios_base::iostate& __err,
|
williamr@2
|
145 |
string_type& __digits) const
|
williamr@2
|
146 |
{ return do_get(__s, __end, __intl, __str, __err, __digits); }
|
williamr@2
|
147 |
|
williamr@2
|
148 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
149 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
150 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator<wchar_t, char_traits<wchar_t> >* );
|
williamr@2
|
151 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const wchar_t**);
|
williamr@2
|
152 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator<char, char_traits<char> >* );
|
williamr@2
|
153 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const char **);
|
williamr@2
|
154 |
#else
|
williamr@2
|
155 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
156 |
#endif
|
williamr@2
|
157 |
|
williamr@2
|
158 |
protected:
|
williamr@2
|
159 |
~money_get() {}
|
williamr@2
|
160 |
# ifndef _STLP_NO_LONG_DOUBLE
|
williamr@2
|
161 |
virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
|
williamr@2
|
162 |
ios_base& __str, ios_base::iostate& __err,
|
williamr@2
|
163 |
long double& __units) const;
|
williamr@2
|
164 |
# endif
|
williamr@2
|
165 |
virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
|
williamr@2
|
166 |
ios_base& __str, ios_base::iostate& __err,
|
williamr@2
|
167 |
string_type& __digits) const;
|
williamr@2
|
168 |
};
|
williamr@2
|
169 |
|
williamr@2
|
170 |
|
williamr@2
|
171 |
// moneypunct facets: definition of specializations
|
williamr@2
|
172 |
|
williamr@2
|
173 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
174 |
#ifdef __SYMBIAN32__
|
williamr@2
|
175 |
class moneypunct<char, true> : public locale::facet, public money_base
|
williamr@2
|
176 |
#else
|
williamr@2
|
177 |
class _STLP_CLASS_DECLSPEC moneypunct<char, true> : public locale::facet, public money_base
|
williamr@2
|
178 |
#endif
|
williamr@2
|
179 |
{
|
williamr@2
|
180 |
|
williamr@2
|
181 |
public:
|
williamr@2
|
182 |
typedef char char_type;
|
williamr@2
|
183 |
typedef string string_type;
|
williamr@2
|
184 |
_STLP_DECLSPEC explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
|
williamr@2
|
185 |
|
williamr@2
|
186 |
char decimal_point() const { return do_decimal_point(); }
|
williamr@2
|
187 |
char thousands_sep() const { return do_thousands_sep(); }
|
williamr@2
|
188 |
string grouping() const { return do_grouping(); }
|
williamr@2
|
189 |
string_type curr_symbol() const { return do_curr_symbol(); }
|
williamr@2
|
190 |
string_type positive_sign() const { return do_positive_sign(); }
|
williamr@2
|
191 |
string_type negative_sign() const { return do_negative_sign(); }
|
williamr@2
|
192 |
int frac_digits() const { return do_frac_digits(); }
|
williamr@2
|
193 |
pattern pos_format() const { return do_pos_format(); }
|
williamr@2
|
194 |
pattern neg_format() const { return do_neg_format(); }
|
williamr@2
|
195 |
|
williamr@2
|
196 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
197 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
198 |
#else
|
williamr@2
|
199 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
200 |
#endif
|
williamr@2
|
201 |
# if defined (_STLP_STATIC_CONST_INIT_BUG)
|
williamr@2
|
202 |
enum _IntlVal { intl = 1 } ;
|
williamr@2
|
203 |
# else
|
williamr@2
|
204 |
static const bool intl = true;
|
williamr@2
|
205 |
# endif
|
williamr@2
|
206 |
|
williamr@2
|
207 |
protected:
|
williamr@2
|
208 |
pattern _M_pos_format;
|
williamr@2
|
209 |
pattern _M_neg_format;
|
williamr@2
|
210 |
|
williamr@2
|
211 |
_STLP_DECLSPEC ~moneypunct _STLP_PSPEC2(char, true) ();
|
williamr@2
|
212 |
|
williamr@2
|
213 |
_STLP_DECLSPEC virtual char do_decimal_point() const;
|
williamr@2
|
214 |
_STLP_DECLSPEC virtual char do_thousands_sep() const;
|
williamr@2
|
215 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
216 |
|
williamr@2
|
217 |
_STLP_DECLSPEC virtual string do_curr_symbol() const;
|
williamr@2
|
218 |
|
williamr@2
|
219 |
_STLP_DECLSPEC virtual string do_positive_sign() const;
|
williamr@2
|
220 |
_STLP_DECLSPEC virtual string do_negative_sign() const;
|
williamr@2
|
221 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
222 |
_STLP_DECLSPEC virtual pattern do_pos_format() const;
|
williamr@2
|
223 |
_STLP_DECLSPEC virtual pattern do_neg_format() const;
|
williamr@2
|
224 |
|
williamr@2
|
225 |
friend class _Locale;
|
williamr@2
|
226 |
|
williamr@2
|
227 |
};
|
williamr@2
|
228 |
|
williamr@2
|
229 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
230 |
#ifdef __SYMBIAN32__
|
williamr@2
|
231 |
class moneypunct<char, false> : public locale::facet, public money_base
|
williamr@2
|
232 |
#else
|
williamr@2
|
233 |
class _STLP_CLASS_DECLSPEC moneypunct<char, false> : public locale::facet, public money_base
|
williamr@2
|
234 |
#endif
|
williamr@2
|
235 |
{
|
williamr@2
|
236 |
public:
|
williamr@2
|
237 |
typedef char char_type;
|
williamr@2
|
238 |
typedef string string_type;
|
williamr@2
|
239 |
|
williamr@2
|
240 |
_STLP_DECLSPEC explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
|
williamr@2
|
241 |
|
williamr@2
|
242 |
char decimal_point() const { return do_decimal_point(); }
|
williamr@2
|
243 |
char thousands_sep() const { return do_thousands_sep(); }
|
williamr@2
|
244 |
string grouping() const { return do_grouping(); }
|
williamr@2
|
245 |
string_type curr_symbol() const { return do_curr_symbol(); }
|
williamr@2
|
246 |
string_type positive_sign() const { return do_positive_sign(); }
|
williamr@2
|
247 |
string_type negative_sign() const { return do_negative_sign(); }
|
williamr@2
|
248 |
int frac_digits() const { return do_frac_digits(); }
|
williamr@2
|
249 |
pattern pos_format() const { return do_pos_format(); }
|
williamr@2
|
250 |
pattern neg_format() const { return do_neg_format(); }
|
williamr@2
|
251 |
|
williamr@2
|
252 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
253 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
254 |
#else
|
williamr@2
|
255 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
256 |
#endif
|
williamr@2
|
257 |
# if defined (_STLP_STATIC_CONST_INIT_BUG)
|
williamr@2
|
258 |
enum _IntlVal { intl = 0 } ;
|
williamr@2
|
259 |
# else
|
williamr@2
|
260 |
static const bool intl = false;
|
williamr@2
|
261 |
# endif
|
williamr@2
|
262 |
|
williamr@2
|
263 |
protected:
|
williamr@2
|
264 |
pattern _M_pos_format;
|
williamr@2
|
265 |
pattern _M_neg_format;
|
williamr@2
|
266 |
|
williamr@2
|
267 |
_STLP_DECLSPEC ~moneypunct _STLP_PSPEC2(char, false) ();
|
williamr@2
|
268 |
|
williamr@2
|
269 |
_STLP_DECLSPEC virtual char do_decimal_point() const;
|
williamr@2
|
270 |
_STLP_DECLSPEC virtual char do_thousands_sep() const;
|
williamr@2
|
271 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
272 |
|
williamr@2
|
273 |
_STLP_DECLSPEC virtual string do_curr_symbol() const;
|
williamr@2
|
274 |
|
williamr@2
|
275 |
_STLP_DECLSPEC virtual string do_positive_sign() const;
|
williamr@2
|
276 |
_STLP_DECLSPEC virtual string do_negative_sign() const;
|
williamr@2
|
277 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
278 |
_STLP_DECLSPEC virtual pattern do_pos_format() const;
|
williamr@2
|
279 |
_STLP_DECLSPEC virtual pattern do_neg_format() const;
|
williamr@2
|
280 |
|
williamr@2
|
281 |
friend class _Locale;
|
williamr@2
|
282 |
};
|
williamr@2
|
283 |
|
williamr@2
|
284 |
|
williamr@2
|
285 |
# ifndef _STLP_NO_WCHAR_T
|
williamr@2
|
286 |
|
williamr@2
|
287 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
288 |
#ifdef __SYMBIAN32__
|
williamr@2
|
289 |
class moneypunct<wchar_t, true> : public locale::facet, public money_base
|
williamr@2
|
290 |
#else
|
williamr@2
|
291 |
class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, true> : public locale::facet, public money_base
|
williamr@2
|
292 |
#endif
|
williamr@2
|
293 |
{
|
williamr@2
|
294 |
friend class _Locale;
|
williamr@2
|
295 |
public:
|
williamr@2
|
296 |
typedef wchar_t char_type;
|
williamr@2
|
297 |
typedef wstring string_type;
|
williamr@2
|
298 |
_STLP_DECLSPEC explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
|
williamr@2
|
299 |
wchar_t decimal_point() const { return do_decimal_point(); }
|
williamr@2
|
300 |
wchar_t thousands_sep() const { return do_thousands_sep(); }
|
williamr@2
|
301 |
string grouping() const { return do_grouping(); }
|
williamr@2
|
302 |
string_type curr_symbol() const { return do_curr_symbol(); }
|
williamr@2
|
303 |
string_type positive_sign() const { return do_positive_sign(); }
|
williamr@2
|
304 |
string_type negative_sign() const { return do_negative_sign(); }
|
williamr@2
|
305 |
int frac_digits() const { return do_frac_digits(); }
|
williamr@2
|
306 |
pattern pos_format() const { return do_pos_format(); }
|
williamr@2
|
307 |
pattern neg_format() const { return do_neg_format(); }
|
williamr@2
|
308 |
|
williamr@2
|
309 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
310 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
311 |
#else
|
williamr@2
|
312 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
313 |
#endif
|
williamr@2
|
314 |
# if defined (_STLP_STATIC_CONST_INIT_BUG)
|
williamr@2
|
315 |
enum _IntlVal { intl = 1 } ;
|
williamr@2
|
316 |
# else
|
williamr@2
|
317 |
static const bool intl = true;
|
williamr@2
|
318 |
# endif
|
williamr@2
|
319 |
|
williamr@2
|
320 |
protected:
|
williamr@2
|
321 |
pattern _M_pos_format;
|
williamr@2
|
322 |
pattern _M_neg_format;
|
williamr@2
|
323 |
|
williamr@2
|
324 |
_STLP_DECLSPEC ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
|
williamr@2
|
325 |
|
williamr@2
|
326 |
_STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
|
williamr@2
|
327 |
_STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
|
williamr@2
|
328 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
329 |
|
williamr@2
|
330 |
_STLP_DECLSPEC virtual string_type do_curr_symbol() const;
|
williamr@2
|
331 |
|
williamr@2
|
332 |
_STLP_DECLSPEC virtual string_type do_positive_sign() const;
|
williamr@2
|
333 |
_STLP_DECLSPEC virtual string_type do_negative_sign() const;
|
williamr@2
|
334 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
335 |
_STLP_DECLSPEC virtual pattern do_pos_format() const;
|
williamr@2
|
336 |
_STLP_DECLSPEC virtual pattern do_neg_format() const;
|
williamr@2
|
337 |
};
|
williamr@2
|
338 |
|
williamr@2
|
339 |
|
williamr@2
|
340 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
341 |
#ifdef __SYMBIAN32__
|
williamr@2
|
342 |
class moneypunct<wchar_t, false> : public locale::facet, public money_base
|
williamr@2
|
343 |
#else
|
williamr@2
|
344 |
class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, false> : public locale::facet, public money_base
|
williamr@2
|
345 |
#endif
|
williamr@2
|
346 |
{
|
williamr@2
|
347 |
friend class _Locale;
|
williamr@2
|
348 |
public:
|
williamr@2
|
349 |
typedef wchar_t char_type;
|
williamr@2
|
350 |
typedef wstring string_type;
|
williamr@2
|
351 |
_STLP_DECLSPEC explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
|
williamr@2
|
352 |
wchar_t decimal_point() const { return do_decimal_point(); }
|
williamr@2
|
353 |
wchar_t thousands_sep() const { return do_thousands_sep(); }
|
williamr@2
|
354 |
string grouping() const { return do_grouping(); }
|
williamr@2
|
355 |
string_type curr_symbol() const { return do_curr_symbol(); }
|
williamr@2
|
356 |
string_type positive_sign() const { return do_positive_sign(); }
|
williamr@2
|
357 |
string_type negative_sign() const { return do_negative_sign(); }
|
williamr@2
|
358 |
int frac_digits() const { return do_frac_digits(); }
|
williamr@2
|
359 |
pattern pos_format() const { return do_pos_format(); }
|
williamr@2
|
360 |
pattern neg_format() const { return do_neg_format(); }
|
williamr@2
|
361 |
|
williamr@2
|
362 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
363 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
364 |
#else
|
williamr@2
|
365 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
366 |
#endif
|
williamr@2
|
367 |
# if defined (_STLP_STATIC_CONST_INIT_BUG)
|
williamr@2
|
368 |
enum _IntlVal { intl = 0 } ;
|
williamr@2
|
369 |
# else
|
williamr@2
|
370 |
static const bool intl = false;
|
williamr@2
|
371 |
# endif
|
williamr@2
|
372 |
|
williamr@2
|
373 |
protected:
|
williamr@2
|
374 |
pattern _M_pos_format;
|
williamr@2
|
375 |
pattern _M_neg_format;
|
williamr@2
|
376 |
|
williamr@2
|
377 |
_STLP_DECLSPEC ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
|
williamr@2
|
378 |
|
williamr@2
|
379 |
_STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
|
williamr@2
|
380 |
_STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
|
williamr@2
|
381 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
382 |
|
williamr@2
|
383 |
_STLP_DECLSPEC virtual string_type do_curr_symbol() const;
|
williamr@2
|
384 |
|
williamr@2
|
385 |
_STLP_DECLSPEC virtual string_type do_positive_sign() const;
|
williamr@2
|
386 |
_STLP_DECLSPEC virtual string_type do_negative_sign() const;
|
williamr@2
|
387 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
388 |
_STLP_DECLSPEC virtual pattern do_pos_format() const;
|
williamr@2
|
389 |
_STLP_DECLSPEC virtual pattern do_neg_format() const;
|
williamr@2
|
390 |
};
|
williamr@2
|
391 |
|
williamr@2
|
392 |
# endif
|
williamr@2
|
393 |
|
williamr@2
|
394 |
|
williamr@2
|
395 |
#ifdef __SYMBIAN32__
|
williamr@2
|
396 |
_STLP_DECLSPEC _Locale_monetary* __acquire_monetaryE(const char* );
|
williamr@2
|
397 |
_STLP_DECLSPEC void __release_monetaryE (_Locale_monetary* );
|
williamr@2
|
398 |
|
williamr@2
|
399 |
|
williamr@2
|
400 |
_STLP_DECLSPEC char _Locale_mon_decimal_pointE(_Locale_monetary* _M_monetary);
|
williamr@2
|
401 |
|
williamr@2
|
402 |
_STLP_DECLSPEC char _Locale_mon_thousands_sepE(_Locale_monetary* _M_monetary);
|
williamr@2
|
403 |
|
williamr@2
|
404 |
_STLP_DECLSPEC string _Locale_mon_groupingE(_Locale_monetary* _M_monetary);
|
williamr@2
|
405 |
|
williamr@2
|
406 |
_STLP_DECLSPEC string _Locale_int_curr_symbolE(_Locale_monetary* _M_monetary);
|
williamr@2
|
407 |
|
williamr@2
|
408 |
|
williamr@2
|
409 |
_STLP_DECLSPEC string _Locale_positive_signE(_Locale_monetary* _M_monetary);
|
williamr@2
|
410 |
|
williamr@2
|
411 |
_STLP_DECLSPEC string _Locale_negative_signE(_Locale_monetary* _M_monetary);
|
williamr@2
|
412 |
|
williamr@2
|
413 |
_STLP_DECLSPEC int _Locale_int_frac_digitsE(_Locale_monetary* _M_monetary);
|
williamr@2
|
414 |
|
williamr@2
|
415 |
|
williamr@2
|
416 |
template <class _CharT, __DFL_NON_TYPE_PARAM(bool , _International , false) >
|
williamr@2
|
417 |
class moneypunct_byname: public moneypunct<_CharT, _International>
|
williamr@2
|
418 |
{
|
williamr@2
|
419 |
public:
|
williamr@2
|
420 |
typedef money_base::pattern pattern;
|
williamr@2
|
421 |
typedef char char_type;
|
williamr@2
|
422 |
typedef basic_string<_CharT> string_type;
|
williamr@2
|
423 |
|
williamr@2
|
424 |
explicit moneypunct_byname _STLP_PSPEC2(char, _International) (const char * __name, size_t __refs = 0);
|
williamr@2
|
425 |
|
williamr@2
|
426 |
protected:
|
williamr@2
|
427 |
_Locale_monetary* _M_monetary;
|
williamr@2
|
428 |
~moneypunct_byname _STLP_PSPEC2(_CharT, _International) ();
|
williamr@2
|
429 |
virtual _CharT do_decimal_point() const;
|
williamr@2
|
430 |
virtual _CharT do_thousands_sep() const;
|
williamr@2
|
431 |
virtual string do_grouping() const;
|
williamr@2
|
432 |
|
williamr@2
|
433 |
virtual string_type do_curr_symbol() const;
|
williamr@2
|
434 |
|
williamr@2
|
435 |
virtual string_type do_positive_sign() const;
|
williamr@2
|
436 |
virtual string_type do_negative_sign() const;
|
williamr@2
|
437 |
virtual int do_frac_digits() const;
|
williamr@2
|
438 |
private:
|
williamr@2
|
439 |
void Convert_string2_string_chart(basic_string<_CharT> &dst, string src);
|
williamr@2
|
440 |
|
williamr@2
|
441 |
};
|
williamr@2
|
442 |
|
williamr@2
|
443 |
#else
|
williamr@2
|
444 |
|
williamr@2
|
445 |
template <class _charT, __DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
|
williamr@2
|
446 |
|
williamr@2
|
447 |
#endif
|
williamr@2
|
448 |
|
williamr@2
|
449 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
450 |
class _STLP_CLASS_DECLSPEC moneypunct_byname<char, true> : public moneypunct<char, true>
|
williamr@2
|
451 |
{
|
williamr@2
|
452 |
public:
|
williamr@2
|
453 |
typedef money_base::pattern pattern;
|
williamr@2
|
454 |
typedef char char_type;
|
williamr@2
|
455 |
typedef string string_type;
|
williamr@2
|
456 |
|
williamr@2
|
457 |
explicit _STLP_DECLSPEC moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0);
|
williamr@2
|
458 |
|
williamr@2
|
459 |
protected:
|
williamr@2
|
460 |
_Locale_monetary* _M_monetary;
|
williamr@2
|
461 |
_STLP_DECLSPEC ~moneypunct_byname _STLP_PSPEC2(char, true) ();
|
williamr@2
|
462 |
_STLP_DECLSPEC virtual char do_decimal_point() const;
|
williamr@2
|
463 |
_STLP_DECLSPEC virtual char do_thousands_sep() const;
|
williamr@2
|
464 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
465 |
|
williamr@2
|
466 |
_STLP_DECLSPEC virtual string_type do_curr_symbol() const;
|
williamr@2
|
467 |
|
williamr@2
|
468 |
_STLP_DECLSPEC virtual string_type do_positive_sign() const;
|
williamr@2
|
469 |
_STLP_DECLSPEC virtual string_type do_negative_sign() const;
|
williamr@2
|
470 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
471 |
};
|
williamr@2
|
472 |
|
williamr@2
|
473 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
474 |
class _STLP_CLASS_DECLSPEC moneypunct_byname<char, false> : public moneypunct<char, false>
|
williamr@2
|
475 |
{
|
williamr@2
|
476 |
public:
|
williamr@2
|
477 |
typedef money_base::pattern pattern;
|
williamr@2
|
478 |
typedef char char_type;
|
williamr@2
|
479 |
typedef string string_type;
|
williamr@2
|
480 |
|
williamr@2
|
481 |
explicit _STLP_DECLSPEC moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0);
|
williamr@2
|
482 |
|
williamr@2
|
483 |
protected:
|
williamr@2
|
484 |
_Locale_monetary* _M_monetary;
|
williamr@2
|
485 |
_STLP_DECLSPEC ~moneypunct_byname _STLP_PSPEC2(char, false) ();
|
williamr@2
|
486 |
_STLP_DECLSPEC virtual char do_decimal_point() const;
|
williamr@2
|
487 |
_STLP_DECLSPEC virtual char do_thousands_sep() const;
|
williamr@2
|
488 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
489 |
|
williamr@2
|
490 |
_STLP_DECLSPEC virtual string_type do_curr_symbol() const;
|
williamr@2
|
491 |
|
williamr@2
|
492 |
_STLP_DECLSPEC virtual string_type do_positive_sign() const;
|
williamr@2
|
493 |
_STLP_DECLSPEC virtual string_type do_negative_sign() const;
|
williamr@2
|
494 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
495 |
};
|
williamr@2
|
496 |
|
williamr@2
|
497 |
# ifndef _STLP_NO_WCHAR_T
|
williamr@2
|
498 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
499 |
class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, true> : public moneypunct<wchar_t, true>
|
williamr@2
|
500 |
{
|
williamr@2
|
501 |
public:
|
williamr@2
|
502 |
typedef money_base::pattern pattern;
|
williamr@2
|
503 |
typedef wchar_t char_type;
|
williamr@2
|
504 |
typedef wstring string_type;
|
williamr@2
|
505 |
|
williamr@2
|
506 |
explicit _STLP_DECLSPEC moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0);
|
williamr@2
|
507 |
|
williamr@2
|
508 |
protected:
|
williamr@2
|
509 |
_Locale_monetary* _M_monetary;
|
williamr@2
|
510 |
_STLP_DECLSPEC ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
|
williamr@2
|
511 |
_STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
|
williamr@2
|
512 |
_STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
|
williamr@2
|
513 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
514 |
|
williamr@2
|
515 |
_STLP_DECLSPEC virtual string_type do_curr_symbol() const;
|
williamr@2
|
516 |
|
williamr@2
|
517 |
_STLP_DECLSPEC virtual string_type do_positive_sign() const;
|
williamr@2
|
518 |
_STLP_DECLSPEC virtual string_type do_negative_sign() const;
|
williamr@2
|
519 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
520 |
};
|
williamr@2
|
521 |
|
williamr@2
|
522 |
_STLP_TEMPLATE_NULL
|
williamr@2
|
523 |
class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, false> : public moneypunct<wchar_t, false>
|
williamr@2
|
524 |
{
|
williamr@2
|
525 |
public:
|
williamr@2
|
526 |
typedef money_base::pattern pattern;
|
williamr@2
|
527 |
typedef wchar_t char_type;
|
williamr@2
|
528 |
typedef wstring string_type;
|
williamr@2
|
529 |
|
williamr@2
|
530 |
explicit _STLP_DECLSPEC moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0);
|
williamr@2
|
531 |
|
williamr@2
|
532 |
protected:
|
williamr@2
|
533 |
_Locale_monetary* _M_monetary;
|
williamr@2
|
534 |
_STLP_DECLSPEC ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
|
williamr@2
|
535 |
_STLP_DECLSPEC virtual wchar_t do_decimal_point() const;
|
williamr@2
|
536 |
_STLP_DECLSPEC virtual wchar_t do_thousands_sep() const;
|
williamr@2
|
537 |
_STLP_DECLSPEC virtual string do_grouping() const;
|
williamr@2
|
538 |
|
williamr@2
|
539 |
_STLP_DECLSPEC virtual string_type do_curr_symbol() const;
|
williamr@2
|
540 |
|
williamr@2
|
541 |
_STLP_DECLSPEC virtual string_type do_positive_sign() const;
|
williamr@2
|
542 |
_STLP_DECLSPEC virtual string_type do_negative_sign() const;
|
williamr@2
|
543 |
_STLP_DECLSPEC virtual int do_frac_digits() const;
|
williamr@2
|
544 |
};
|
williamr@2
|
545 |
# endif
|
williamr@2
|
546 |
|
williamr@2
|
547 |
//===== methods ======
|
williamr@2
|
548 |
|
williamr@2
|
549 |
|
williamr@2
|
550 |
// money_put facets
|
williamr@2
|
551 |
|
williamr@2
|
552 |
template <class _CharT, __DFL_TMPL_PARAM( _OutputIter , ostreambuf_iterator<_CharT>) >
|
williamr@2
|
553 |
class money_put : public locale::facet {
|
williamr@2
|
554 |
friend class _Locale;
|
williamr@2
|
555 |
|
williamr@2
|
556 |
public:
|
williamr@2
|
557 |
typedef _CharT char_type;
|
williamr@2
|
558 |
typedef _OutputIter iter_type;
|
williamr@2
|
559 |
typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
|
williamr@2
|
560 |
|
williamr@2
|
561 |
money_put(size_t __refs = 0) : _BaseFacet(__refs) {}
|
williamr@2
|
562 |
# ifndef _STLP_NO_LONG_DOUBLE
|
williamr@2
|
563 |
iter_type put(iter_type __s, bool __intl, ios_base& __str,
|
williamr@2
|
564 |
char_type __fill, long double __units) const
|
williamr@2
|
565 |
{ return do_put(__s, __intl, __str, __fill, __units); }
|
williamr@2
|
566 |
# endif
|
williamr@2
|
567 |
iter_type put(iter_type __s, bool __intl, ios_base& __str,
|
williamr@2
|
568 |
char_type __fill,
|
williamr@2
|
569 |
const string_type& __digits) const
|
williamr@2
|
570 |
{ return do_put(__s, __intl, __str, __fill, __digits); }
|
williamr@2
|
571 |
|
williamr@2
|
572 |
#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
|
williamr@2
|
573 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
|
williamr@2
|
574 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id&
|
williamr@2
|
575 |
GetFacetLocaleId(ostreambuf_iterator<wchar_t, char_traits<wchar_t> > *);
|
williamr@2
|
576 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id&
|
williamr@2
|
577 |
GetFacetLocaleId(wchar_t**);
|
williamr@2
|
578 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id&
|
williamr@2
|
579 |
GetFacetLocaleId(ostreambuf_iterator<char, char_traits<char> > *);
|
williamr@2
|
580 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(char**);
|
williamr@2
|
581 |
#else
|
williamr@2
|
582 |
_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
|
williamr@2
|
583 |
#endif
|
williamr@2
|
584 |
|
williamr@2
|
585 |
protected:
|
williamr@2
|
586 |
~money_put() {}
|
williamr@2
|
587 |
# ifndef _STLP_NO_LONG_DOUBLE
|
williamr@2
|
588 |
virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
|
williamr@2
|
589 |
char_type __fill, long double /* __units */ ) const {
|
williamr@2
|
590 |
|
williamr@2
|
591 |
locale __loc = __str.getloc();
|
williamr@2
|
592 |
_CharT __buf[64];
|
williamr@2
|
593 |
return do_put(__s, __intl, __str, __fill, __buf + 0);
|
williamr@2
|
594 |
}
|
williamr@2
|
595 |
# endif
|
williamr@2
|
596 |
virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
|
williamr@2
|
597 |
char_type __fill,
|
williamr@2
|
598 |
const string_type& __digits) const;
|
williamr@2
|
599 |
};
|
williamr@2
|
600 |
|
williamr@2
|
601 |
# if defined (_STLP_USE_TEMPLATE_EXPORT)
|
williamr@2
|
602 |
_STLP_EXPORT_TEMPLATE_CLASS money_get<char, istreambuf_iterator<char, char_traits<char> > >;
|
williamr@2
|
603 |
_STLP_EXPORT_TEMPLATE_CLASS money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
|
williamr@2
|
604 |
// _STLP_EXPORT_TEMPLATE_CLASS money_get<char, const char* >;
|
williamr@2
|
605 |
// _STLP_EXPORT_TEMPLATE_CLASS money_put<char, char* >;
|
williamr@2
|
606 |
# if ! defined (_STLP_NO_WCHAR_T)
|
williamr@2
|
607 |
_STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
|
williamr@2
|
608 |
_STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
|
williamr@2
|
609 |
// _STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, const wchar_t* >;
|
williamr@2
|
610 |
// _STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, wchar_t* >;
|
williamr@2
|
611 |
# endif
|
williamr@2
|
612 |
# endif /* _STLP_USE_TEMPLATE_EXPORT */
|
williamr@2
|
613 |
|
williamr@2
|
614 |
# if defined (__BORLANDC__) && defined (_RTLDLL)
|
williamr@2
|
615 |
inline void _Stl_loc_init_monetary() {
|
williamr@2
|
616 |
money_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 8;
|
williamr@2
|
617 |
money_get<char, const char*>::id._M_index = 9;
|
williamr@2
|
618 |
money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 10;
|
williamr@2
|
619 |
money_put<char, char*>::id._M_index = 11;
|
williamr@2
|
620 |
# ifndef _STLP_NO_WCHAR_T
|
williamr@2
|
621 |
money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 27;
|
williamr@2
|
622 |
money_get<wchar_t, const wchar_t*>::id._M_index = 28;
|
williamr@2
|
623 |
money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 29;
|
williamr@2
|
624 |
money_put<wchar_t, wchar_t*>::id._M_index = 30;
|
williamr@2
|
625 |
# endif
|
williamr@2
|
626 |
}
|
williamr@2
|
627 |
#endif
|
williamr@2
|
628 |
|
williamr@2
|
629 |
_STLP_END_NAMESPACE
|
williamr@2
|
630 |
|
williamr@2
|
631 |
# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
|
williamr@2
|
632 |
# include <stl/_monetary.c>
|
williamr@2
|
633 |
# endif
|
williamr@2
|
634 |
|
williamr@2
|
635 |
#endif /* _STLP_INTERNAL_MONETARY_H */
|
williamr@2
|
636 |
|
williamr@2
|
637 |
// Local Variables:
|
williamr@2
|
638 |
// mode:C++
|
williamr@2
|
639 |
// End:
|
williamr@2
|
640 |
|
williamr@2
|
641 |
|