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