1 // std::moneypunct implementation details, generic version -*- C++ -*-
2 
3 // Copyright (C) 2001, 2002 Free Software Foundation, Inc.
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 2, 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 // 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20 
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.
29 
30 //
31 // ISO C++ 14882: 22.2.6.3.2  moneypunct virtual functions
32 //
33 
34 // Written by Benjamin Kosnik <bkoz@redhat.com>
35 
36 #include <locale>
37 
38 namespace std
39 {
40   // Construct and return valid pattern consisting of some combination of:
41   // space none symbol sign value
42   money_base::pattern
_S_construct_pattern(char,char,char)43   money_base::_S_construct_pattern(char, char, char)
44   { return _S_default_pattern; }
45 
46   template<>
47     void
_M_initialize_moneypunct(__c_locale,const char *)48     moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
49     {
50       // "C" locale
51       _M_decimal_point = '.';
52       _M_thousands_sep = ',';
53       _M_grouping = "";
54       _M_curr_symbol = "";
55       _M_positive_sign = "";
56       _M_negative_sign = "";
57       _M_frac_digits = 0;
58       _M_pos_format = money_base::_S_default_pattern;
59       _M_neg_format = money_base::_S_default_pattern;
60     }
61 
62   template<>
63     void
_M_initialize_moneypunct(__c_locale,const char *)64     moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
65     {
66       // "C" locale
67       _M_decimal_point = '.';
68       _M_thousands_sep = ',';
69       _M_grouping = "";
70       _M_curr_symbol = "";
71       _M_positive_sign = "";
72       _M_negative_sign = "";
73       _M_frac_digits = 0;
74       _M_pos_format = money_base::_S_default_pattern;
75       _M_neg_format = money_base::_S_default_pattern;
76     }
77 
78   template<>
~moneypunct()79     moneypunct<char, true>::~moneypunct()
80     { }
81 
82   template<>
~moneypunct()83     moneypunct<char, false>::~moneypunct()
84     { }
85 
86 #if defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCPP_USE_TYPE_WCHAR_T)
87   template<>
88     void
_M_initialize_moneypunct(__c_locale,const char *)89     moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
90 							const char*)
91     {
92       // "C" locale
93       _M_decimal_point = L'.';
94       _M_thousands_sep = L',';
95       _M_grouping = "";
96       _M_curr_symbol = L"";
97       _M_positive_sign = L"";
98       _M_negative_sign = L"";
99       _M_frac_digits = 0;
100       _M_pos_format = money_base::_S_default_pattern;
101       _M_neg_format = money_base::_S_default_pattern;
102     }
103 
104   template<>
105     void
_M_initialize_moneypunct(__c_locale,const char *)106     moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
107 							 const char*)
108     {
109       // "C" locale
110       _M_decimal_point = L'.';
111       _M_thousands_sep = L',';
112       _M_grouping = "";
113       _M_curr_symbol = L"";
114       _M_positive_sign = L"";
115       _M_negative_sign = L"";
116       _M_frac_digits = 0;
117       _M_pos_format = money_base::_S_default_pattern;
118       _M_neg_format = money_base::_S_default_pattern;
119     }
120 
121   template<>
~moneypunct()122     moneypunct<wchar_t, true>::~moneypunct()
123     { }
124 
125   template<>
~moneypunct()126     moneypunct<wchar_t, false>::~moneypunct()
127     { }
128 #endif
129 }
130