]>
Commit | Line | Data |
---|---|---|
33590f13 | 1 | // std::messages implementation details, generic version -*- C++ -*- |
0214010c | 2 | |
748086b7 | 3 | // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 |
538075fe | 4 | // Free Software Foundation, Inc. |
0214010c BK |
5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
748086b7 | 9 | // Free Software Foundation; either version 3, or (at your option) |
0214010c BK |
10 | // any later version. |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
748086b7 JJ |
17 | // Under Section 7 of GPL version 3, you are granted additional |
18 | // permissions described in the GCC Runtime Library Exception, version | |
19 | // 3.1, as published by the Free Software Foundation. | |
20 | ||
21 | // You should have received a copy of the GNU General Public License and | |
22 | // a copy of the GCC Runtime Library Exception along with this program; | |
23 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
24 | // <http://www.gnu.org/licenses/>. | |
0214010c | 25 | |
143c27b0 BK |
26 | /** @file messages_members.h |
27 | * This is an internal header file, included by other library headers. | |
28 | * You should not attempt to use it directly. | |
29 | */ | |
30 | ||
0214010c | 31 | // |
33590f13 | 32 | // ISO C++ 14882: 22.2.7.1.2 messages virtual functions |
0214010c BK |
33 | // |
34 | ||
35 | // Written by Benjamin Kosnik <bkoz@redhat.com> | |
36 | ||
143c27b0 BK |
37 | _GLIBCXX_BEGIN_NAMESPACE(std) |
38 | ||
33590f13 | 39 | // Non-virtual member functions. |
1c26d8fd BK |
40 | template<typename _CharT> |
41 | messages<_CharT>::messages(size_t __refs) | |
fea4065d | 42 | : facet(__refs) |
8ae81136 | 43 | { _M_c_locale_messages = _S_get_c_locale(); } |
1c26d8fd BK |
44 | |
45 | template<typename _CharT> | |
486f4cd1 | 46 | messages<_CharT>::messages(__c_locale, const char*, size_t __refs) |
fea4065d | 47 | : facet(__refs) |
8ae81136 | 48 | { _M_c_locale_messages = _S_get_c_locale(); } |
1c26d8fd | 49 | |
33590f13 | 50 | template<typename _CharT> |
b206658a | 51 | typename messages<_CharT>::catalog |
33590f13 BK |
52 | messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, |
53 | const char*) const | |
54 | { return this->do_open(__s, __loc); } | |
55 | ||
56 | // Virtual member functions. | |
1c26d8fd BK |
57 | template<typename _CharT> |
58 | messages<_CharT>::~messages() | |
59 | { _S_destroy_c_locale(_M_c_locale_messages); } | |
60 | ||
33590f13 | 61 | template<typename _CharT> |
b206658a | 62 | typename messages<_CharT>::catalog |
33590f13 BK |
63 | messages<_CharT>::do_open(const basic_string<char>&, const locale&) const |
64 | { return 0; } | |
65 | ||
66 | template<typename _CharT> | |
b206658a | 67 | typename messages<_CharT>::string_type |
33590f13 BK |
68 | messages<_CharT>::do_get(catalog, int, int, |
69 | const string_type& __dfault) const | |
70 | { return __dfault; } | |
71 | ||
72 | template<typename _CharT> | |
73 | void | |
74 | messages<_CharT>::do_close(catalog) const | |
75 | { } | |
1c26d8fd BK |
76 | |
77 | // messages_byname | |
78 | template<typename _CharT> | |
79 | messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) | |
80 | : messages<_CharT>(__refs) | |
81 | { | |
538075fe PC |
82 | if (__builtin_strcmp(__s, "C") != 0 |
83 | && __builtin_strcmp(__s, "POSIX") != 0) | |
bf5fe473 | 84 | { |
563ae04f BK |
85 | this->_S_destroy_c_locale(this->_M_c_locale_messages); |
86 | this->_S_create_c_locale(this->_M_c_locale_messages, __s); | |
bf5fe473 | 87 | } |
1c26d8fd | 88 | } |
143c27b0 BK |
89 | |
90 | _GLIBCXX_END_NAMESPACE |