| OLD | NEW |
| (Empty) |
| 1 // std::moneypunct implementation details, generic version -*- C++ -*- | |
| 2 | |
| 3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, In
c. | |
| 4 // | |
| 5 // This file is part of the GNU ISO C++ Library. This library is free | |
| 6 // software; you can redistribute it and/or modify it under the | |
| 7 // terms of the GNU General Public License as published by the | |
| 8 // Free Software Foundation; either version 3, or (at your option) | |
| 9 // any later version. | |
| 10 | |
| 11 // This library is distributed in the hope that it will be useful, | |
| 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 // GNU General Public License for more details. | |
| 15 | |
| 16 // Under Section 7 of GPL version 3, you are granted additional | |
| 17 // permissions described in the GCC Runtime Library Exception, version | |
| 18 // 3.1, as published by the Free Software Foundation. | |
| 19 | |
| 20 // You should have received a copy of the GNU General Public License and | |
| 21 // a copy of the GCC Runtime Library Exception along with this program; | |
| 22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
| 23 // <http://www.gnu.org/licenses/>. | |
| 24 | |
| 25 // | |
| 26 // ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions | |
| 27 // | |
| 28 | |
| 29 // Written by Benjamin Kosnik <bkoz@redhat.com> | |
| 30 | |
| 31 #include <locale> | |
| 32 | |
| 33 _GLIBCXX_BEGIN_NAMESPACE(std) | |
| 34 | |
| 35 // Construct and return valid pattern consisting of some combination of: | |
| 36 // space none symbol sign value | |
| 37 money_base::pattern | |
| 38 money_base::_S_construct_pattern(char, char, char) | |
| 39 { return _S_default_pattern; } | |
| 40 | |
| 41 template<> | |
| 42 void | |
| 43 moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*) | |
| 44 { | |
| 45 // "C" locale. | |
| 46 if (!_M_data) | |
| 47 _M_data = new __moneypunct_cache<char, true>; | |
| 48 | |
| 49 _M_data->_M_decimal_point = '.'; | |
| 50 _M_data->_M_thousands_sep = ','; | |
| 51 _M_data->_M_grouping = ""; | |
| 52 _M_data->_M_grouping_size = 0; | |
| 53 _M_data->_M_curr_symbol = ""; | |
| 54 _M_data->_M_curr_symbol_size = 0; | |
| 55 _M_data->_M_positive_sign = ""; | |
| 56 _M_data->_M_positive_sign_size = 0; | |
| 57 _M_data->_M_negative_sign = ""; | |
| 58 _M_data->_M_negative_sign_size = 0; | |
| 59 _M_data->_M_frac_digits = 0; | |
| 60 _M_data->_M_pos_format = money_base::_S_default_pattern; | |
| 61 _M_data->_M_neg_format = money_base::_S_default_pattern; | |
| 62 | |
| 63 for (size_t __i = 0; __i < money_base::_S_end; ++__i) | |
| 64 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; | |
| 65 } | |
| 66 | |
| 67 template<> | |
| 68 void | |
| 69 moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*) | |
| 70 { | |
| 71 // "C" locale. | |
| 72 if (!_M_data) | |
| 73 _M_data = new __moneypunct_cache<char, false>; | |
| 74 | |
| 75 _M_data->_M_decimal_point = '.'; | |
| 76 _M_data->_M_thousands_sep = ','; | |
| 77 _M_data->_M_grouping = ""; | |
| 78 _M_data->_M_grouping_size = 0; | |
| 79 _M_data->_M_curr_symbol = ""; | |
| 80 _M_data->_M_curr_symbol_size = 0; | |
| 81 _M_data->_M_positive_sign = ""; | |
| 82 _M_data->_M_positive_sign_size = 0; | |
| 83 _M_data->_M_negative_sign = ""; | |
| 84 _M_data->_M_negative_sign_size = 0; | |
| 85 _M_data->_M_frac_digits = 0; | |
| 86 _M_data->_M_pos_format = money_base::_S_default_pattern; | |
| 87 _M_data->_M_neg_format = money_base::_S_default_pattern; | |
| 88 | |
| 89 for (size_t __i = 0; __i < money_base::_S_end; ++__i) | |
| 90 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; | |
| 91 } | |
| 92 | |
| 93 template<> | |
| 94 moneypunct<char, true>::~moneypunct() | |
| 95 { delete _M_data; } | |
| 96 | |
| 97 template<> | |
| 98 moneypunct<char, false>::~moneypunct() | |
| 99 { delete _M_data; } | |
| 100 | |
| 101 #ifdef _GLIBCXX_USE_WCHAR_T | |
| 102 template<> | |
| 103 void | |
| 104 moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale, | |
| 105 const char*) | |
| 106 { | |
| 107 // "C" locale | |
| 108 if (!_M_data) | |
| 109 _M_data = new __moneypunct_cache<wchar_t, true>; | |
| 110 | |
| 111 _M_data->_M_decimal_point = L'.'; | |
| 112 _M_data->_M_thousands_sep = L','; | |
| 113 _M_data->_M_grouping = ""; | |
| 114 _M_data->_M_grouping_size = 0; | |
| 115 _M_data->_M_curr_symbol = L""; | |
| 116 _M_data->_M_curr_symbol_size = 0; | |
| 117 _M_data->_M_positive_sign = L""; | |
| 118 _M_data->_M_positive_sign_size = 0; | |
| 119 _M_data->_M_negative_sign = L""; | |
| 120 _M_data->_M_negative_sign_size = 0; | |
| 121 _M_data->_M_frac_digits = 0; | |
| 122 _M_data->_M_pos_format = money_base::_S_default_pattern; | |
| 123 _M_data->_M_neg_format = money_base::_S_default_pattern; | |
| 124 | |
| 125 for (size_t __i = 0; __i < money_base::_S_end; ++__i) | |
| 126 _M_data->_M_atoms[__i] = | |
| 127 static_cast<wchar_t>(money_base::_S_atoms[__i]); | |
| 128 } | |
| 129 | |
| 130 template<> | |
| 131 void | |
| 132 moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale, | |
| 133 const char*) | |
| 134 { | |
| 135 // "C" locale | |
| 136 if (!_M_data) | |
| 137 _M_data = new __moneypunct_cache<wchar_t, false>; | |
| 138 | |
| 139 _M_data->_M_decimal_point = L'.'; | |
| 140 _M_data->_M_thousands_sep = L','; | |
| 141 _M_data->_M_grouping = ""; | |
| 142 _M_data->_M_grouping_size = 0; | |
| 143 _M_data->_M_curr_symbol = L""; | |
| 144 _M_data->_M_curr_symbol_size = 0; | |
| 145 _M_data->_M_positive_sign = L""; | |
| 146 _M_data->_M_positive_sign_size = 0; | |
| 147 _M_data->_M_negative_sign = L""; | |
| 148 _M_data->_M_negative_sign_size = 0; | |
| 149 _M_data->_M_frac_digits = 0; | |
| 150 _M_data->_M_pos_format = money_base::_S_default_pattern; | |
| 151 _M_data->_M_neg_format = money_base::_S_default_pattern; | |
| 152 | |
| 153 for (size_t __i = 0; __i < money_base::_S_end; ++__i) | |
| 154 _M_data->_M_atoms[__i] = | |
| 155 static_cast<wchar_t>(money_base::_S_atoms[__i]); | |
| 156 } | |
| 157 | |
| 158 template<> | |
| 159 moneypunct<wchar_t, true>::~moneypunct() | |
| 160 { delete _M_data; } | |
| 161 | |
| 162 template<> | |
| 163 moneypunct<wchar_t, false>::~moneypunct() | |
| 164 { delete _M_data; } | |
| 165 #endif | |
| 166 | |
| 167 _GLIBCXX_END_NAMESPACE | |
| OLD | NEW |