/home/ntakagi/work/STLport-5.1.5/src/monetary.cppGo to the documentation of this file.00001 /* 00002 * Copyright (c) 1999 00003 * Silicon Graphics Computer Systems, Inc. 00004 * 00005 * Copyright (c) 1999 00006 * Boris Fomitchev 00007 * 00008 * This material is provided "as is", with absolutely no warranty expressed 00009 * or implied. Any use is at your own risk. 00010 * 00011 * Permission to use or copy this software for any purpose is hereby granted 00012 * without fee, provided the above notices are retained on all copies. 00013 * Permission to modify the code and to distribute modified code is granted, 00014 * provided the above notices are retained, and a notice that the code was 00015 * modified is included with the above copyright notice. 00016 * 00017 */ 00018 #include "stlport_prefix.h" 00019 00020 #include <locale> 00021 #include <istream> 00022 00023 _STLP_BEGIN_NAMESPACE 00024 00025 static void _Init_monetary_formats(money_base::pattern& pos_format, 00026 money_base::pattern& neg_format) { 00027 pos_format.field[0] = (char) money_base::symbol; 00028 pos_format.field[1] = (char) money_base::sign; 00029 pos_format.field[2] = (char) money_base::none; 00030 pos_format.field[3] = (char) money_base::value; 00031 00032 neg_format.field[0] = (char) money_base::symbol; 00033 neg_format.field[1] = (char) money_base::sign; 00034 neg_format.field[2] = (char) money_base::none; 00035 neg_format.field[3] = (char) money_base::value; 00036 } 00037 00038 // This is being used throughout the library 00039 static const string _S_empty_string; 00040 #ifndef _STLP_NO_WCHAR_T 00041 static const wstring _S_empty_wstring; 00042 #endif 00043 00044 // 00045 // moneypunct<> 00046 // 00047 00048 moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs) 00049 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } 00050 moneypunct<char, true>::~moneypunct() {} 00051 00052 char moneypunct<char, true>::do_decimal_point() const {return ' ';} 00053 char moneypunct<char, true>::do_thousands_sep() const {return ' ';} 00054 string moneypunct<char, true>::do_grouping() const { return _S_empty_string; } 00055 string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; } 00056 string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; } 00057 string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; } 00058 money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;} 00059 money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;} 00060 int moneypunct<char, true>::do_frac_digits() const {return 0;} 00061 00062 moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs) 00063 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } 00064 moneypunct<char, false>::~moneypunct() {} 00065 00066 char moneypunct<char, false>::do_decimal_point() const {return ' ';} 00067 char moneypunct<char, false>::do_thousands_sep() const {return ' ';} 00068 00069 string moneypunct<char, false>::do_grouping() const { return _S_empty_string; } 00070 string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; } 00071 string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; } 00072 string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; } 00073 money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;} 00074 money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;} 00075 int moneypunct<char, false>::do_frac_digits() const {return 0;} 00076 00077 #ifndef _STLP_NO_WCHAR_T 00078 moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs) 00079 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } 00080 moneypunct<wchar_t, true>::~moneypunct() {} 00081 00082 wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';} 00083 wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';} 00084 string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;} 00085 00086 wstring moneypunct<wchar_t, true>::do_curr_symbol() const 00087 {return _S_empty_wstring;} 00088 wstring moneypunct<wchar_t, true>::do_positive_sign() const 00089 {return _S_empty_wstring;} 00090 wstring moneypunct<wchar_t, true>::do_negative_sign() const 00091 {return _S_empty_wstring;} 00092 int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;} 00093 money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const 00094 {return _M_pos_format;} 00095 money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const 00096 {return _M_neg_format;} 00097 00098 moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs) 00099 { _Init_monetary_formats(_M_pos_format, _M_neg_format); } 00100 moneypunct<wchar_t, false>::~moneypunct() {} 00101 00102 wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';} 00103 wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';} 00104 string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;} 00105 wstring moneypunct<wchar_t, false>::do_curr_symbol() const 00106 {return _S_empty_wstring;} 00107 wstring moneypunct<wchar_t, false>::do_positive_sign() const 00108 {return _S_empty_wstring;} 00109 wstring moneypunct<wchar_t, false>::do_negative_sign() const 00110 {return _S_empty_wstring;} 00111 int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;} 00112 00113 money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const 00114 {return _M_pos_format;} 00115 money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const 00116 {return _M_neg_format;} 00117 00118 #endif /* WCHAR_T */ 00119 00120 // 00121 // Instantiations 00122 // 00123 00124 #if !defined(_STLP_NO_FORCE_INSTANTIATE) 00125 00126 template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >; 00127 template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >; 00128 // template class money_put<char, char*>; 00129 00130 # ifndef _STLP_NO_WCHAR_T 00131 template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >; 00132 template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >; 00133 // template class money_put<wchar_t, wchar_t*>; 00134 // template class money_get<wchar_t, const wchar_t*>; 00135 # endif 00136 00137 #endif 00138 00139 _STLP_END_NAMESPACE 00140 00141 // Local Variables: 00142 // mode:C++ 00143 // End:
Generated on Mon Mar 10 15:32:17 2008 by ![]() |