1 // Locale support -*- C++ -*-
2 
3 // Copyright (C) 1999-2021 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 3, 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 // 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/>.
24 
25 //
26 // ISO C++ 14882: 22.1  Locales
27 //
28 
29 #ifndef _GLIBCXX_USE_CXX11_ABI
30 // Instantiations in this file use the old COW std::string ABI unless included
31 // by another file which defines _GLIBCXX_USE_CXX11_ABI=1. Some instantiations
32 // are guarded by a check for !_GLIBCXX_USE_CXX11_ABI so that they are only
33 // instantiated once, because they are not tagged with abi_tag so should not
34 // be instantiated twice.
35 # define _GLIBCXX_USE_CXX11_ABI 0
36 #endif
37 
38 #include <locale>
39 
40 // Instantiation configuration.
41 #ifndef C
42 # define C char
43 # define C_is_char
44 #endif
45 
46 #include "locale-inst-numeric.h"
47 #include "locale-inst-monetary.h"
48 
49 namespace std _GLIBCXX_VISIBILITY(default)
50 {
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
52 
53   // moneypunct, money_get, and money_put
54 #if ! _GLIBCXX_USE_CXX11_ABI
55   template struct __moneypunct_cache<C, false>;
56   template struct __moneypunct_cache<C, true>;
57 #endif
58 _GLIBCXX_BEGIN_NAMESPACE_CXX11
59   template class moneypunct<C, false>;
60   template class moneypunct<C, true>;
61   template class moneypunct_byname<C, false>;
62   template class moneypunct_byname<C, true>;
63 _GLIBCXX_END_NAMESPACE_CXX11
64 
65   // numpunct, numpunct_byname, num_get, and num_put
66 #if ! _GLIBCXX_USE_CXX11_ABI
67   template struct __numpunct_cache<C>;
68 #endif
69 _GLIBCXX_BEGIN_NAMESPACE_CXX11
70   template class numpunct<C>;
71   template class numpunct_byname<C>;
72 _GLIBCXX_END_NAMESPACE_CXX11
73 
74   // time_get and time_put
75 #if ! _GLIBCXX_USE_CXX11_ABI
76   template class __timepunct<C>;
77   template struct __timepunct_cache<C>;
78   template class time_put<C, ostreambuf_iterator<C> >;
79   template class time_put_byname<C, ostreambuf_iterator<C> >;
80 #else
81   // Instantiate constructor taking __cxx11::string
82   template time_put_byname<C>::time_put_byname(const string&, size_t);
83 #endif
84 _GLIBCXX_BEGIN_NAMESPACE_CXX11
85   template class time_get<C, istreambuf_iterator<C> >;
86   template class time_get_byname<C, istreambuf_iterator<C> >;
87 _GLIBCXX_END_NAMESPACE_CXX11
88 
89   // messages
90 _GLIBCXX_BEGIN_NAMESPACE_CXX11
91   template class messages<C>;
92   template class messages_byname<C>;
93 _GLIBCXX_END_NAMESPACE_CXX11
94 
95   // ctype
ctype_byname(const string & __s,size_t __refs)96   ctype_byname<C>::ctype_byname(const string& __s, size_t __refs)
97   : ctype_byname(__s.c_str(), __refs) { }
98 
99 #if ! _GLIBCXX_USE_CXX11_ABI
100   inline template class __ctype_abstract_base<C>;
101   template class ctype_byname<C>;
102 #endif
103 
104   // codecvt
105 #if ! _GLIBCXX_USE_CXX11_ABI
106   inline template class __codecvt_abstract_base<C, char, mbstate_t>;
107   template class codecvt_byname<C, char, mbstate_t>;
108 #else
109   // Instantiate constructor taking __cxx11::string
110   template codecvt_byname<C, char, mbstate_t>::codecvt_byname(const string&, size_t);
111 #endif
112 
113   // collate
114 _GLIBCXX_BEGIN_NAMESPACE_CXX11
115   template class collate<C>;
116   template class collate_byname<C>;
117 _GLIBCXX_END_NAMESPACE_CXX11
118 
119   // use_facet
120 #if ! _GLIBCXX_USE_CXX11_ABI
121   template
122     const ctype<C>&
123     use_facet<ctype<C> >(const locale&);
124 
125   template
126     const codecvt<C, char, mbstate_t>&
127     use_facet<codecvt<C, char, mbstate_t> >(const locale&);
128 #endif
129 
130   template
131     const collate<C>&
132     use_facet<collate<C> >(const locale&);
133 
134   template
135     const numpunct<C>&
136     use_facet<numpunct<C> >(const locale&);
137 
138   template
139     const moneypunct<C, true>&
140     use_facet<moneypunct<C, true> >(const locale&);
141 
142   template
143     const moneypunct<C, false>&
144     use_facet<moneypunct<C, false> >(const locale&);
145 
146 #if ! _GLIBCXX_USE_CXX11_ABI
147   template
148     const __timepunct<C>&
149     use_facet<__timepunct<C> >(const locale&);
150 
151   template
152     const time_put<C>&
153     use_facet<time_put<C> >(const locale&);
154 #endif
155 
156   template
157     const time_get<C>&
158     use_facet<time_get<C> >(const locale&);
159 
160   template
161     const messages<C>&
162     use_facet<messages<C> >(const locale&);
163 
164   // has_facet
165 #if ! _GLIBCXX_USE_CXX11_ABI
166   template
167     bool
168     has_facet<ctype<C> >(const locale&);
169 
170   template
171     bool
172     has_facet<codecvt<C, char, mbstate_t> >(const locale&);
173 #endif
174 
175   template
176     bool
177     has_facet<collate<C> >(const locale&);
178 
179   template
180     bool
181     has_facet<numpunct<C> >(const locale&);
182 
183   template
184     bool
185     has_facet<moneypunct<C> >(const locale&);
186 
187 #if ! _GLIBCXX_USE_CXX11_ABI
188   template
189     bool
190     has_facet<__timepunct<C> >(const locale&);
191 
192   template
193     bool
194     has_facet<time_put<C> >(const locale&);
195 #endif
196 
197   template
198     bool
199     has_facet<time_get<C> >(const locale&);
200 
201   template
202     bool
203     has_facet<messages<C> >(const locale&);
204 
205 
206 #if ! _GLIBCXX_USE_CXX11_ABI
207   // locale functions.
208   template
209     C*
210     __add_grouping<C>(C*, C, char const*, size_t,
211 			 C const*, C const*);
212 
213   template class __pad<C, char_traits<C> >;
214 
215   template
216     int
217     __int_to_char(C*, unsigned long, const C*,
218 		  ios_base::fmtflags, bool);
219 
220 #ifdef _GLIBCXX_USE_LONG_LONG
221   template
222     int
223     __int_to_char(C*, unsigned long long, const C*,
224 		  ios_base::fmtflags, bool);
225 #endif
226 #endif
227 
228 _GLIBCXX_END_NAMESPACE_VERSION
229 } // namespace
230 
231 // XXX GLIBCXX_ABI Deprecated
232 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && ! _GLIBCXX_USE_CXX11_ABI
233 #include "compatibility-ldbl-facets-aliases.h"
234 #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
235