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 25static 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 39static const char _S_empty_string[] = ""; 40#ifndef _STLP_NO_WCHAR_T 41static const wchar_t _S_empty_wstring[] = L""; 42#endif 43 44// 45// moneypunct<> 46// 47 48moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs) 49{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 50moneypunct<char, true>::~moneypunct() {} 51 52char moneypunct<char, true>::do_decimal_point() const {return ' ';} 53char moneypunct<char, true>::do_thousands_sep() const {return ' ';} 54string moneypunct<char, true>::do_grouping() const { return _S_empty_string; } 55string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; } 56string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; } 57string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; } 58money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;} 59money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;} 60int moneypunct<char, true>::do_frac_digits() const {return 0;} 61 62moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs) 63{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 64moneypunct<char, false>::~moneypunct() {} 65 66char moneypunct<char, false>::do_decimal_point() const {return ' ';} 67char moneypunct<char, false>::do_thousands_sep() const {return ' ';} 68 69string moneypunct<char, false>::do_grouping() const { return _S_empty_string; } 70string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; } 71string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; } 72string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; } 73money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;} 74money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;} 75int moneypunct<char, false>::do_frac_digits() const {return 0;} 76 77#ifndef _STLP_NO_WCHAR_T 78moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs) 79{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 80moneypunct<wchar_t, true>::~moneypunct() {} 81 82wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';} 83wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';} 84string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;} 85 86wstring moneypunct<wchar_t, true>::do_curr_symbol() const 87{return _S_empty_wstring;} 88wstring moneypunct<wchar_t, true>::do_positive_sign() const 89{return _S_empty_wstring;} 90wstring moneypunct<wchar_t, true>::do_negative_sign() const 91{return _S_empty_wstring;} 92int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;} 93money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const 94{return _M_pos_format;} 95money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const 96{return _M_neg_format;} 97 98moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs) 99{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } 100moneypunct<wchar_t, false>::~moneypunct() {} 101 102wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';} 103wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';} 104string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;} 105wstring moneypunct<wchar_t, false>::do_curr_symbol() const 106{return _S_empty_wstring;} 107wstring moneypunct<wchar_t, false>::do_positive_sign() const 108{return _S_empty_wstring;} 109wstring moneypunct<wchar_t, false>::do_negative_sign() const 110{return _S_empty_wstring;} 111int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;} 112 113money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const 114{return _M_pos_format;} 115money_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 126template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >; 127template 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 131template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >; 132template 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) 140const bool moneypunct<char, true>::intl; 141const bool moneypunct<char, false>::intl; 142# ifndef _STLP_NO_WCHAR_T 143const bool moneypunct<wchar_t, true>::intl; 144const bool moneypunct<wchar_t, false>::intl; 145# endif 146#endif 147 148_STLP_END_NAMESPACE 149 150// Local Variables: 151// mode:C++ 152// End: 153