197403Sobrien// std::messages implementation details, generic version -*- C++ -*- 297403Sobrien 3132720Skan// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. 497403Sobrien// 597403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 697403Sobrien// software; you can redistribute it and/or modify it under the 797403Sobrien// terms of the GNU General Public License as published by the 897403Sobrien// Free Software Foundation; either version 2, or (at your option) 997403Sobrien// any later version. 1097403Sobrien 1197403Sobrien// This library is distributed in the hope that it will be useful, 1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1497403Sobrien// GNU General Public License for more details. 1597403Sobrien 1697403Sobrien// You should have received a copy of the GNU General Public License along 1797403Sobrien// with this library; see the file COPYING. If not, write to the Free 18169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 1997403Sobrien// USA. 2097403Sobrien 2197403Sobrien// As a special exception, you may use this file as part of a free software 2297403Sobrien// library without restriction. Specifically, if other files instantiate 2397403Sobrien// templates or use macros or inline functions from this file, or you compile 2497403Sobrien// this file and link it with other files to produce an executable, this 2597403Sobrien// file does not by itself cause the resulting executable to be covered by 2697403Sobrien// the GNU General Public License. This exception does not however 2797403Sobrien// invalidate any other reasons why the executable file might be covered by 2897403Sobrien// the GNU General Public License. 2997403Sobrien 30169691Skan/** @file messages_members.h 31169691Skan * This is an internal header file, included by other library headers. 32169691Skan * You should not attempt to use it directly. 33169691Skan */ 34169691Skan 3597403Sobrien// 3697403Sobrien// ISO C++ 14882: 22.2.7.1.2 messages virtual functions 3797403Sobrien// 3897403Sobrien 3997403Sobrien// Written by Benjamin Kosnik <bkoz@redhat.com> 4097403Sobrien 41169691Skan_GLIBCXX_BEGIN_NAMESPACE(std) 42169691Skan 4397403Sobrien // Non-virtual member functions. 4497403Sobrien template<typename _CharT> 45110614Skan messages<_CharT>::messages(size_t __refs) 46132720Skan : facet(__refs) 47132720Skan { _M_c_locale_messages = _S_get_c_locale(); } 48110614Skan 49110614Skan template<typename _CharT> 50117397Skan messages<_CharT>::messages(__c_locale, const char*, size_t __refs) 51132720Skan : facet(__refs) 52132720Skan { _M_c_locale_messages = _S_get_c_locale(); } 53110614Skan 54110614Skan template<typename _CharT> 5597403Sobrien typename messages<_CharT>::catalog 5697403Sobrien messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 5797403Sobrien const char*) const 5897403Sobrien { return this->do_open(__s, __loc); } 5997403Sobrien 6097403Sobrien // Virtual member functions. 6197403Sobrien template<typename _CharT> 62110614Skan messages<_CharT>::~messages() 63110614Skan { _S_destroy_c_locale(_M_c_locale_messages); } 64110614Skan 65110614Skan template<typename _CharT> 6697403Sobrien typename messages<_CharT>::catalog 6797403Sobrien messages<_CharT>::do_open(const basic_string<char>&, const locale&) const 6897403Sobrien { return 0; } 6997403Sobrien 7097403Sobrien template<typename _CharT> 7197403Sobrien typename messages<_CharT>::string_type 7297403Sobrien messages<_CharT>::do_get(catalog, int, int, 7397403Sobrien const string_type& __dfault) const 7497403Sobrien { return __dfault; } 7597403Sobrien 7697403Sobrien template<typename _CharT> 7797403Sobrien void 7897403Sobrien messages<_CharT>::do_close(catalog) const 7997403Sobrien { } 80110614Skan 81110614Skan // messages_byname 82110614Skan template<typename _CharT> 83110614Skan messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) 84110614Skan : messages<_CharT>(__refs) 85110614Skan { 86132720Skan if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) 87132720Skan { 88132720Skan this->_S_destroy_c_locale(this->_M_c_locale_messages); 89132720Skan this->_S_create_c_locale(this->_M_c_locale_messages, __s); 90132720Skan } 91110614Skan } 92169691Skan 93169691Skan_GLIBCXX_END_NAMESPACE 94