34 #ifndef _LOCALE_CLASSES_TCC 35 #define _LOCALE_CLASSES_TCC 1 37 #pragma GCC system_header 39 namespace std _GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
43 template<
typename _Facet>
47 _M_impl =
new _Impl(*__other._M_impl, 1);
50 { _M_impl->_M_install_facet(&_Facet::id, __f); }
53 _M_impl->_M_remove_reference();
54 __throw_exception_again;
56 delete [] _M_impl->_M_names[0];
57 _M_impl->_M_names[0] = 0;
60 template<
typename _Facet>
65 _Impl* __tmp =
new _Impl(*_M_impl, 1);
68 __tmp->_M_replace_facet(__other._M_impl, &_Facet::id);
72 __tmp->_M_remove_reference();
73 __throw_exception_again;
78 template<
typename _CharT,
typename _Traits,
typename _Alloc>
85 const __collate_type& __collate = use_facet<__collate_type>(*this);
86 return (__collate.compare(__s1.
data(), __s1.
data() + __s1.
length(),
90 template<
typename _Facet>
92 __try_use_facet(
const locale& __loc) _GLIBCXX_NOTHROW
94 const size_t __i = _Facet::id._M_id();
99 #define _GLIBCXX_STD_FACET(...) \ 100 if _GLIBCXX17_CONSTEXPR (__is_same(_Facet, __VA_ARGS__)) \ 101 return static_cast<const _Facet*>(__facets[__i]) 117 #ifdef _GLIBCXX_USE_WCHAR_T 132 #if __cplusplus >= 201103L 137 #undef _GLIBCXX_STD_FACET 139 if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i])
143 return dynamic_cast<const _Facet*
>(__facets[__i]);
145 return static_cast<const _Facet*
>(__facets[__i]);
161 template<
typename _Facet>
165 #if __cplusplus >= 201103L 167 "template argument must be derived from locale::facet");
169 (void) static_cast<const _Facet*>(static_cast<const locale::facet*>(0));
171 return std::__try_use_facet<_Facet>(__loc) != 0;
188 #pragma GCC diagnostic push 189 #pragma GCC diagnostic ignored "-Wdangling-reference" 190 template<
typename _Facet>
194 #if __cplusplus >= 201103L 196 "template argument must be derived from locale::facet");
198 (void) static_cast<const _Facet*>(static_cast<const locale::facet*>(0));
200 if (
const _Facet* __f = std::__try_use_facet<_Facet>(__loc))
204 #pragma GCC diagnostic pop 208 template<
typename _CharT>
214 template<
typename _CharT>
219 template<
typename _CharT>
223 const _CharT* __lo2,
const _CharT* __hi2)
const 230 const _CharT* __p = __one.
c_str();
231 const _CharT* __pend = __one.
data() + __one.
length();
232 const _CharT* __q = __two.
c_str();
233 const _CharT* __qend = __two.
data() + __two.
length();
240 const int __res = _M_compare(__p, __q);
246 if (__p == __pend && __q == __qend)
248 else if (__p == __pend)
250 else if (__q == __qend)
258 template<
typename _CharT>
268 const _CharT* __p = __str.
c_str();
269 const _CharT* __pend = __str.
data() + __str.
length();
271 size_t __len = (__hi - __lo) * 2;
273 _CharT* __c =
new _CharT[__len];
283 size_t __res = _M_transform(__c, __p, __len);
289 delete [] __c, __c = 0;
290 __c =
new _CharT[__len];
291 __res = _M_transform(__c, __p, __len);
306 __throw_exception_again;
314 template<
typename _CharT>
317 do_hash(
const _CharT* __lo,
const _CharT* __hi)
const 319 unsigned long __val = 0;
320 for (; __lo < __hi; ++__lo)
322 *__lo + ((__val << 7)
323 | (__val >> (__gnu_cxx::__numeric_traits<unsigned long>::
325 return static_cast<long>(__val);
330 #if _GLIBCXX_EXTERN_TEMPLATE 336 __try_use_facet<collate<char> >(
const locale&) _GLIBCXX_NOTHROW;
340 use_facet<collate<char> >(
const locale&);
344 has_facet<collate<char> >(
const locale&);
346 #ifdef _GLIBCXX_USE_WCHAR_T 351 const collate<wchar_t>*
352 __try_use_facet<collate<wchar_t> >(
const locale&) _GLIBCXX_NOTHROW;
355 const collate<wchar_t>&
356 use_facet<collate<wchar_t> >(
const locale&);
360 has_facet<collate<wchar_t> >(
const locale&);
364 _GLIBCXX_END_NAMESPACE_VERSION
Primary class template num_get.This facet encapsulates the code to parse and return a number from a s...
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
bool operator()(const basic_string< _Char, _Traits, _Alloc > &__s1, const basic_string< _Char, _Traits, _Alloc > &__s2) const
Compare two strings according to collate.
Localization functionality base class.The facet class is the base class for a localization feature...
virtual long do_hash(const _CharT *__lo, const _CharT *__hi) const
Return hash of a string.
Primary class template time_put.This facet encapsulates the code to format and output dates and times...
virtual int do_compare(const _CharT *__lo1, const _CharT *__hi1, const _CharT *__lo2, const _CharT *__hi2) const
Compare two strings.
friend const _Facet & use_facet(const locale &)
Return a facet.use_facet looks for and returns a reference to a facet of type Facet where Facet is th...
Primary class template moneypunct.This facet encapsulates the punctuation, grouping and other formatt...
Primary class template messages.This facet encapsulates the code to retrieve messages from message ca...
Container class for localization functionality.The locale class is first a class wrapper for C librar...
Primary class template num_put.This facet encapsulates the code to convert a number to a string...
class collate_byname [22.2.4.2].
void push_back(_CharT __c)
Append a single character.
Class codecvt<wchar_t, char, mbstate_t> specialization.
ISO C++ entities toplevel namespace is std.
Primary class template money_get.This facet encapsulates the code to parse and return a monetary amou...
The ctype<wchar_t> specialization.This class defines classification and conversion functions for the ...
Primary class template time_get.This facet encapsulates the code to parse and return a date or time f...
Facet for localized string comparison.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
Class codecvt<char32_t, char, mbstate_t> specialization.
const _CharT * data() const noexcept
Return const pointer to contents.
class codecvt<char, char, mbstate_t> specialization.
Basis for explicit traits specializations.
The ctype<char> specialization.This class defines classification and conversion functions for the cha...
friend bool has_facet(const locale &)
Test for the presence of a facet.has_facet tests the locale argument for the presence of the facet ty...
Class codecvt<char16_t, char, mbstate_t> specialization.
basic_string & append(const basic_string &__str)
Append a string to this string.
locale()
Default constructor.
Primary class template money_put.This facet encapsulates the code to format and output a monetary amo...
locale combine(const locale &__other) const
Construct locale with another facet.
Managing sequences of characters and character-like objects.
Primary class template numpunct.This facet stores several pieces of information related to printing a...
virtual string_type do_transform(const _CharT *__lo, const _CharT *__hi) const
Transform string to comparable form.