]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/config/locale/generic/monetary_members.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / config / locale / generic / monetary_members.cc
CommitLineData
72e2386f 1// std::moneypunct implementation details, generic version -*- C++ -*-
ea0c0b6e 2
a945c346 3// Copyright (C) 2001-2024 Free Software Foundation, Inc.
ea0c0b6e
BK
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
748086b7 8// Free Software Foundation; either version 3, or (at your option)
ea0c0b6e
BK
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
748086b7
JJ
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/>.
ea0c0b6e
BK
24
25//
72e2386f 26// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
ea0c0b6e
BK
27//
28
29// Written by Benjamin Kosnik <bkoz@redhat.com>
30
31#include <locale>
32
12ffa228
BK
33namespace std _GLIBCXX_VISIBILITY(default)
34{
35_GLIBCXX_BEGIN_NAMESPACE_VERSION
3cbc7af0 36
34a2b755
JW
37// This file might be compiled twice, but we only want to define the members
38// of money_base once.
39#if ! _GLIBCXX_USE_CXX11_ABI
40
69971cd8
BK
41 // Construct and return valid pattern consisting of some combination of:
42 // space none symbol sign value
43 money_base::pattern
32ade559 44 money_base::_S_construct_pattern(char, char, char) throw()
69971cd8 45 { return _S_default_pattern; }
34a2b755 46#endif
69971cd8 47
32ade559 48 template<>
69971cd8 49 void
fdf7e809 50 moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
69971cd8 51 {
fea4065d
BK
52 // "C" locale.
53 if (!_M_data)
fe932e50 54 _M_data = new __moneypunct_cache<char, true>;
fea4065d
BK
55
56 _M_data->_M_decimal_point = '.';
57 _M_data->_M_thousands_sep = ',';
58 _M_data->_M_grouping = "";
fe932e50 59 _M_data->_M_grouping_size = 0;
fea4065d 60 _M_data->_M_curr_symbol = "";
fe932e50 61 _M_data->_M_curr_symbol_size = 0;
fea4065d 62 _M_data->_M_positive_sign = "";
fe932e50 63 _M_data->_M_positive_sign_size = 0;
fea4065d 64 _M_data->_M_negative_sign = "";
fe932e50 65 _M_data->_M_negative_sign_size = 0;
fea4065d
BK
66 _M_data->_M_frac_digits = 0;
67 _M_data->_M_pos_format = money_base::_S_default_pattern;
68 _M_data->_M_neg_format = money_base::_S_default_pattern;
fe932e50
PC
69
70 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
71 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
69971cd8
BK
72 }
73
32ade559 74 template<>
72e2386f 75 void
fdf7e809 76 moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
72e2386f 77 {
fea4065d
BK
78 // "C" locale.
79 if (!_M_data)
fe932e50 80 _M_data = new __moneypunct_cache<char, false>;
fea4065d
BK
81
82 _M_data->_M_decimal_point = '.';
83 _M_data->_M_thousands_sep = ',';
84 _M_data->_M_grouping = "";
fe932e50 85 _M_data->_M_grouping_size = 0;
fea4065d 86 _M_data->_M_curr_symbol = "";
fe932e50 87 _M_data->_M_curr_symbol_size = 0;
fea4065d 88 _M_data->_M_positive_sign = "";
fe932e50 89 _M_data->_M_positive_sign_size = 0;
fea4065d 90 _M_data->_M_negative_sign = "";
fe932e50 91 _M_data->_M_negative_sign_size = 0;
fea4065d
BK
92 _M_data->_M_frac_digits = 0;
93 _M_data->_M_pos_format = money_base::_S_default_pattern;
94 _M_data->_M_neg_format = money_base::_S_default_pattern;
fe932e50
PC
95
96 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
97 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
72e2386f 98 }
ea0c0b6e 99
32ade559 100 template<>
d3a193e3 101 moneypunct<char, true>::~moneypunct()
fea4065d 102 { delete _M_data; }
d3a193e3 103
32ade559 104 template<>
d3a193e3 105 moneypunct<char, false>::~moneypunct()
fea4065d 106 { delete _M_data; }
d3a193e3 107
3d7c150e 108#ifdef _GLIBCXX_USE_WCHAR_T
32ade559 109 template<>
72e2386f 110 void
32ade559 111 moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
fdf7e809 112 const char*)
69971cd8
BK
113 {
114 // "C" locale
fea4065d 115 if (!_M_data)
fe932e50 116 _M_data = new __moneypunct_cache<wchar_t, true>;
fea4065d
BK
117
118 _M_data->_M_decimal_point = L'.';
119 _M_data->_M_thousands_sep = L',';
120 _M_data->_M_grouping = "";
fe932e50 121 _M_data->_M_grouping_size = 0;
fea4065d 122 _M_data->_M_curr_symbol = L"";
fe932e50 123 _M_data->_M_curr_symbol_size = 0;
fea4065d 124 _M_data->_M_positive_sign = L"";
32ade559 125 _M_data->_M_positive_sign_size = 0;
fea4065d 126 _M_data->_M_negative_sign = L"";
32ade559 127 _M_data->_M_negative_sign_size = 0;
fea4065d
BK
128 _M_data->_M_frac_digits = 0;
129 _M_data->_M_pos_format = money_base::_S_default_pattern;
130 _M_data->_M_neg_format = money_base::_S_default_pattern;
fe932e50 131
fe932e50 132 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
af55af57
PC
133 _M_data->_M_atoms[__i] =
134 static_cast<wchar_t>(money_base::_S_atoms[__i]);
69971cd8
BK
135 }
136
32ade559 137 template<>
69971cd8 138 void
32ade559 139 moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
fdf7e809 140 const char*)
72e2386f
BK
141 {
142 // "C" locale
fea4065d 143 if (!_M_data)
fe932e50 144 _M_data = new __moneypunct_cache<wchar_t, false>;
fea4065d
BK
145
146 _M_data->_M_decimal_point = L'.';
147 _M_data->_M_thousands_sep = L',';
148 _M_data->_M_grouping = "";
fe932e50 149 _M_data->_M_grouping_size = 0;
fea4065d 150 _M_data->_M_curr_symbol = L"";
fe932e50 151 _M_data->_M_curr_symbol_size = 0;
fea4065d 152 _M_data->_M_positive_sign = L"";
fe932e50 153 _M_data->_M_positive_sign_size = 0;
fea4065d 154 _M_data->_M_negative_sign = L"";
fe932e50 155 _M_data->_M_negative_sign_size = 0;
fea4065d
BK
156 _M_data->_M_frac_digits = 0;
157 _M_data->_M_pos_format = money_base::_S_default_pattern;
158 _M_data->_M_neg_format = money_base::_S_default_pattern;
fe932e50 159
fe932e50 160 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
af55af57
PC
161 _M_data->_M_atoms[__i] =
162 static_cast<wchar_t>(money_base::_S_atoms[__i]);
72e2386f 163 }
d3a193e3 164
32ade559 165 template<>
d3a193e3 166 moneypunct<wchar_t, true>::~moneypunct()
fea4065d 167 { delete _M_data; }
d3a193e3 168
32ade559 169 template<>
d3a193e3 170 moneypunct<wchar_t, false>::~moneypunct()
fea4065d 171 { delete _M_data; }
ea0c0b6e 172#endif
3cbc7af0 173
12ffa228
BK
174_GLIBCXX_END_NAMESPACE_VERSION
175} // namespace