]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/config/locale/generic/numeric_members.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / config / locale / generic / numeric_members.cc
CommitLineData
72e2386f 1// std::numpunct implementation details, generic version -*- C++ -*-
ea0c0b6e 2
99dee823 3// Copyright (C) 2001-2021 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.
ea0c0b6e 19
748086b7
JJ
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.3.1.2 numpunct 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
f92ab29f 37 template<>
72e2386f
BK
38 void
39 numpunct<char>::_M_initialize_numpunct(__c_locale)
40 {
41 // "C" locale
215f9e28
BK
42 if (!_M_data)
43 _M_data = new __numpunct_cache<char>;
44
45 _M_data->_M_grouping = "";
fe932e50 46 _M_data->_M_grouping_size = 0;
215f9e28
BK
47 _M_data->_M_use_grouping = false;
48
49 _M_data->_M_decimal_point = '.';
50 _M_data->_M_thousands_sep = ',';
f92ab29f 51
17fa5560
PC
52 for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
53 _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
f92ab29f 54
17fa5560
PC
55 for (size_t __i = 0; __i < __num_base::_S_iend; ++__i)
56 _M_data->_M_atoms_in[__i] = __num_base::_S_atoms_in[__i];
215f9e28
BK
57
58 _M_data->_M_truename = "true";
af55af57 59 _M_data->_M_truename_size = 4;
dc6798f8 60 _M_data->_M_falsename = "false";
af55af57 61 _M_data->_M_falsename_size = 5;
72e2386f 62 }
d3a193e3 63
f92ab29f 64 template<>
d3a193e3 65 numpunct<char>::~numpunct()
215f9e28 66 { delete _M_data; }
f92ab29f 67
3d7c150e 68#ifdef _GLIBCXX_USE_WCHAR_T
f92ab29f 69 template<>
72e2386f
BK
70 void
71 numpunct<wchar_t>::_M_initialize_numpunct(__c_locale)
72 {
73 // "C" locale
215f9e28
BK
74 if (!_M_data)
75 _M_data = new __numpunct_cache<wchar_t>;
76
77 _M_data->_M_grouping = "";
fe932e50 78 _M_data->_M_grouping_size = 0;
215f9e28 79 _M_data->_M_use_grouping = false;
f92ab29f 80
215f9e28
BK
81 _M_data->_M_decimal_point = L'.';
82 _M_data->_M_thousands_sep = L',';
f92ab29f 83
215f9e28 84 // Use ctype::widen code without the facet...
17fa5560 85 for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
af55af57
PC
86 _M_data->_M_atoms_out[__i] =
87 static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
f92ab29f 88
17fa5560 89 for (size_t __i = 0; __i < __num_base::_S_iend; ++__i)
af55af57
PC
90 _M_data->_M_atoms_in[__i] =
91 static_cast<wchar_t>(__num_base::_S_atoms_in[__i]);
47f62b27 92
215f9e28 93 _M_data->_M_truename = L"true";
af55af57 94 _M_data->_M_truename_size = 4;
215f9e28 95 _M_data->_M_falsename = L"false";
af55af57 96 _M_data->_M_falsename_size = 5;
72e2386f 97 }
d3a193e3 98
f92ab29f 99 template<>
d3a193e3 100 numpunct<wchar_t>::~numpunct()
215f9e28 101 { delete _M_data; }
ea0c0b6e 102#endif
3cbc7af0 103
12ffa228
BK
104_GLIBCXX_END_NAMESPACE_VERSION
105} // namespace
3cbc7af0 106