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
#include "stlport_prefix.h"
19
20
#include <locale>
21
#include <istream>
22
23
_STLP_BEGIN_NAMESPACE
24
25
static void _Init_monetary_formats(money_base::pattern& pos_format,
26
                                   money_base::pattern& neg_format) {
27
  pos_format.field[0] = (char) money_base::symbol;
28
  pos_format.field[1] = (char) money_base::sign;
29
  pos_format.field[2] = (char) money_base::none;
30
  pos_format.field[3] = (char) money_base::value;
31
32
  neg_format.field[0] = (char) money_base::symbol;
33
  neg_format.field[1] = (char) money_base::sign;
34
  neg_format.field[2] = (char) money_base::none;
35
  neg_format.field[3] = (char) money_base::value;
36
}
37
38
// This is being used throughout the library
39
static const string _S_empty_string;
40
#ifndef _STLP_NO_WCHAR_T
41
static const wstring _S_empty_wstring;
42
#endif
43
44
//
45
// moneypunct<>
46
//
47
48
moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs)
49
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
50
moneypunct<char, true>::~moneypunct() {}
51
52
char moneypunct<char, true>::do_decimal_point() const {return ' ';}
53
char moneypunct<char, true>::do_thousands_sep() const {return ' ';}
54
string moneypunct<char, true>::do_grouping() const { return _S_empty_string; }
55
string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; }
56
string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; }
57
string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; }
58
money_base::pattern moneypunct<char, true>::do_pos_format() const  {return _M_pos_format;}
59
money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;}
60
int moneypunct<char, true>::do_frac_digits() const {return 0;}
61
62
moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs)
63
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
64
moneypunct<char, false>::~moneypunct() {}
65
66
char moneypunct<char, false>::do_decimal_point() const {return ' ';}
67
char moneypunct<char, false>::do_thousands_sep() const {return ' ';}
68
69
string moneypunct<char, false>::do_grouping() const { return _S_empty_string; }
70
string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; }
71
string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; }
72
string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; }
73
money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;}
74
money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;}
75
int moneypunct<char, false>::do_frac_digits() const {return 0;}
76
77
#ifndef _STLP_NO_WCHAR_T
78
moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs)
79
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
80
moneypunct<wchar_t, true>::~moneypunct() {}
81
82
wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';}
83
wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';}
84
string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;}
85
86
wstring moneypunct<wchar_t, true>::do_curr_symbol() const
87
{return _S_empty_wstring;}
88
wstring moneypunct<wchar_t, true>::do_positive_sign() const
89
{return _S_empty_wstring;}
90
wstring moneypunct<wchar_t, true>::do_negative_sign() const
91
{return _S_empty_wstring;}
92
int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;}
93
money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const
94
{return _M_pos_format;}
95
money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const
96
{return _M_neg_format;}
97
98
moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs)
99
{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
100
moneypunct<wchar_t, false>::~moneypunct() {}
101
102
wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';}
103
wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';}
104
string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;}
105
wstring moneypunct<wchar_t, false>::do_curr_symbol() const
106
{return _S_empty_wstring;}
107
wstring moneypunct<wchar_t, false>::do_positive_sign() const
108
{return _S_empty_wstring;}
109
wstring moneypunct<wchar_t, false>::do_negative_sign() const
110
{return _S_empty_wstring;}
111
int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;}
112
113
money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const
114
{return _M_pos_format;}
115
money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const
116
{return _M_neg_format;}
117
118
#endif /* WCHAR_T */
119
120
//
121
// Instantiations
122
//
123
124
#if !defined (_STLP_NO_FORCE_INSTANTIATE)
125
126
template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >;
127
template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
128
// template class money_put<char, char*>;
129
130
#  ifndef _STLP_NO_WCHAR_T
131
template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
132
template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
133
// template class money_put<wchar_t, wchar_t*>;
134
// template class money_get<wchar_t, const wchar_t*>;
135
#  endif
136
137
#endif
138
139
#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
140
const bool moneypunct<char, true>::intl;
141
const bool moneypunct<char, false>::intl;
142
#  ifndef _STLP_NO_WCHAR_T
143
const bool moneypunct<wchar_t, true>::intl;
144
const bool moneypunct<wchar_t, false>::intl;
145
#  endif
146
#endif
147
148
_STLP_END_NAMESPACE
149
150
// Local Variables:
151
// mode:C++
152
// End: