ReactOS  0.4.14-dev-297-g23e575c
_monetary.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999
3  * Silicon Graphics Computer Systems, Inc.
4  *
5  * Copyright (c) 1999
6  * Boris Fomitchev
7  *
8  * This material is provided "as is", with absolutely no warranty expressed
9  * or implied. Any use is at your own risk.
10  *
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.
16  *
17  */
18 // WARNING: This is an internal header file, included by other C++
19 // standard library headers. You should not attempt to use this header
20 // file directly.
21 
22 
23 #ifndef _STLP_INTERNAL_MONETARY_H
24 #define _STLP_INTERNAL_MONETARY_H
25 
26 #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
28 #endif
29 
30 #ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
32 #endif
33 
34 #ifndef _STLP_FACETS_FWD_H
35 # include <stl/_facets_fwd.h>
36 #endif
37 
39 
40 class money_base {
41 public:
43  struct pattern {
44  char field[4];
45  };
46 };
47 
48 // moneypunct facets: forward declaration
49 template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
50 
51 // money_get facets
52 
53 template <class _CharT, class _InputIter>
54 class money_get : public locale::facet {
55 public:
56  typedef _CharT char_type;
57  typedef _InputIter iter_type;
59 
60  explicit money_get(size_t __refs = 0) : locale::facet(__refs) {}
61  iter_type get(iter_type __s, iter_type __end, bool __intl,
62  ios_base& __str, ios_base::iostate& __err,
63  _STLP_LONGEST_FLOAT_TYPE& __units) const
64  { return do_get(__s, __end, __intl, __str, __err, __units); }
65  iter_type get(iter_type __s, iter_type __end, bool __intl,
66  ios_base& __str, ios_base::iostate& __err,
67  string_type& __digits) const
68  { return do_get(__s, __end, __intl, __str, __err, __digits); }
69 
70  static locale::id id;
71 
72 protected:
74  virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
75  ios_base& __str, ios_base::iostate& __err,
76  _STLP_LONGEST_FLOAT_TYPE& __units) const;
77  virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
78  ios_base& __str, ios_base::iostate& __err,
79  string_type& __digits) const;
80 };
81 
82 
83 // moneypunct facets: definition of specializations
84 
87 public:
88  typedef char char_type;
89  typedef string string_type;
90  explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
91 
92  char decimal_point() const { return do_decimal_point(); }
93  char thousands_sep() const { return do_thousands_sep(); }
94  string grouping() const { return do_grouping(); }
95  string_type curr_symbol() const { return do_curr_symbol(); }
96  string_type positive_sign() const { return do_positive_sign(); }
97  string_type negative_sign() const { return do_negative_sign(); }
98  int frac_digits() const { return do_frac_digits(); }
99  pattern pos_format() const { return do_pos_format(); }
100  pattern neg_format() const { return do_neg_format(); }
101 
103  _STLP_STATIC_CONSTANT(bool, intl = true);
104 
105 protected:
108 
109  ~moneypunct _STLP_PSPEC2(char, true) ();
110 
111  virtual char do_decimal_point() const;
112  virtual char do_thousands_sep() const;
113  virtual string do_grouping() const;
114 
115  virtual string do_curr_symbol() const;
116 
117  virtual string do_positive_sign() const;
118  virtual string do_negative_sign() const;
119  virtual int do_frac_digits() const;
120  virtual pattern do_pos_format() const;
121  virtual pattern do_neg_format() const;
122 };
123 
126 public:
127  typedef char char_type;
128  typedef string string_type;
129 
130  explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
131 
132  char decimal_point() const { return do_decimal_point(); }
133  char thousands_sep() const { return do_thousands_sep(); }
134  string grouping() const { return do_grouping(); }
135  string_type curr_symbol() const { return do_curr_symbol(); }
136  string_type positive_sign() const { return do_positive_sign(); }
137  string_type negative_sign() const { return do_negative_sign(); }
138  int frac_digits() const { return do_frac_digits(); }
139  pattern pos_format() const { return do_pos_format(); }
140  pattern neg_format() const { return do_neg_format(); }
141 
143  _STLP_STATIC_CONSTANT(bool, intl = false);
144 
145 protected:
148 
149  ~moneypunct _STLP_PSPEC2(char, false) ();
150 
151  virtual char do_decimal_point() const;
152  virtual char do_thousands_sep() const;
153  virtual string do_grouping() const;
154 
155  virtual string do_curr_symbol() const;
156 
157  virtual string do_positive_sign() const;
158  virtual string do_negative_sign() const;
159  virtual int do_frac_digits() const;
160  virtual pattern do_pos_format() const;
161  virtual pattern do_neg_format() const;
162 };
163 
164 
165 #ifndef _STLP_NO_WCHAR_T
166 
169 public:
170  typedef wchar_t char_type;
171  typedef wstring string_type;
172  explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
173  wchar_t decimal_point() const { return do_decimal_point(); }
174  wchar_t thousands_sep() const { return do_thousands_sep(); }
175  string grouping() const { return do_grouping(); }
176  string_type curr_symbol() const { return do_curr_symbol(); }
177  string_type positive_sign() const { return do_positive_sign(); }
178  string_type negative_sign() const { return do_negative_sign(); }
179  int frac_digits() const { return do_frac_digits(); }
180  pattern pos_format() const { return do_pos_format(); }
181  pattern neg_format() const { return do_neg_format(); }
182 
184  _STLP_STATIC_CONSTANT(bool, intl = true);
185 
186 protected:
189 
190  ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
191 
192  virtual wchar_t do_decimal_point() const;
193  virtual wchar_t do_thousands_sep() const;
194  virtual string do_grouping() const;
195 
196  virtual string_type do_curr_symbol() const;
197 
198  virtual string_type do_positive_sign() const;
199  virtual string_type do_negative_sign() const;
200  virtual int do_frac_digits() const;
201  virtual pattern do_pos_format() const;
202  virtual pattern do_neg_format() const;
203 };
204 
205 
208 public:
209  typedef wchar_t char_type;
210  typedef wstring string_type;
211  explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
212  wchar_t decimal_point() const { return do_decimal_point(); }
213  wchar_t thousands_sep() const { return do_thousands_sep(); }
214  string grouping() const { return do_grouping(); }
215  string_type curr_symbol() const { return do_curr_symbol(); }
216  string_type positive_sign() const { return do_positive_sign(); }
217  string_type negative_sign() const { return do_negative_sign(); }
218  int frac_digits() const { return do_frac_digits(); }
219  pattern pos_format() const { return do_pos_format(); }
220  pattern neg_format() const { return do_neg_format(); }
221 
223  _STLP_STATIC_CONSTANT(bool, intl = false);
224 
225 protected:
228 
229  ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
230 
231  virtual wchar_t do_decimal_point() const;
232  virtual wchar_t do_thousands_sep() const;
233  virtual string do_grouping() const;
234 
235  virtual string_type do_curr_symbol() const;
236 
237  virtual string_type do_positive_sign() const;
238  virtual string_type do_negative_sign() const;
239  virtual int do_frac_digits() const;
240  virtual pattern do_pos_format() const;
241  virtual pattern do_neg_format() const;
242 };
243 
244 # endif
245 
246 template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
247 
250  friend class _Locale_impl;
251 public:
253  typedef char char_type;
254  typedef string string_type;
255 
256  explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0);
257 
258 protected:
259  ~moneypunct_byname _STLP_PSPEC2(char, true) ();
260  virtual char do_decimal_point() const;
261  virtual char do_thousands_sep() const;
262  virtual string do_grouping() const;
263 
264  virtual string_type do_curr_symbol() const;
265 
266  virtual string_type do_positive_sign() const;
267  virtual string_type do_negative_sign() const;
268  virtual int do_frac_digits() const;
269 
270 private:
271  moneypunct_byname _STLP_PSPEC2(char, true) (_Locale_monetary *__monetary);
272 
274  //explicitely defined as private to avoid warnings:
275  moneypunct_byname(_Self const&);
276  _Self& operator = (_Self const&);
277 
279 };
280 
283  friend class _Locale_impl;
284 public:
286  typedef char char_type;
287  typedef string string_type;
288 
289  explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0);
290 
291 protected:
292  ~moneypunct_byname _STLP_PSPEC2(char, false) ();
293  virtual char do_decimal_point() const;
294  virtual char do_thousands_sep() const;
295  virtual string do_grouping() const;
296 
297  virtual string_type do_curr_symbol() const;
298 
299  virtual string_type do_positive_sign() const;
300  virtual string_type do_negative_sign() const;
301  virtual int do_frac_digits() const;
302 
303 private:
304  moneypunct_byname _STLP_PSPEC2(char, false) (_Locale_monetary *__monetary);
305 
307  //explicitely defined as private to avoid warnings:
308  moneypunct_byname(_Self const&);
309  _Self& operator = (_Self const&);
310 
312 };
313 
314 #if !defined (_STLP_NO_WCHAR_T)
317  friend class _Locale_impl;
318 public:
320  typedef wchar_t char_type;
321  typedef wstring string_type;
322 
323  explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0);
324 
325 protected:
326  ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
327  virtual wchar_t do_decimal_point() const;
328  virtual wchar_t do_thousands_sep() const;
329  virtual string do_grouping() const;
330 
331  virtual string_type do_curr_symbol() const;
332 
333  virtual string_type do_positive_sign() const;
334  virtual string_type do_negative_sign() const;
335  virtual int do_frac_digits() const;
336 
337 private:
338  moneypunct_byname _STLP_PSPEC2(wchar_t, true) (_Locale_monetary *__monetary);
339 
341  //explicitely defined as private to avoid warnings:
342  moneypunct_byname(_Self const&);
343  _Self& operator = (_Self const&);
344 
346 };
347 
350  friend class _Locale_impl;
351 public:
353  typedef wchar_t char_type;
354  typedef wstring string_type;
355 
356  explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0);
357 
358 protected:
359  ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
360  virtual wchar_t do_decimal_point() const;
361  virtual wchar_t do_thousands_sep() const;
362  virtual string do_grouping() const;
363 
364  virtual string_type do_curr_symbol() const;
365 
366  virtual string_type do_positive_sign() const;
367  virtual string_type do_negative_sign() const;
368  virtual int do_frac_digits() const;
369 
370 private:
371  moneypunct_byname _STLP_PSPEC2(wchar_t, false) (_Locale_monetary *__monetary);
372 
374  //explicitely defined as private to avoid warnings:
375  moneypunct_byname(_Self const&);
376  _Self& operator = (_Self const&);
377 
379 };
380 #endif
381 
382 //===== methods ======
383 
384 
385 // money_put facets
386 
387 template <class _CharT, class _OutputIter>
388 class money_put : public locale::facet {
389 public:
390  typedef _CharT char_type;
391  typedef _OutputIter iter_type;
393 
394  explicit money_put(size_t __refs = 0) : locale::facet(__refs) {}
395  iter_type put(iter_type __s, bool __intl, ios_base& __str,
397  { return do_put(__s, __intl, __str, __fill, __units); }
398  iter_type put(iter_type __s, bool __intl, ios_base& __str,
400  const string_type& __digits) const
401  { return do_put(__s, __intl, __str, __fill, __digits); }
402 
403  static locale::id id;
404 
405 protected:
407  virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
408  char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const;
409  virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
411  const string_type& __digits) const;
412 };
413 
414 #if defined (_STLP_USE_TEMPLATE_EXPORT)
417 # if ! defined (_STLP_NO_WCHAR_T)
420 # endif
421 #endif
422 
424 
425 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
426 # include <stl/_monetary.c>
427 #endif
428 
429 #endif /* _STLP_INTERNAL_MONETARY_H */
430 
431 // Local Variables:
432 // mode:C++
433 // End:
434 
435 
string_type positive_sign() const
Definition: _monetary.h:216
_Locale_monetary * _M_monetary
Definition: _monetary.h:345
#define true
Definition: stdbool.h:37
int frac_digits() const
Definition: _monetary.h:98
wchar_t decimal_point() const
Definition: _monetary.h:212
money_get(size_t __refs=0)
Definition: _monetary.h:60
iter_type put(iter_type __s, bool __intl, ios_base &__str, char_type __fill, const string_type &__digits) const
Definition: _monetary.h:398
string_type negative_sign() const
Definition: _monetary.h:217
static _STLP_STATIC_DECLSPEC locale::id id
Definition: _monetary.h:142
string_type positive_sign() const
Definition: _monetary.h:136
pattern neg_format() const
Definition: _monetary.h:140
char decimal_point() const
Definition: _monetary.h:132
char decimal_point() const
Definition: _monetary.h:92
string_type positive_sign() const
Definition: _monetary.h:177
moneypunct_byname< char, false > _Self
Definition: _monetary.h:306
moneypunct_byname< wchar_t, false > _Self
Definition: _monetary.h:373
char thousands_sep() const
Definition: _monetary.h:93
_Locale_monetary * _M_monetary
Definition: _monetary.h:278
void operator=(const _Locale_impl &)
wchar_t thousands_sep() const
Definition: _monetary.h:213
_STLP_STATIC_CONSTANT(category, none=0x000)
#define _STLP_LONGEST_FLOAT_TYPE
Definition: features.h:213
static _STLP_STATIC_DECLSPEC locale::id id
Definition: _monetary.h:222
static locale::id id
Definition: _monetary.h:403
string_type negative_sign() const
Definition: _monetary.h:137
~money_put()
Definition: _monetary.h:406
_Locale_monetary * _M_monetary
Definition: _monetary.h:378
money_put(size_t __refs=0)
Definition: _monetary.h:394
#define _STLP_PSPEC2(t1, t2)
Definition: features.h:1027
pattern neg_format() const
Definition: _monetary.h:100
money_base::pattern pattern
Definition: _monetary.h:319
iter_type get(iter_type __s, iter_type __end, bool __intl, ios_base &__str, ios_base::iostate &__err, string_type &__digits) const
Definition: _monetary.h:65
pattern pos_format() const
Definition: _monetary.h:139
Definition: _locale.h:75
static _STLP_STATIC_DECLSPEC locale::id id
Definition: _monetary.h:102
string_type negative_sign() const
Definition: _monetary.h:97
unsigned char
Definition: typeof.h:29
wchar_t decimal_point() const
Definition: _monetary.h:173
_InputIter iter_type
Definition: _monetary.h:57
unsigned short wchar_t
Definition: crtdefs.h:324
string_type negative_sign() const
Definition: _monetary.h:178
_CharT char_type
Definition: _monetary.h:390
basic_string< _CharT, char_traits< _CharT >, allocator< _CharT > > string_type
Definition: _monetary.h:392
basic_string< _CharT, char_traits< _CharT >, allocator< _CharT > > string_type
Definition: _monetary.h:58
string_type curr_symbol() const
Definition: _monetary.h:95
_CharT char_type
Definition: _monetary.h:56
pattern pos_format() const
Definition: _monetary.h:180
string grouping() const
Definition: _monetary.h:134
virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, ios_base &__str, ios_base::iostate &__err, _STLP_LONGEST_FLOAT_TYPE &__units) const
Definition: _monetary.c:279
string_type curr_symbol() const
Definition: _monetary.h:135
Definition: parser.c:43
string_type positive_sign() const
Definition: _monetary.h:96
money_base::pattern pattern
Definition: _monetary.h:252
#define _STLP_EXPORT_TEMPLATE_CLASS
Definition: features.h:987
string grouping() const
Definition: _monetary.h:94
pattern pos_format() const
Definition: _monetary.h:99
int iostate
Definition: _ios_base.h:58
facet(size_t __init_count=0)
Definition: _locale.h:84
string_type curr_symbol() const
Definition: _monetary.h:176
moneypunct_byname< char, true > _Self
Definition: _monetary.h:273
iter_type put(iter_type __s, bool __intl, ios_base &__str, char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
Definition: _monetary.h:395
string grouping() const
Definition: _monetary.h:175
moneypunct_byname< wchar_t, true > _Self
Definition: _monetary.h:340
#define false
Definition: stdbool.h:38
#define _STLP_CLASS_DECLSPEC
Definition: features.h:983
pattern pos_format() const
Definition: _monetary.h:219
money_base::pattern pattern
Definition: _monetary.h:285
#define _STLP_TEMPLATE_NULL
Definition: features.h:652
_Locale_monetary * _M_monetary
Definition: _monetary.h:311
wchar_t thousands_sep() const
Definition: _monetary.h:174
~money_get()
Definition: _monetary.h:73
pattern neg_format() const
Definition: _monetary.h:220
char thousands_sep() const
Definition: _monetary.h:133
_OutputIter iter_type
Definition: _monetary.h:391
iter_type get(iter_type __s, iter_type __end, bool __intl, ios_base &__str, ios_base::iostate &__err, _STLP_LONGEST_FLOAT_TYPE &__units) const
Definition: _monetary.h:61
#define _STLP_END_NAMESPACE
Definition: features.h:503
static _STLP_STATIC_DECLSPEC locale::id id
Definition: _monetary.h:183
void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val, const input_iterator_tag &, _Distance *)
Definition: _algobase.h:417
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_STATIC_DECLSPEC
Definition: features.h:992
static locale::id id
Definition: _monetary.h:70
virtual iter_type do_put(iter_type __s, bool __intl, ios_base &__str, char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
Definition: _monetary.c:506
pattern neg_format() const
Definition: _monetary.h:181
string_type curr_symbol() const
Definition: _monetary.h:215