| 1 | // Locale support -*- C++ -*- |
| 2 | |
| 3 | // Copyright (C) 1999-2025 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 | #include "facet_inst_macros.h" |
| 49 | |
| 50 | namespace std _GLIBCXX_VISIBILITY(default) |
| 51 | { |
| 52 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
| 53 | |
| 54 | // moneypunct, money_get, and money_put |
| 55 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 56 | template struct __moneypunct_cache<C, false>; |
| 57 | template struct __moneypunct_cache<C, true>; |
| 58 | #endif |
| 59 | _GLIBCXX_BEGIN_NAMESPACE_CXX11 |
| 60 | template class moneypunct<C, false>; |
| 61 | template class moneypunct<C, true>; |
| 62 | template class moneypunct_byname<C, false>; |
| 63 | template class moneypunct_byname<C, true>; |
| 64 | _GLIBCXX_END_NAMESPACE_CXX11 |
| 65 | |
| 66 | // numpunct, numpunct_byname, num_get, and num_put |
| 67 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 68 | template struct __numpunct_cache<C>; |
| 69 | #endif |
| 70 | _GLIBCXX_BEGIN_NAMESPACE_CXX11 |
| 71 | template class numpunct<C>; |
| 72 | template class numpunct_byname<C>; |
| 73 | _GLIBCXX_END_NAMESPACE_CXX11 |
| 74 | |
| 75 | // time_get and time_put |
| 76 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 77 | template class __timepunct<C>; |
| 78 | template struct __timepunct_cache<C>; |
| 79 | template class time_put<C, ostreambuf_iterator<C> >; |
| 80 | template class time_put_byname<C, ostreambuf_iterator<C> >; |
| 81 | #else |
| 82 | // Instantiate constructor taking __cxx11::string |
| 83 | template time_put_byname<C>::time_put_byname(const string&, size_t); |
| 84 | #endif |
| 85 | _GLIBCXX_BEGIN_NAMESPACE_CXX11 |
| 86 | template class time_get<C, istreambuf_iterator<C> >; |
| 87 | template class time_get_byname<C, istreambuf_iterator<C> >; |
| 88 | _GLIBCXX_END_NAMESPACE_CXX11 |
| 89 | |
| 90 | // messages |
| 91 | _GLIBCXX_BEGIN_NAMESPACE_CXX11 |
| 92 | template class messages<C>; |
| 93 | template class messages_byname<C>; |
| 94 | _GLIBCXX_END_NAMESPACE_CXX11 |
| 95 | |
| 96 | // ctype |
| 97 | ctype_byname<C>::ctype_byname(const string& __s, size_t __refs) |
| 98 | : ctype_byname(__s.c_str(), __refs) { } |
| 99 | |
| 100 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 101 | inline template class __ctype_abstract_base<C>; |
| 102 | template class ctype_byname<C>; |
| 103 | #endif |
| 104 | |
| 105 | // codecvt |
| 106 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 107 | inline template class __codecvt_abstract_base<C, char, mbstate_t>; |
| 108 | template class codecvt_byname<C, char, mbstate_t>; |
| 109 | #else |
| 110 | // Instantiate constructor taking __cxx11::string |
| 111 | template codecvt_byname<C, char, mbstate_t>::codecvt_byname(const string&, size_t); |
| 112 | #endif |
| 113 | |
| 114 | // collate |
| 115 | _GLIBCXX_BEGIN_NAMESPACE_CXX11 |
| 116 | template class collate<C>; |
| 117 | template class collate_byname<C>; |
| 118 | _GLIBCXX_END_NAMESPACE_CXX11 |
| 119 | |
| 120 | // use_facet and has_facet instantiations |
| 121 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 122 | INSTANTIATE_FACET_ACCESSORS(ctype<C>); |
| 123 | INSTANTIATE_FACET_ACCESSORS(codecvt<C, char, mbstate_t>); |
| 124 | #endif |
| 125 | INSTANTIATE_FACET_ACCESSORS(collate<C>); |
| 126 | INSTANTIATE_FACET_ACCESSORS(numpunct<C>); |
| 127 | INSTANTIATE_FACET_ACCESSORS(moneypunct<C, false>); |
| 128 | // No explicit instantiation of has_facet<moneypunct<C, true>> for some reason. |
| 129 | INSTANTIATE_USE_FACET (moneypunct<C, true>); |
| 130 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 131 | INSTANTIATE_FACET_ACCESSORS(__timepunct<C>); |
| 132 | INSTANTIATE_FACET_ACCESSORS(time_put<C>); |
| 133 | #endif |
| 134 | INSTANTIATE_FACET_ACCESSORS(time_get<C>); |
| 135 | INSTANTIATE_FACET_ACCESSORS(messages<C>); |
| 136 | |
| 137 | #if ! _GLIBCXX_USE_CXX11_ABI |
| 138 | // locale functions. |
| 139 | template |
| 140 | C* |
| 141 | __add_grouping<C>(C*, C, char const*, size_t, |
| 142 | C const*, C const*); |
| 143 | |
| 144 | template class __pad<C, char_traits<C> >; |
| 145 | |
| 146 | template |
| 147 | int |
| 148 | __int_to_char(C*, unsigned long, const C*, |
| 149 | ios_base::fmtflags, bool); |
| 150 | |
| 151 | #ifdef _GLIBCXX_USE_LONG_LONG |
| 152 | template |
| 153 | int |
| 154 | __int_to_char(C*, unsigned long long, const C*, |
| 155 | ios_base::fmtflags, bool); |
| 156 | #endif |
| 157 | #endif |
| 158 | |
| 159 | _GLIBCXX_END_NAMESPACE_VERSION |
| 160 | } // namespace |
| 161 | |
| 162 | // XXX GLIBCXX_ABI Deprecated |
| 163 | #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && ! _GLIBCXX_USE_CXX11_ABI |
| 164 | #include "compatibility-ldbl-facets-aliases.h" |
| 165 | #endif // _GLIBCXX_LONG_DOUBLE_COMPAT |