]>
Commit | Line | Data |
---|---|---|
c099f5df | 1 | // std::messages implementation details, generic version -*- C++ -*- |
20752884 | 2 | |
71e45bc2 | 3 | // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 |
c7599825 | 4 | // Free Software Foundation, Inc. |
20752884 | 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 | |
6bc9506f | 9 | // Free Software Foundation; either version 3, or (at your option) |
20752884 | 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 | ||
6bc9506f | 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/>. | |
20752884 | 25 | |
5846aeac | 26 | /** @file bits/messages_members.h |
944beac5 | 27 | * This is an internal header file, included by other library headers. |
5846aeac | 28 | * Do not attempt to use it directly. @headername{locale} |
944beac5 | 29 | */ |
30 | ||
20752884 | 31 | // |
c099f5df | 32 | // ISO C++ 14882: 22.2.7.1.2 messages virtual functions |
20752884 | 33 | // |
34 | ||
35 | // Written by Benjamin Kosnik <bkoz@redhat.com> | |
36 | ||
2948dd21 | 37 | namespace std _GLIBCXX_VISIBILITY(default) |
38 | { | |
39 | _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
944beac5 | 40 | |
c099f5df | 41 | // Non-virtual member functions. |
5cd3cc5f | 42 | template<typename _CharT> |
43 | messages<_CharT>::messages(size_t __refs) | |
90467111 | 44 | : facet(__refs) |
acf7c1f3 | 45 | { _M_c_locale_messages = _S_get_c_locale(); } |
5cd3cc5f | 46 | |
47 | template<typename _CharT> | |
47f1faa4 | 48 | messages<_CharT>::messages(__c_locale, const char*, size_t __refs) |
90467111 | 49 | : facet(__refs) |
acf7c1f3 | 50 | { _M_c_locale_messages = _S_get_c_locale(); } |
5cd3cc5f | 51 | |
c099f5df | 52 | template<typename _CharT> |
9b8efabc | 53 | typename messages<_CharT>::catalog |
c099f5df | 54 | messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, |
55 | const char*) const | |
56 | { return this->do_open(__s, __loc); } | |
57 | ||
58 | // Virtual member functions. | |
5cd3cc5f | 59 | template<typename _CharT> |
60 | messages<_CharT>::~messages() | |
61 | { _S_destroy_c_locale(_M_c_locale_messages); } | |
62 | ||
c099f5df | 63 | template<typename _CharT> |
9b8efabc | 64 | typename messages<_CharT>::catalog |
c099f5df | 65 | messages<_CharT>::do_open(const basic_string<char>&, const locale&) const |
66 | { return 0; } | |
67 | ||
68 | template<typename _CharT> | |
9b8efabc | 69 | typename messages<_CharT>::string_type |
c099f5df | 70 | messages<_CharT>::do_get(catalog, int, int, |
71 | const string_type& __dfault) const | |
72 | { return __dfault; } | |
73 | ||
74 | template<typename _CharT> | |
75 | void | |
76 | messages<_CharT>::do_close(catalog) const | |
77 | { } | |
5cd3cc5f | 78 | |
79 | // messages_byname | |
80 | template<typename _CharT> | |
81 | messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) | |
82 | : messages<_CharT>(__refs) | |
83 | { | |
c7599825 | 84 | if (__builtin_strcmp(__s, "C") != 0 |
85 | && __builtin_strcmp(__s, "POSIX") != 0) | |
0f902b7d | 86 | { |
4bada8ba | 87 | this->_S_destroy_c_locale(this->_M_c_locale_messages); |
88 | this->_S_create_c_locale(this->_M_c_locale_messages, __s); | |
0f902b7d | 89 | } |
5cd3cc5f | 90 | } |
944beac5 | 91 | |
2948dd21 | 92 | _GLIBCXX_END_NAMESPACE_VERSION |
93 | } // namespace |