38 namespace std _GLIBCXX_VISIBILITY(default)
40 _GLIBCXX_BEGIN_NAMESPACE_VERSION
43 template<
typename _CharT>
45 : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
46 _M_name_messages(_S_get_c_name())
49 template<
typename _CharT>
52 : facet(__refs), _M_c_locale_messages(0), _M_name_messages(0)
54 if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
56 const size_t __len = __builtin_strlen(__s) + 1;
57 char* __tmp =
new char[__len];
58 __builtin_memcpy(__tmp, __s, __len);
59 _M_name_messages = __tmp;
62 _M_name_messages = _S_get_c_name();
65 _M_c_locale_messages = _S_clone_c_locale(__cloc);
68 template<
typename _CharT>
69 typename messages<_CharT>::catalog
71 const char* __dir)
const
73 bindtextdomain(__s.
c_str(), __dir);
74 return this->do_open(__s, __loc);
78 template<
typename _CharT>
81 if (_M_name_messages != _S_get_c_name())
82 delete [] _M_name_messages;
83 _S_destroy_c_locale(_M_c_locale_messages);
86 template<
typename _CharT>
87 typename messages<_CharT>::catalog
93 textdomain(__s.
c_str());
97 template<
typename _CharT>
99 messages<_CharT>::do_close(catalog)
const
103 template<
typename _CharT>
104 messages_byname<_CharT>::messages_byname(
const char* __s,
size_t __refs)
105 : messages<_CharT>(__refs)
107 if (this->_M_name_messages != locale::facet::_S_get_c_name())
109 delete [] this->_M_name_messages;
110 if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0)
112 const size_t __len = __builtin_strlen(__s) + 1;
113 char* __tmp =
new char[__len];
114 __builtin_memcpy(__tmp, __s, __len);
115 this->_M_name_messages = __tmp;
118 this->_M_name_messages = locale::facet::_S_get_c_name();
121 if (__builtin_strcmp(__s,
"C") != 0
122 && __builtin_strcmp(__s,
"POSIX") != 0)
124 this->_S_destroy_c_locale(this->_M_c_locale_messages);
125 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
129 _GLIBCXX_END_NAMESPACE_VERSION
messages(size_t __refs=0)
Constructor performs initialization.
virtual ~messages()
Destructor.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
Primary class template messages.This facet encapsulates the code to retrieve messages from message ca...