39 namespace std _GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
44 template<
typename _CharT>
46 : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
47 _M_name_messages(_S_get_c_name())
50 template<
typename _CharT>
53 : facet(__refs), _M_c_locale_messages(0), _M_name_messages(0)
55 if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
57 const size_t __len = __builtin_strlen(__s) + 1;
58 char* __tmp =
new char[__len];
59 __builtin_memcpy(__tmp, __s, __len);
60 _M_name_messages = __tmp;
63 _M_name_messages = _S_get_c_name();
66 _M_c_locale_messages = _S_clone_c_locale(__cloc);
69 template<
typename _CharT>
70 typename messages<_CharT>::catalog
72 const char* __dir)
const
74 bindtextdomain(__s.
c_str(), __dir);
75 return this->do_open(__s, __loc);
79 template<
typename _CharT>
82 if (_M_name_messages != _S_get_c_name())
83 delete [] _M_name_messages;
84 _S_destroy_c_locale(_M_c_locale_messages);
87 template<
typename _CharT>
88 typename messages<_CharT>::catalog
94 textdomain(__s.
c_str());
98 template<
typename _CharT>
100 messages<_CharT>::do_close(catalog)
const
104 template<
typename _CharT>
105 messages_byname<_CharT>::messages_byname(
const char* __s,
size_t __refs)
106 : messages<_CharT>(__refs)
108 if (this->_M_name_messages != locale::facet::_S_get_c_name())
110 delete [] this->_M_name_messages;
111 if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0)
113 const size_t __len = __builtin_strlen(__s) + 1;
114 char* __tmp =
new char[__len];
115 __builtin_memcpy(__tmp, __s, __len);
116 this->_M_name_messages = __tmp;
119 this->_M_name_messages = locale::facet::_S_get_c_name();
122 if (__builtin_strcmp(__s,
"C") != 0
123 && __builtin_strcmp(__s,
"POSIX") != 0)
125 this->_S_destroy_c_locale(this->_M_c_locale_messages);
126 this->_S_create_c_locale(this->_M_c_locale_messages, __s);
130 _GLIBCXX_END_NAMESPACE_VERSION
Container class for localization functionality.The locale class is first a class wrapper for C librar...
virtual ~messages()
Destructor.
Primary class template messages.This facet encapsulates the code to retrieve messages from message ca...
const _CharT * c_str() const
Return const pointer to null-terminated contents.
messages(size_t __refs=0)
Constructor performs initialization.