34 #ifndef _LOCALE_CLASSES_H
35 #define _LOCALE_CLASSES_H 1
37 #pragma GCC system_header
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
77 template<
typename _Facet>
79 has_facet(
const locale&) throw();
81 template<typename _Facet>
83 use_facet(const locale&);
85 template<typename _Cache>
86 friend struct __use_cache;
98 static const category none = 0;
99 static const category ctype = 1L << 0;
100 static const category numeric = 1L << 1;
101 static const category collate = 1L << 2;
102 static const category time = 1L << 3;
103 static const category monetary = 1L << 4;
104 static const category messages = 1L << 5;
105 static const category all = (ctype | numeric | collate |
106 time | monetary | messages);
126 locale(const locale& __other) throw();
137 locale(const
char* __s);
151 locale(const locale&
__base, const
char* __s, category __cat);
164 locale(const locale& __base, const locale& __add, category __cat);
177 template<typename _Facet>
178 locale(const locale& __other, _Facet* __f);
192 operator=(const locale& __other) throw();
206 template<typename _Facet>
208 combine(const locale& __other) const;
226 operator==(const locale& __other) const throw();
235 operator!=(const locale& __other) const throw()
253 template<
typename _Char,
typename _Traits,
typename _Alloc>
270 global(
const locale& __loc);
283 static _Impl* _S_classic;
286 static _Impl* _S_global;
292 static const char*
const*
const _S_categories;
304 enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES };
307 static __gthread_once_t _S_once;
311 locale(_Impl*) throw();
317 _S_initialize_once() throw();
320 _S_normalize_category(category);
323 _M_coalesce(const locale&
__base, const locale& __add, category __cat);
342 friend class locale::_Impl;
344 mutable _Atomic_word _M_refcount;
347 static __c_locale _S_c_locale;
350 static const char _S_c_name[2];
353 static __gthread_once_t _S_once;
357 _S_initialize_once();
370 facet(
size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0)
378 _S_create_c_locale(__c_locale& __cloc,
const char* __s,
379 __c_locale __old = 0);
382 _S_clone_c_locale(__c_locale& __cloc)
throw();
385 _S_destroy_c_locale(__c_locale& __cloc);
388 _S_lc_ctype_c_locale(__c_locale __cloc,
const char* __s);
395 _GLIBCXX_CONST
static const char*
396 _S_get_c_name() throw();
400 _M_add_reference() const throw()
401 { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
404 _M_remove_reference()
const throw()
407 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
408 if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
410 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
421 operator=(
const facet&);
440 friend class locale::_Impl;
442 template<
typename _Facet>
444 use_facet(
const locale&);
446 template<
typename _Facet>
448 has_facet(
const locale&) throw();
453 mutable
size_t _M_index;
456 static _Atomic_word _S_refcount;
459 operator=(const
id&);
470 _M_id()
const throw();
480 friend class locale::facet;
482 template<
typename _Facet>
484 has_facet(
const locale&) throw();
486 template<typename _Facet>
488 use_facet(const locale&);
490 template<typename _Cache>
491 friend struct __use_cache;
495 _Atomic_word _M_refcount;
496 const facet** _M_facets;
497 size_t _M_facets_size;
498 const facet** _M_caches;
500 static const locale::
id* const _S_id_ctype[];
501 static const locale::
id* const _S_id_numeric[];
502 static const locale::
id* const _S_id_collate[];
503 static const locale::
id* const _S_id_time[];
504 static const locale::
id* const _S_id_monetary[];
505 static const locale::
id* const _S_id_messages[];
506 static const locale::
id* const* const _S_facet_categories[];
509 _M_add_reference() throw()
510 { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
513 _M_remove_reference() throw()
516 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
517 if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
519 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
527 _Impl(
const _Impl&,
size_t);
528 _Impl(
const char*,
size_t);
529 _Impl(
size_t) throw();
536 operator=(const _Impl&);
544 for (
size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i)
545 __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0;
550 _M_replace_categories(
const _Impl*, category);
553 _M_replace_category(
const _Impl*,
const locale::id*
const*);
556 _M_replace_facet(
const _Impl*,
const locale::id*);
559 _M_install_facet(
const locale::id*,
const facet*);
561 template<
typename _Facet>
563 _M_init_facet(_Facet* __facet)
567 _M_install_cache(
const facet*,
size_t);
583 template<
typename _CharT>
584 class collate :
public locale::facet
589 typedef _CharT char_type;
597 __c_locale _M_c_locale_collate;
611 collate(
size_t __refs = 0)
612 : facet(__refs), _M_c_locale_collate(_S_get_c_locale())
625 collate(__c_locale __cloc,
size_t __refs = 0)
626 : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc))
642 compare(
const _CharT* __lo1,
const _CharT* __hi1,
643 const _CharT* __lo2,
const _CharT* __hi2)
const
644 {
return this->do_compare(__lo1, __hi1, __lo2, __hi2); }
661 transform(
const _CharT* __lo,
const _CharT* __hi)
const
662 {
return this->do_transform(__lo, __hi); }
675 hash(
const _CharT* __lo,
const _CharT* __hi)
const
676 {
return this->do_hash(__lo, __hi); }
680 _M_compare(
const _CharT*,
const _CharT*)
const throw();
683 _M_transform(_CharT*, const _CharT*,
size_t) const throw();
689 { _S_destroy_c_locale(_M_c_locale_collate); }
704 do_compare(
const _CharT* __lo1,
const _CharT* __hi1,
705 const _CharT* __lo2,
const _CharT* __hi2)
const;
718 do_transform(
const _CharT* __lo,
const _CharT* __hi)
const;
731 do_hash(
const _CharT* __lo,
const _CharT* __hi)
const;
734 template<
typename _CharT>
740 collate<char>::_M_compare(
const char*,
const char*)
const throw();
744 collate<
char>::_M_transform(
char*, const
char*,
size_t) const throw();
746 #ifdef _GLIBCXX_USE_WCHAR_T
749 collate<wchar_t>::_M_compare(
const wchar_t*,
const wchar_t*)
const throw();
753 collate<
wchar_t>::_M_transform(
wchar_t*, const
wchar_t*,
size_t) const throw();
757 template<
typename _CharT>
758 class collate_byname :
public collate<_CharT>
762 typedef _CharT char_type;
768 collate_byname(
const char* __s,
size_t __refs = 0)
769 : collate<_CharT>(__refs)
771 if (__builtin_strcmp(__s,
"C") != 0
772 && __builtin_strcmp(__s,
"POSIX") != 0)
774 this->_S_destroy_c_locale(this->_M_c_locale_collate);
775 this->_S_create_c_locale(this->_M_c_locale_collate, __s);
781 ~collate_byname() { }
784 _GLIBCXX_END_NAMESPACE_VERSION
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Definition: functions.h:446
bool operator==(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
#define __try
Definition: exception_defines.h:35
namespace std _GLIBCXX_VISIBILITY(default)
Definition: auto_ptr.h:36
#define __catch(X)
Definition: exception_defines.h:36
Definition: basic_string.h:45