1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/stlport/src/monetary.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,152 @@ 1.4 +/* 1.5 + * Copyright (c) 1999 1.6 + * Silicon Graphics Computer Systems, Inc. 1.7 + * 1.8 + * Copyright (c) 1999 1.9 + * Boris Fomitchev 1.10 + * 1.11 + * This material is provided "as is", with absolutely no warranty expressed 1.12 + * or implied. Any use is at your own risk. 1.13 + * 1.14 + * Permission to use or copy this software for any purpose is hereby granted 1.15 + * without fee, provided the above notices are retained on all copies. 1.16 + * Permission to modify the code and to distribute modified code is granted, 1.17 + * provided the above notices are retained, and a notice that the code was 1.18 + * modified is included with the above copyright notice. 1.19 + * 1.20 + */ 1.21 +#include "stlport_prefix.h" 1.22 + 1.23 +#include <locale> 1.24 +#include <istream> 1.25 + 1.26 +_STLP_BEGIN_NAMESPACE 1.27 + 1.28 +static void _Init_monetary_formats(money_base::pattern& pos_format, 1.29 + money_base::pattern& neg_format) { 1.30 + pos_format.field[0] = (char) money_base::symbol; 1.31 + pos_format.field[1] = (char) money_base::sign; 1.32 + pos_format.field[2] = (char) money_base::none; 1.33 + pos_format.field[3] = (char) money_base::value; 1.34 + 1.35 + neg_format.field[0] = (char) money_base::symbol; 1.36 + neg_format.field[1] = (char) money_base::sign; 1.37 + neg_format.field[2] = (char) money_base::none; 1.38 + neg_format.field[3] = (char) money_base::value; 1.39 +} 1.40 + 1.41 +// This is being used throughout the library 1.42 +static const char _S_empty_string[] = ""; 1.43 +#ifndef _STLP_NO_WCHAR_T 1.44 +static const wchar_t _S_empty_wstring[] = L""; 1.45 +#endif 1.46 + 1.47 +// 1.48 +// moneypunct<> 1.49 +// 1.50 + 1.51 +moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs) 1.52 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 1.53 +moneypunct<char, true>::~moneypunct() {} 1.54 + 1.55 +char moneypunct<char, true>::do_decimal_point() const {return ' ';} 1.56 +char moneypunct<char, true>::do_thousands_sep() const {return ' ';} 1.57 +string moneypunct<char, true>::do_grouping() const { return _S_empty_string; } 1.58 +string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; } 1.59 +string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; } 1.60 +string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; } 1.61 +money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;} 1.62 +money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;} 1.63 +int moneypunct<char, true>::do_frac_digits() const {return 0;} 1.64 + 1.65 +moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs) 1.66 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 1.67 +moneypunct<char, false>::~moneypunct() {} 1.68 + 1.69 +char moneypunct<char, false>::do_decimal_point() const {return ' ';} 1.70 +char moneypunct<char, false>::do_thousands_sep() const {return ' ';} 1.71 + 1.72 +string moneypunct<char, false>::do_grouping() const { return _S_empty_string; } 1.73 +string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; } 1.74 +string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; } 1.75 +string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; } 1.76 +money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;} 1.77 +money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;} 1.78 +int moneypunct<char, false>::do_frac_digits() const {return 0;} 1.79 + 1.80 +#ifndef _STLP_NO_WCHAR_T 1.81 +moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs) 1.82 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 1.83 +moneypunct<wchar_t, true>::~moneypunct() {} 1.84 + 1.85 +wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';} 1.86 +wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';} 1.87 +string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;} 1.88 + 1.89 +wstring moneypunct<wchar_t, true>::do_curr_symbol() const 1.90 +{return _S_empty_wstring;} 1.91 +wstring moneypunct<wchar_t, true>::do_positive_sign() const 1.92 +{return _S_empty_wstring;} 1.93 +wstring moneypunct<wchar_t, true>::do_negative_sign() const 1.94 +{return _S_empty_wstring;} 1.95 +int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;} 1.96 +money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const 1.97 +{return _M_pos_format;} 1.98 +money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const 1.99 +{return _M_neg_format;} 1.100 + 1.101 +moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs) 1.102 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 1.103 +moneypunct<wchar_t, false>::~moneypunct() {} 1.104 + 1.105 +wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';} 1.106 +wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';} 1.107 +string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;} 1.108 +wstring moneypunct<wchar_t, false>::do_curr_symbol() const 1.109 +{return _S_empty_wstring;} 1.110 +wstring moneypunct<wchar_t, false>::do_positive_sign() const 1.111 +{return _S_empty_wstring;} 1.112 +wstring moneypunct<wchar_t, false>::do_negative_sign() const 1.113 +{return _S_empty_wstring;} 1.114 +int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;} 1.115 + 1.116 +money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const 1.117 +{return _M_pos_format;} 1.118 +money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const 1.119 +{return _M_neg_format;} 1.120 + 1.121 +#endif /* WCHAR_T */ 1.122 + 1.123 +// 1.124 +// Instantiations 1.125 +// 1.126 + 1.127 +#if !defined (_STLP_NO_FORCE_INSTANTIATE) 1.128 + 1.129 +template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >; 1.130 +template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >; 1.131 +// template class money_put<char, char*>; 1.132 + 1.133 +# ifndef _STLP_NO_WCHAR_T 1.134 +template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >; 1.135 +template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >; 1.136 +// template class money_put<wchar_t, wchar_t*>; 1.137 +// template class money_get<wchar_t, const wchar_t*>; 1.138 +# endif 1.139 + 1.140 +#endif 1.141 + 1.142 +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) 1.143 +const bool moneypunct<char, true>::intl; 1.144 +const bool moneypunct<char, false>::intl; 1.145 +# ifndef _STLP_NO_WCHAR_T 1.146 +const bool moneypunct<wchar_t, true>::intl; 1.147 +const bool moneypunct<wchar_t, false>::intl; 1.148 +# endif 1.149 +#endif 1.150 + 1.151 +_STLP_END_NAMESPACE 1.152 + 1.153 +// Local Variables: 1.154 +// mode:C++ 1.155 +// End: