1 // std::moneypunct implementation details, generic version -*- C++ -*-
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
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 2, or (at your option)
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
31 // ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
34 // Written by Benjamin Kosnik <bkoz@redhat.com>
38 _GLIBCXX_BEGIN_NAMESPACE(std)
40 // Construct and return valid pattern consisting of some combination of:
41 // space none symbol sign value
43 money_base::_S_construct_pattern(char, char, char)
44 { return _S_default_pattern; }
48 moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
52 _M_data = new __moneypunct_cache<char, true>;
54 _M_data->_M_decimal_point = '.';
55 _M_data->_M_thousands_sep = ',';
56 _M_data->_M_grouping = "";
57 _M_data->_M_grouping_size = 0;
58 _M_data->_M_curr_symbol = "";
59 _M_data->_M_curr_symbol_size = 0;
60 _M_data->_M_positive_sign = "";
61 _M_data->_M_positive_sign_size = 0;
62 _M_data->_M_negative_sign = "";
63 _M_data->_M_negative_sign_size = 0;
64 _M_data->_M_frac_digits = 0;
65 _M_data->_M_pos_format = money_base::_S_default_pattern;
66 _M_data->_M_neg_format = money_base::_S_default_pattern;
68 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
69 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
74 moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
78 _M_data = new __moneypunct_cache<char, false>;
80 _M_data->_M_decimal_point = '.';
81 _M_data->_M_thousands_sep = ',';
82 _M_data->_M_grouping = "";
83 _M_data->_M_grouping_size = 0;
84 _M_data->_M_curr_symbol = "";
85 _M_data->_M_curr_symbol_size = 0;
86 _M_data->_M_positive_sign = "";
87 _M_data->_M_positive_sign_size = 0;
88 _M_data->_M_negative_sign = "";
89 _M_data->_M_negative_sign_size = 0;
90 _M_data->_M_frac_digits = 0;
91 _M_data->_M_pos_format = money_base::_S_default_pattern;
92 _M_data->_M_neg_format = money_base::_S_default_pattern;
94 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
95 _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
99 moneypunct<char, true>::~moneypunct()
103 moneypunct<char, false>::~moneypunct()
106 #ifdef _GLIBCXX_USE_WCHAR_T
109 moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
114 _M_data = new __moneypunct_cache<wchar_t, true>;
116 _M_data->_M_decimal_point = L'.';
117 _M_data->_M_thousands_sep = L',';
118 _M_data->_M_grouping = "";
119 _M_data->_M_grouping_size = 0;
120 _M_data->_M_curr_symbol = L"";
121 _M_data->_M_curr_symbol_size = 0;
122 _M_data->_M_positive_sign = L"";
123 _M_data->_M_positive_sign_size = 0;
124 _M_data->_M_negative_sign = L"";
125 _M_data->_M_negative_sign_size = 0;
126 _M_data->_M_frac_digits = 0;
127 _M_data->_M_pos_format = money_base::_S_default_pattern;
128 _M_data->_M_neg_format = money_base::_S_default_pattern;
130 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
131 _M_data->_M_atoms[__i] =
132 static_cast<wchar_t>(money_base::_S_atoms[__i]);
137 moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
142 _M_data = new __moneypunct_cache<wchar_t, false>;
144 _M_data->_M_decimal_point = L'.';
145 _M_data->_M_thousands_sep = L',';
146 _M_data->_M_grouping = "";
147 _M_data->_M_grouping_size = 0;
148 _M_data->_M_curr_symbol = L"";
149 _M_data->_M_curr_symbol_size = 0;
150 _M_data->_M_positive_sign = L"";
151 _M_data->_M_positive_sign_size = 0;
152 _M_data->_M_negative_sign = L"";
153 _M_data->_M_negative_sign_size = 0;
154 _M_data->_M_frac_digits = 0;
155 _M_data->_M_pos_format = money_base::_S_default_pattern;
156 _M_data->_M_neg_format = money_base::_S_default_pattern;
158 for (size_t __i = 0; __i < money_base::_S_end; ++__i)
159 _M_data->_M_atoms[__i] =
160 static_cast<wchar_t>(money_base::_S_atoms[__i]);
164 moneypunct<wchar_t, true>::~moneypunct()
168 moneypunct<wchar_t, false>::~moneypunct()
172 _GLIBCXX_END_NAMESPACE