|
1 /* |
|
2 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
|
3 * |
|
4 * Copyright (c) 1999 |
|
5 * Silicon Graphics Computer Systems, Inc. |
|
6 * |
|
7 * Copyright (c) 1999 |
|
8 * Boris Fomitchev |
|
9 * |
|
10 * This material is provided "as is", with absolutely no warranty expressed |
|
11 * or implied. Any use is at your own risk. |
|
12 * |
|
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. |
|
18 * |
|
19 */ |
|
20 #include "stlport_prefix.h" |
|
21 |
|
22 #include <locale> |
|
23 #include <istream> |
|
24 |
|
25 #if defined(__SYMBIAN32__WSD__) |
|
26 #include "libstdcppwsd.h" |
|
27 |
|
28 void monetary_empty_string_init() |
|
29 { |
|
30 get_monetary_S_empty_string().copy("", 1); |
|
31 # ifndef _STLP_NO_WCHAR_T |
|
32 get_monetary_S_empty_wstring().copy(L"", 1); |
|
33 # endif //_STLP_NO_WCHAR_T |
|
34 } |
|
35 #define _S_empty_string get_monetary_S_empty_string() |
|
36 #define _S_empty_wstring get_monetary_S_empty_wstring() |
|
37 |
|
38 #endif |
|
39 |
|
40 _STLP_BEGIN_NAMESPACE |
|
41 |
|
42 static void _Init_monetary_formats(money_base::pattern& pos_format, |
|
43 money_base::pattern& neg_format) { |
|
44 pos_format.field[0] = (char) money_base::symbol; |
|
45 pos_format.field[1] = (char) money_base::sign; |
|
46 pos_format.field[2] = (char) money_base::none; |
|
47 pos_format.field[3] = (char) money_base::value; |
|
48 |
|
49 neg_format.field[0] = (char) money_base::symbol; |
|
50 neg_format.field[1] = (char) money_base::sign; |
|
51 neg_format.field[2] = (char) money_base::none; |
|
52 neg_format.field[3] = (char) money_base::value; |
|
53 } |
|
54 |
|
55 // This is being used throughout the library |
|
56 #if !defined(__SYMBIAN32__WSD__) |
|
57 static const string _S_empty_string; |
|
58 #ifndef _STLP_NO_WCHAR_T |
|
59 static const wstring _S_empty_wstring; |
|
60 #endif |
|
61 #endif //__SYMBIAN32__WSD__ |
|
62 // |
|
63 // moneypunct<> |
|
64 // |
|
65 |
|
66 _STLP_DECLSPEC moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs) |
|
67 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } |
|
68 _STLP_DECLSPEC moneypunct<char, true>::~moneypunct() {} |
|
69 |
|
70 _STLP_DECLSPEC char moneypunct<char, true>::do_decimal_point() const {return ' ';} |
|
71 _STLP_DECLSPEC char moneypunct<char, true>::do_thousands_sep() const {return ' ';} |
|
72 _STLP_DECLSPEC string moneypunct<char, true>::do_grouping() const { return _S_empty_string; } |
|
73 _STLP_DECLSPEC string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; } |
|
74 _STLP_DECLSPEC string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; } |
|
75 _STLP_DECLSPEC string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; } |
|
76 _STLP_DECLSPEC money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;} |
|
77 _STLP_DECLSPEC money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;} |
|
78 _STLP_DECLSPEC int moneypunct<char, true>::do_frac_digits() const {return 0;} |
|
79 |
|
80 _STLP_DECLSPEC moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs) |
|
81 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } |
|
82 _STLP_DECLSPEC moneypunct<char, false>::~moneypunct() {} |
|
83 |
|
84 _STLP_DECLSPEC char moneypunct<char, false>::do_decimal_point() const {return ' ';} |
|
85 _STLP_DECLSPEC char moneypunct<char, false>::do_thousands_sep() const {return ' ';} |
|
86 |
|
87 _STLP_DECLSPEC string moneypunct<char, false>::do_grouping() const { return _S_empty_string; } |
|
88 _STLP_DECLSPEC string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; } |
|
89 _STLP_DECLSPEC string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; } |
|
90 _STLP_DECLSPEC string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; } |
|
91 _STLP_DECLSPEC money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;} |
|
92 _STLP_DECLSPEC money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;} |
|
93 _STLP_DECLSPEC int moneypunct<char, false>::do_frac_digits() const {return 0;} |
|
94 |
|
95 #ifndef _STLP_NO_WCHAR_T |
|
96 _STLP_DECLSPEC moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs) |
|
97 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } |
|
98 _STLP_DECLSPEC moneypunct<wchar_t, true>::~moneypunct() {} |
|
99 |
|
100 _STLP_DECLSPEC wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';} |
|
101 _STLP_DECLSPEC wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';} |
|
102 _STLP_DECLSPEC string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;} |
|
103 |
|
104 _STLP_DECLSPEC wstring moneypunct<wchar_t, true>::do_curr_symbol() const |
|
105 {return _S_empty_wstring;} |
|
106 _STLP_DECLSPEC wstring moneypunct<wchar_t, true>::do_positive_sign() const |
|
107 {return _S_empty_wstring;} |
|
108 _STLP_DECLSPEC wstring moneypunct<wchar_t, true>::do_negative_sign() const |
|
109 {return _S_empty_wstring;} |
|
110 _STLP_DECLSPEC int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;} |
|
111 _STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const |
|
112 {return _M_pos_format;} |
|
113 _STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const |
|
114 {return _M_neg_format;} |
|
115 |
|
116 _STLP_DECLSPEC moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs) |
|
117 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } |
|
118 _STLP_DECLSPEC moneypunct<wchar_t, false>::~moneypunct() {} |
|
119 |
|
120 _STLP_DECLSPEC wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';} |
|
121 _STLP_DECLSPEC wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';} |
|
122 _STLP_DECLSPEC string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;} |
|
123 _STLP_DECLSPEC wstring moneypunct<wchar_t, false>::do_curr_symbol() const |
|
124 {return _S_empty_wstring;} |
|
125 _STLP_DECLSPEC wstring moneypunct<wchar_t, false>::do_positive_sign() const |
|
126 {return _S_empty_wstring;} |
|
127 _STLP_DECLSPEC wstring moneypunct<wchar_t, false>::do_negative_sign() const |
|
128 {return _S_empty_wstring;} |
|
129 _STLP_DECLSPEC int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;} |
|
130 |
|
131 _STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const |
|
132 {return _M_pos_format;} |
|
133 _STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const |
|
134 {return _M_neg_format;} |
|
135 |
|
136 #endif /* WCHAR_T */ |
|
137 |
|
138 #if defined (__SYMBIAN32__WSD__) |
|
139 template <> |
|
140 _STLP_DECLSPEC locale::id& money_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId() |
|
141 { |
|
142 return get_libcpp_wsd().money_get_char_istreambuf_iterator_id; |
|
143 } |
|
144 template <> |
|
145 _STLP_DECLSPEC locale::id& money_put<char, ostreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId() |
|
146 { |
|
147 return get_libcpp_wsd().money_put_char_ostreambuf_iterator_id; |
|
148 } |
|
149 # ifndef _STLP_NO_WCHAR_T |
|
150 template <> |
|
151 _STLP_DECLSPEC locale::id& money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId() |
|
152 { |
|
153 return get_libcpp_wsd().money_get_wchar_istreambuf_iterator_id; |
|
154 } |
|
155 template <> |
|
156 _STLP_DECLSPEC locale::id& money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId() |
|
157 { |
|
158 return get_libcpp_wsd().money_put_wchar_ostreambuf_iterator_id; |
|
159 } |
|
160 # endif /* _STLP_NO_WCHAR_T */ |
|
161 #endif /* __SYMBIAN32__WSD__ */ |
|
162 |
|
163 // |
|
164 // Instantiations |
|
165 // |
|
166 |
|
167 #if !defined(_STLP_NO_FORCE_INSTANTIATE) |
|
168 |
|
169 template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >; |
|
170 template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >; |
|
171 // template class money_put<char, char*>; |
|
172 |
|
173 # ifndef _STLP_NO_WCHAR_T |
|
174 template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >; |
|
175 template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >; |
|
176 // template class money_put<wchar_t, wchar_t*>; |
|
177 // template class money_get<wchar_t, const wchar_t*>; |
|
178 # endif |
|
179 |
|
180 #endif |
|
181 |
|
182 #if defined (__EPOC32__) |
|
183 template <> |
|
184 locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id={8}; |
|
185 |
|
186 template <> |
|
187 locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id={10}; |
|
188 template <> |
|
189 locale::id money_put<char, char*>::id; |
|
190 |
|
191 # if !defined (_STLP_NO_WCHAR_T) |
|
192 template <> |
|
193 locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id={27}; |
|
194 template <> |
|
195 locale::id money_get<wchar_t, const wchar_t*>::id; |
|
196 |
|
197 template <> |
|
198 locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id={29}; |
|
199 # endif |
|
200 #endif // __EPOC32__ |
|
201 |
|
202 |
|
203 _STLP_END_NAMESPACE |
|
204 |
|
205 // Local Variables: |
|
206 // mode:C++ |
|
207 // End: |